-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
250a4cb
commit 1a22233
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const { | ||
ContextMenuCommandBuilder, | ||
ApplicationCommandType, | ||
EmbedBuilder, | ||
PermissionFlagsBits, | ||
} = require("discord.js"); | ||
module.exports = { | ||
name: "info", | ||
data: new ContextMenuCommandBuilder() | ||
.setName("remove") | ||
.setType(ApplicationCommandType.Message) | ||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator), | ||
async execute(interaction) { | ||
//remove the message | ||
interaction.channel.messages.fetch(interaction.targetId).then((message) => { | ||
const { author, content, channel } = message; | ||
const { user: interactionUser } = interaction; | ||
|
||
const removedMessageEmbed = new EmbedBuilder() | ||
.setTitle("Message removed") | ||
.setDescription( | ||
`${author.displayName}'s message has been removed by ${interactionUser.displayName}` | ||
) | ||
.addFields( | ||
{ name: "Message", value: content, inline: false }, | ||
{ name: "Channel", value: channel.name, inline: false } | ||
) | ||
.setColor("#FF0000") | ||
.setTimestamp(); | ||
|
||
global.client.logChannel.send({ embeds: [removedMessageEmbed] }); | ||
|
||
const userMessageEmbed = new EmbedBuilder() | ||
.setTitle("Your message has been removed") | ||
.setDescription( | ||
`Your message has been removed by ${interactionUser.displayName}` | ||
) | ||
.addFields( | ||
{ name: "Message", value: content, inline: false }, | ||
{ name: "Channel", value: channel.name, inline: false } | ||
) | ||
.setColor("#FF0000") | ||
.setTimestamp(); | ||
|
||
author.send({ embeds: [userMessageEmbed] }); | ||
|
||
message.delete(); | ||
}); | ||
//send a message to the channel | ||
interaction.reply({ content: "Message removed", ephemeral: true }); | ||
}, | ||
isGuild: true, | ||
}; |