Haha-Yes/commands/utility/avatar.js

59 lines
2.4 KiB
JavaScript
Raw Normal View History

2018-12-30 01:20:24 +01:00
const { Command } = require('discord-akairo');
2018-12-05 00:52:21 +01:00
2018-12-30 01:20:24 +01:00
class AvatarCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('avatar', {
aliases: ['avatar', 'avy'],
category: 'utility',
2019-11-09 12:04:01 +01:00
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
2019-01-02 08:09:45 +01:00
args: [
{
id: 'user',
type: 'user'
2019-01-02 08:09:45 +01:00
}
],
description: {
2018-12-30 01:20:24 +01:00
content: 'Show avatar of the mentioned user or you',
usage: '(optional) [@user]',
2019-05-11 19:46:53 +02:00
examples: ['', '@user', 'username']
2018-12-30 01:20:24 +01:00
}
2019-01-02 08:09:45 +01:00
});
}
2018-09-07 19:07:10 +02:00
2019-01-02 08:09:45 +01:00
async exec(message, args) {
const avatarEmbed = this.client.util.embed()
.setColor(message.member.displayHexColor)
.setTitle('Avatar');
if (!args.user) {
2020-03-18 02:36:02 +01:00
let format = message.author.displayAvatarURL({ dynamic: true }).substr(message.author.displayAvatarURL({ dynamic: true }).length - 3);
console.log(format);
if (format == 'gif') {
avatarEmbed.setAuthor(message.author.username);
avatarEmbed.setDescription(`[gif](${message.author.displayAvatarURL({ format: 'gif', size: 2048 })})`);
avatarEmbed.setImage(message.author.displayAvatarURL({ format: 'gif', size: 2048 }));
} else {
avatarEmbed.setAuthor(message.author.username);
avatarEmbed.setDescription(`[png](${message.author.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${message.author.displayAvatarURL({ format: 'jpg', size: 2048 })}) | [webp](${message.author.displayAvatarURL({ format: 'webp', size: 2048 })})`);
avatarEmbed.setImage(message.author.displayAvatarURL({ format: 'png', size: 2048 }));
}
return message.channel.send({embed: avatarEmbed});
} else {
2020-03-18 02:36:02 +01:00
let format = args.user.displayAvatarURL({ dynamic: true }).substr(args.user.displayAvatarURL({ dynamic: true }).length - 3);
console.log(format);
if (format == 'gif') {
avatarEmbed.setAuthor(args.user.username);
avatarEmbed.setDescription(`[gif](${args.user.displayAvatarURL({ format: 'gif', size: 2048 })})`);
avatarEmbed.setImage(args.user.displayAvatarURL({ format: 'gif', size: 2048 }));
} else {
avatarEmbed.setAuthor(args.user.username);
avatarEmbed.setDescription(`[png](${args.user.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${args.user.displayAvatarURL({ format: 'jpg', size: 2048 })}) | [webp](${args.user.displayAvatarURL({ format: 'webp', size: 2048 })})`);
avatarEmbed.setImage(args.user.displayAvatarURL({ format: 'png', size: 2048 }));
}
return message.channel.send({embed: avatarEmbed});
}
2019-01-02 08:09:45 +01:00
}
2018-12-30 01:20:24 +01:00
}
module.exports = AvatarCommand;