Updated import

This commit is contained in:
2024-01-12 17:59:20 +01:00
parent 52f170c4a8
commit 9bcc42b020
5 changed files with 132 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { ChannelType, Message } from "discord.js"
import { Event } from "../../../interfaces"
import snipeCacheSchema from "../../../schemas/snipeCacheSchema"
import mongoose from "mongoose"
import { SnipeCache } from "../../../utils/Types"
import env from "../../../utils/Env"
export = {
name: "snipecache",
description: "Logs messages for the snipe command",
type: "event",
event: "messageDelete",
async execute(message: Message) {
if (message.channel.type !== ChannelType.GuildText) return
if (message.author.bot) return
if (message.author.id !== env.prod.dev) return
const msg: SnipeCache = {
author: message.author.id,
content: message.content,
channel: message.channel.id,
createdAt: message.createdTimestamp,
deletedAt: Date.now(),
attachments: message.attachments.map(a => a.url) || [],
}
const snipeCache = new snipeCacheSchema({
_id: new mongoose.Types.ObjectId,
userid: message.author.id,
channelid: message.channel.id,
data: msg,
})
await snipeCache.save()
}
} as Event