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