Skip to content

Commit

Permalink
Fix emojis in pinned trips / gearpresets.
Browse files Browse the repository at this point in the history
  • Loading branch information
themrrobert committed Feb 25, 2024
1 parent 100983a commit 5840306
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/mahoji/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.";

Check warning on line 670 in src/mahoji/commands/config.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 670 in src/mahoji/commands/config.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
// 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) {
Expand Down
9 changes: 5 additions & 4 deletions src/mahoji/commands/gearpresets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 5840306

Please sign in to comment.