From 038bde75a1cd3a6992eedcf7689a98d5576e1414 Mon Sep 17 00:00:00 2001 From: Emily J Date: Wed, 3 Mar 2021 17:02:08 +1100 Subject: [PATCH] avatar command --- bot/commands/Utility/avatar.js | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 bot/commands/Utility/avatar.js diff --git a/bot/commands/Utility/avatar.js b/bot/commands/Utility/avatar.js new file mode 100644 index 0000000..661215a --- /dev/null +++ b/bot/commands/Utility/avatar.js @@ -0,0 +1,48 @@ +module.exports = class { + constructor (name, category) { + this.name = name, + this.category = category, + this.enabled = true, + this.devOnly = false, + this.aliases = ['pfp'], + this.userPerms = [], + this.botPerms = [], + this.cooldown = 2000, + this.help = { + description: 'View a full-sized version of someone\'s avatar.', + arguments: '', + details: '', + examples: 'avatar\navatar @May\navatar emily' + }; + } + + async run (client, message, args, data) { //eslint-disable-line no-unused-vars + + let user = message.author; + + if (args[0]) { + user = message.mentions[0]; + + if (!user) { + user = await message.channel.guild.searchMembers(args.join(' '), 2); + + if (user.length < 1) return message.channel.createMessage( + `${client.emojis.userError} No users found. Check for mispellings, or ping the user instead.` + ); + + if (user.length > 1) return message.channel.createMessage( + `${client.emojis.userError} Found more than one user, try refining your search or pinging the user instead.` + ); + + user = user[0].user; + } + } + + const embed = new client.RichEmbed() + .setTitle(user.username + '#' + user.discriminator) + .setColour(client.functions.displayHexColour(message.channel.guild, user.id)) + .setImage(user.avatarURL); + + message.channel.createMessage({ embed: embed }); + } +}; \ No newline at end of file