From 0e9120bf498fff45464fe858c54663871195fcad Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 14 Oct 2018 17:38:45 +0200 Subject: [PATCH] use attachement --- commands/owner/botAvatar.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/commands/owner/botAvatar.js b/commands/owner/botAvatar.js index 93ad052..f400421 100644 --- a/commands/owner/botAvatar.js +++ b/commands/owner/botAvatar.js @@ -12,13 +12,20 @@ module.exports = class BotavatarCommand extends Command { key: 'pic', prompt: 'Wich avatar should i have?', type: 'string', + default: '' } ] }); } async run(message, { pic }) { - this.client.user.setAvatar(pic); + let Attachment = (message.attachments).array(); + let image = null + if (!Attachment[0]) + return message.say('You didint provide any images') + else + image = Attachment[0].url + this.client.user.setAvatar(image); message.say('The avatar have been changed succesfully'); } }; \ No newline at end of file