From 76088da7990eaa4d79a849f5fa17b5c858cc92ee Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 2 May 2020 19:21:53 +0200 Subject: [PATCH] use ID instead of user to avoid accidental DM Signed-off-by: loicbersier --- commands/owner/dm.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/commands/owner/dm.js b/commands/owner/dm.js index 525bac6..c949905 100644 --- a/commands/owner/dm.js +++ b/commands/owner/dm.js @@ -10,11 +10,14 @@ class dmCommand extends Command { args: [ { id: 'user', - type: 'user' + type: 'string' }, { id: 'text', type: 'string', + prompt: { + start: 'What do you want to send to that user?', + }, match: 'rest' } ], @@ -38,7 +41,8 @@ class dmCommand extends Command { const uuid = uuidv4(); feedbackID[uuid] = args.text; - let user = args.user; + let user = this.client.users.resolve(args.user); + if (!user) return message.channel.send('Not a valid ID'); let text = args.text; const Embed = this.client.util.embed() @@ -49,7 +53,7 @@ class dmCommand extends Command { let Attachment = (message.attachments).array(); if (Attachment[0]) { - this.client.users.resolve(user.id).send(Embed, {files: [Attachment[0].url]}) + this.client.users.resolve(user).send(Embed, {files: [Attachment[0].url]}) .then(() => { return message.channel.send(`DM sent to ${user.username}`); }) @@ -58,7 +62,7 @@ class dmCommand extends Command { }); } else { - this.client.users.resolve(user.id).send(Embed) + this.client.users.resolve(user).send(Embed) .then(() => { return message.channel.send(`DM sent to ${user.tag}`); })