From fdb6821d71d23c20b186414d3b8a6b752921faaa Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 9 Oct 2020 14:58:42 -0600 Subject: [PATCH] Avatar -small and -verysmall flags --- commands/avatar.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/commands/avatar.js b/commands/avatar.js index ddf32ca..8f474cc 100644 --- a/commands/avatar.js +++ b/commands/avatar.js @@ -1,4 +1,6 @@ const Discord = require('discord.js'); +const {Tag} = require('../util/tag'); +const {TagFilter} = require('../util/tagfilter'); module.exports = { name: "avatar", @@ -7,14 +9,18 @@ module.exports = { async execute(message, msg, args, cmd, prefix, mention, client) { let member = !args.length ? message.author : mention ? mention : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]) : message.author; let name = !args.length ? message.member ? message.member.displayName : message.author.username : mention ? mention.username : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]).username : message.author.username; + let options = new TagFilter([ + new Tag(['small', 's', 'mini', 'm'], 'small', 'toggle'), + new Tag(['verysmall', 'vsmall', '-vs', 'xs'], 'vsmall', 'toggle') + ]).test(args.join(" ")); try { - return message.channel.send(new Discord.MessageEmbed() - .setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) - .setImage(member.avatarURL({size: 2048})) - .setColor('c375f0') - .setFooter("Natsuki", client.user.avatarURL()) - .setTimestamp() - ); + let avem = new Discord.MessageEmbed() + .setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) + .setImage(member.avatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048})) + .setColor('c375f0') + .setFooter("Natsuki", client.user.avatarURL()) + if (!options.vsmall) {avem.setTimestamp();} + return message.channel.send(avem); } catch {return message.reply("Hmm, there seems to have been an error while I tried to show you that user's avatar.");} } }; \ No newline at end of file