Removed snipe command

This commit is contained in:
2024-02-24 12:23:39 +01:00
parent 160c3b5348
commit dc126b6371
3 changed files with 0 additions and 120 deletions

View File

@@ -1,74 +0,0 @@
import { GuildMember, SlashCommandBuilder } from "discord.js"
import snipeCacheSchema from "schemas/snipeCacheSchema"
import { ICommand } from "interfaces"
import { embedColor } from "config/options"
import { SnipeCache } from "typings"
export = {
name: "snipe",
description: "Snipes the last deleted message of a user",
public: true,
dev: false,
data: new SlashCommandBuilder()
.setName("snipe")
.setDescription("Snipes the last deleted message of a user")
.addUserOption(option =>
option
.setName("user")
.setDescription("The user to snipe")
.setRequired(true)
)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply()
const member = interaction.options.getMember("user") as GuildMember
const snipeCache = await snipeCacheSchema.find({
userid: member.user.id,
channelid: interaction.channel!.id
})
const messages: string[] = []
if (!snipeCache.length) {
await interaction.editReply({
embeds: [{
description: "No messages to snipe",
color: embedColor
}]
})
return
}
let i = 1
for (const msg of snipeCache) {
const data: SnipeCache = msg.data
if (!data.attachments.length) {
messages.push(`**Message #${i}:** ${data.content}\n`)
} else {
messages.push(`**Message #${i}:** ${data.content}`)
messages.push(`**Attachments:** ${data.attachments.join(", ")}\n`)
}
i++
}
await interaction.editReply({
embeds: [{
author: {
name: member.user.username,
icon_url: member.user.avatarURL() || undefined
},
description: messages.join("\n"),
thumbnail: {
url: member.user.avatarURL() || ""
},
color: embedColor,
footer: {
text: "ID: " + member.user.id,
icon_url: interaction.guild!.iconURL() || undefined
},
timestamp: new Date().toISOString()
}]
})
}
} as ICommand