From a8c1cbeceab46fcaf4233c3b613185a6454e0c53 Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 24 Apr 2023 12:11:31 +0200 Subject: [PATCH] Added congrtas message command --- commands-contextmenu/congratsmessage.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 commands-contextmenu/congratsmessage.js diff --git a/commands-contextmenu/congratsmessage.js b/commands-contextmenu/congratsmessage.js new file mode 100644 index 0000000..0e4d049 --- /dev/null +++ b/commands-contextmenu/congratsmessage.js @@ -0,0 +1,25 @@ +const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits} = require('discord.js'); + +module.exports = { + name: 'congratsmessage', + description: 'Congratulate a user.', + type: 'contextmenu', + + data: new ContextMenuCommandBuilder() + .setName('Congratulate') + .setType(ApplicationCommandType.Message) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), + + async execute(interaction) { + + const { targetId } = interaction + const target = await interaction.guild.members.fetch(targetId); + + if (!target) { + return interaction.reply({ content: 'That user does not exist.', ephemeral: true }); + } + + await interaction.reply({ content: `Congratulations ${target.user.username}!`, ephemeral: true }); + + } +}; \ No newline at end of file