use attachement

This commit is contained in:
loicbersier 2018-10-14 17:38:45 +02:00
parent c38c98e160
commit 0e9120bf49

View file

@ -12,13 +12,20 @@ module.exports = class BotavatarCommand extends Command {
key: 'pic', key: 'pic',
prompt: 'Wich avatar should i have?', prompt: 'Wich avatar should i have?',
type: 'string', type: 'string',
default: ''
} }
] ]
}); });
} }
async run(message, { pic }) { 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'); message.say('The avatar have been changed succesfully');
} }
}; };