From 80f2dacb7f3f98efd18d661163f6b8cce9b8b435 Mon Sep 17 00:00:00 2001 From: almeidx Date: Thu, 29 Jul 2021 01:22:37 +0100 Subject: [PATCH] simplified avatar cmd --- backend/src/plugins/Utility/commands/AvatarCmd.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/src/plugins/Utility/commands/AvatarCmd.ts b/backend/src/plugins/Utility/commands/AvatarCmd.ts index cf8714b1..d503bc97 100644 --- a/backend/src/plugins/Utility/commands/AvatarCmd.ts +++ b/backend/src/plugins/Utility/commands/AvatarCmd.ts @@ -16,15 +16,12 @@ export const AvatarCmd = utilityCmd({ async run({ message: msg, args, pluginData }) { const user = args.user || msg.author; if (!(user instanceof UnknownUser)) { - const avatar = user.displayAvatarURL(); - let extension = avatar.slice(avatar.lastIndexOf("."), avatar.lastIndexOf("?")); - // Some pngs can have the .jpg extention for some reason, so we always use .png for static images - extension = extension === ".gif" ? extension : ".png"; - const avatarUrl = avatar.slice(0, avatar.lastIndexOf(".")); const embed: MessageEmbedOptions = { - image: { url: avatarUrl + `${extension}?size=2048` }, + image: { + url: user.displayAvatarURL({ dynamic: true, format: "png", size: 2048 }), + }, + title: `Avatar of ${user.tag}:`, }; - embed.title = `Avatar of ${user.tag}:`; msg.channel.send({ embeds: [embed] }); } else { sendErrorMessage(pluginData, msg.channel, "Invalid user ID");