From 5840306b018a4424029bfd7c8f50a3761f51968f Mon Sep 17 00:00:00 2001 From: themrrobert <10122432+themrrobert@users.noreply.github.com> Date: Sat, 24 Feb 2024 18:13:55 -0800 Subject: [PATCH] Fix emojis in pinned trips / gearpresets. --- src/mahoji/commands/config.ts | 9 +++++---- src/mahoji/commands/gearpresets.ts | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mahoji/commands/config.ts b/src/mahoji/commands/config.ts index 6c22feff83..c30216dd6e 100644 --- a/src/mahoji/commands/config.ts +++ b/src/mahoji/commands/config.ts @@ -666,14 +666,15 @@ export async function pinTripCommand( if (!trip) return 'Invalid trip.'; if (emoji) { - const cachedEmoji = globalClient.emojis.cache.get(emoji); - if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { - return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; - } const res = ParsedCustomEmojiWithGroups.exec(emoji); if (!res || !res[3]) return "That's not a valid emoji."; // eslint-disable-next-line prefer-destructuring emoji = res[3]; + + const cachedEmoji = globalClient.emojis.cache.get(emoji); + if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { + return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; + } } if (customName) { diff --git a/src/mahoji/commands/gearpresets.ts b/src/mahoji/commands/gearpresets.ts index c61a394153..7e41274156 100644 --- a/src/mahoji/commands/gearpresets.ts +++ b/src/mahoji/commands/gearpresets.ts @@ -107,14 +107,15 @@ export async function createOrEditGearSetup( } if (emoji) { - const cachedEmoji = globalClient.emojis.cache.get(emoji); - if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { - return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; - } const res = ParsedCustomEmojiWithGroups.exec(emoji); if (!res || !res[3]) return "That's not a valid emoji."; // eslint-disable-next-line prefer-destructuring emoji = res[3]; + + const cachedEmoji = globalClient.emojis.cache.get(emoji); + if ((!cachedEmoji || !emojiServers.has(cachedEmoji.guild.id)) && production) { + return "Sorry, that emoji can't be used. Only emojis in the main support server, or our emoji servers can be used."; + } } const gearData = {