diff --git a/src/lib/games/base/BaseReactionController.ts b/src/lib/games/base/BaseReactionController.ts index d3a3d51dbf3..c7a6899bfd7 100644 --- a/src/lib/games/base/BaseReactionController.ts +++ b/src/lib/games/base/BaseReactionController.ts @@ -3,7 +3,7 @@ import { BaseController } from '#lib/games/base/BaseController'; import type { BaseReactionGame } from '#lib/games/base/BaseReactionGame'; import { Events } from '#lib/types'; import type { LLRCData } from '#utils/LongLivingReactionCollector'; -import { getEmojiString, type SerializedEmoji } from '#utils/functions'; +import { getEmojiReactionFormat, getEmojiString, type SerializedEmoji } from '#utils/functions'; import { cast } from '#utils/util'; import { container } from '@sapphire/framework'; import { DiscordAPIError, RESTJSONErrorCodes } from 'discord.js'; @@ -43,7 +43,7 @@ export abstract class BaseReactionController extends BaseController { protected async removeEmoji(reaction: LLRCData, emoji: SerializedEmoji, userId: string): Promise { try { - await api().channels.deleteUserMessageReaction(reaction.channel.id, reaction.messageId, decodeURIComponent(emoji), userId); + await api().channels.deleteUserMessageReaction(reaction.channel.id, reaction.messageId, getEmojiReactionFormat(emoji), userId); } catch (error) { if (error instanceof DiscordAPIError) { if (error.code === RESTJSONErrorCodes.UnknownMessage || error.code === RESTJSONErrorCodes.UnknownEmoji) return; diff --git a/src/lib/util/functions/emojis.ts b/src/lib/util/functions/emojis.ts index 31fc57ca1c6..6cd637fc5f3 100644 --- a/src/lib/util/functions/emojis.ts +++ b/src/lib/util/functions/emojis.ts @@ -105,7 +105,7 @@ export function getEmojiTextFormat(emoji: SerializedEmoji): string { * Formats an emoji in the format that we can use to for reactions on Discord messages. */ export function getEmojiReactionFormat(emoji: SerializedEmoji): string { - return isSerializedTwemoji(emoji) ? emoji : `emoji:${emoji.slice(1)}`; + return isSerializedTwemoji(emoji) ? decodeURIComponent(emoji) : `emoji:${emoji.slice(1)}`; } /** diff --git a/src/lib/util/util.ts b/src/lib/util/util.ts index 51aae5f4dcb..a59f07a0fe0 100644 --- a/src/lib/util/util.ts +++ b/src/lib/util/util.ts @@ -126,7 +126,11 @@ export function getAttachment(message: Message): ImageAttachment | null { */ export function getImage(message: Message): string | null { const attachment = getAttachment(message); - return attachment ? attachment.proxyURL || attachment.url : null; + if (attachment) return attachment.proxyURL || attachment.url; + + const sticker = message.stickers.first(); + if (sticker) return sticker.url; + return null; } /**