Bot say to who the message have been sent

This commit is contained in:
Loic Bersier 2018-11-13 22:32:41 +01:00
parent 05612d2a64
commit fbb8d3ce40

View file

@ -10,30 +10,28 @@ module.exports = class dmCommand extends Command {
ownerOnly: true, ownerOnly: true,
args: [ args: [
{ {
key: 'id', key: 'user',
prompt: 'Wich user would you like to dm?', prompt: 'Wich user would you like to dm?',
type: 'string', type: 'user',
}, },
{ {
key: 'text', key: 'text',
prompt: 'Wich user would you like to dm?', prompt: 'What do you want to say to the user',
type: 'string', type: 'string',
default: ''
} }
] ]
}); });
} }
async run(message, { id, text }) { async run(message, { user, text }) {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
const user = this.client.users.get(id);
if (Attachment[0]) { if (Attachment[0]) {
user.send(`**Message from the dev**\n${text}\n${Attachment[0].url}`) user.send(`**Message from the dev:**\n${text}\n${Attachment[0].url}`)
message.say('DM sent') message.say(`DM sent to ${user.username}`)
} }
else { else {
user.send(`**Message from the dev**\n${text}`) user.send(`**Message from the dev:**\n${text}`)
message.say('DM sent') message.say(`DM sent to ${user.username}`)
} }
} }
}; };