From 82985b957a761f1d69496d6099785fe7b47dc389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hor=C3=A1=C4=8Dek?= Date: Wed, 8 Apr 2020 21:52:20 +0200 Subject: [PATCH] readd avatar command --- commands/avatar.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 commands/avatar.js diff --git a/commands/avatar.js b/commands/avatar.js new file mode 100644 index 0000000..6288ca5 --- /dev/null +++ b/commands/avatar.js @@ -0,0 +1,39 @@ +exports.conf = { + enabled: true, + guildOnly: false, + aliases: [], + permLevel: 'User', + requiredPerms: ['EMBED_LINKS'] +}; + +exports.help = { + name: 'avatar', + category: 'Utility', + description: 'Gives you the specified users avatar.', + usage: 'avatar ', + params: '' +}; + +exports.run = (client, message, args) => { + let user = message.mentions.users.first(); + let users; + if (!args[0] || !message.guild) { + user = message.author; + }; + + if (!user && message.guild) { + users = client.searchForMembers(message.guild, args[0]); + if (users.length > 1) { + return message.channel.send( + '<:error:466995152976871434> Found multiple users, please be more specific or mention the user instead.' + ); + } else if (users.length == 0) { + return message.channel.send( + "<:error:466995152976871434> That user doesn't seem to exist, try again!" + ); + }; + user = users[0]; + user = user.user; + } + message.channel.send(`**${user.tag}'s** avatar is: ${user.avatarURL({format: 'png', dynamic: true, size: 2048})}`); +}; \ No newline at end of file