2018-12-30 03:39:49 +01:00
|
|
|
const { Command } = require('discord-akairo');
|
|
|
|
|
|
|
|
class BotAvatarCommand extends Command {
|
2019-01-02 08:09:45 +01:00
|
|
|
constructor() {
|
|
|
|
super('botavatar', {
|
|
|
|
aliases: ['botavatar', 'bavatar'],
|
|
|
|
category: 'owner',
|
|
|
|
ownerOnly: 'true',
|
|
|
|
args: [
|
|
|
|
{
|
|
|
|
id: 'image',
|
|
|
|
type:'string',
|
2019-01-14 11:41:15 +01:00
|
|
|
match: 'rest'
|
2019-01-02 08:09:45 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
description: {
|
2018-12-30 03:39:49 +01:00
|
|
|
content: 'Change bot profil picture',
|
|
|
|
usage: '[image attachment/or link]',
|
|
|
|
examples: ['image file']
|
|
|
|
}
|
2019-01-02 08:09:45 +01:00
|
|
|
});
|
|
|
|
}
|
2018-12-30 03:39:49 +01:00
|
|
|
|
2019-01-02 08:09:45 +01:00
|
|
|
async exec(message, args) {
|
|
|
|
let Attachment = (message.attachments).array();
|
|
|
|
let image = args.image;
|
|
|
|
if (!Attachment[0] && !image)
|
|
|
|
return message.say('You didint provide any images');
|
2019-04-01 01:51:48 +02:00
|
|
|
else if (image && !Attachment[0]) {
|
|
|
|
this.client.user.setAvatar(image)
|
|
|
|
.catch(() => message.channel.send('The link you provided dosen\'t work... is it a picture?'));
|
|
|
|
return message.channel.send('The avatar have been changed succesfully');
|
|
|
|
}
|
2019-01-02 08:09:45 +01:00
|
|
|
else
|
|
|
|
image = Attachment[0].url;
|
|
|
|
|
|
|
|
this.client.user.setAvatar(image)
|
|
|
|
.catch(() => message.channel.send('The link you provided dosen\'t work... is it a picture?'));
|
|
|
|
message.channel.send('The avatar have been changed succesfully');
|
2018-12-30 03:39:49 +01:00
|
|
|
|
|
|
|
|
2019-01-02 08:09:45 +01:00
|
|
|
}
|
2018-12-30 03:39:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BotAvatarCommand;
|