Haha-Yes/commands/owner/botAvatar.js

41 lines
942 B
JavaScript
Raw Normal View History

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
optional: true,
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');
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;