Haha-Yes/commands/utility/avatar.js

59 lines
2.4 KiB
JavaScript
Raw Permalink 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()
2020-03-22 21:54:19 +01:00
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
.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.reply({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.reply({embed: avatarEmbed});
}
2019-01-02 08:09:45 +01:00
}
2018-12-30 01:20:24 +01:00
}
module.exports = AvatarCommand;