1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 12:21:00 -05:00

Create DM subcommand

This commit is contained in:
AnxietyisReal 2023-09-07 00:27:41 +10:00
parent df8be80f6d
commit 98539e217d

View File

@ -122,6 +122,12 @@ export default {
if (err) i.edit(UsernameHelper.stripName(err.message)) 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.||') 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()](); } as any)[interaction.options.getSubcommand()]();
}, },
@ -203,4 +209,15 @@ export default {
.setName('name') .setName('name')
.setDescription('JSON filename, don\'t include an extension') .setDescription('JSON filename, don\'t include an extension')
.setRequired(true))) .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)))
} }