Improve avatar command

This commit is contained in:
Daniel Odendahl Jr
2018-09-24 01:01:07 +00:00
parent 99af699085
commit 46f5e6f47b
2 changed files with 12 additions and 2 deletions
+11 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
module.exports = class AvatarCommand extends Command {
constructor(client) {
@@ -20,7 +21,16 @@ module.exports = class AvatarCommand extends Command {
}
run(msg, { user }) {
const formats = ['webp', 'png', 'jpg'];
const format = user.avatar && user.avatar.startsWith('a_') ? 'gif' : 'png';
return msg.say(user.displayAvatarURL({ format, size: 2048 }));
if (format === 'gif') formats.push('gif');
const embed = new MessageEmbed()
.setTitle(user.tag)
.setDescription(
formats.map(fmt => `[${fmt.toUpperCase()}](${user.displayAvatarURL({ format: fmt, size: 2048 })})`).join(' | ')
)
.setImage(user.displayAvatarURL({ format, size: 2048 }))
.setColor(0x00AE86);
return msg.embed(embed);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "91.10.2",
"version": "91.10.3",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {