From 98539e217d9a871f0e3d54e450862756cd5b495b Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Thu, 7 Sep 2023 00:27:41 +1000 Subject: [PATCH] Create DM subcommand --- src/commands/dev.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/commands/dev.ts b/src/commands/dev.ts index 7e29250..47d721a 100644 --- a/src/commands/dev.ts +++ b/src/commands/dev.ts @@ -122,6 +122,12 @@ export default { if (err) i.edit(UsernameHelper.stripName(err.message)) else i.edit('Your device should be awake by now!\n||Don\'t blame me if it isn\'t on.||') }) + }, + dm: async()=>{ + const member = interaction.options.getMember('member'); + const message = interaction.options.getString('message'); + const int = await interaction.reply({content: '*Sending...*', fetchReply: true}); + member.send(message).then(()=>int.edit(`Successfully sent a DM to **${member.user.username}** with the following message:\n\`\`\`${message}\`\`\``)).catch((e:Error)=>int.edit(`\`${e.message}\``)) } } as any)[interaction.options.getSubcommand()](); }, @@ -203,4 +209,15 @@ export default { .setName('name') .setDescription('JSON filename, don\'t include an extension') .setRequired(true))) + .addSubcommand(x=>x + .setName('dm') + .setDescription('Reply or send a DM to a member') + .addUserOption(x=>x + .setName('member') + .setDescription('Member to send a DM to') + .setRequired(true)) + .addStringOption(x=>x + .setName('message') + .setDescription('Message to send') + .setRequired(true))) }