diff --git a/src/helpers/interactions/sendInteractionResponse.ts b/src/helpers/interactions/sendInteractionResponse.ts index b0f92b449..8d59568fb 100644 --- a/src/helpers/interactions/sendInteractionResponse.ts +++ b/src/helpers/interactions/sendInteractionResponse.ts @@ -134,9 +134,7 @@ export async function sendInteractionResponse( }; // A reply has never been send - if (bot.cache.unrepliedInteractions.has(id)) { - bot.cache.unrepliedInteractions.delete(id); - + if (bot.cache.unrepliedInteractions.delete(id)) { return await bot.rest.runMethod(bot.rest, "post", bot.constants.endpoints.INTERACTION_ID_TOKEN(id, token), { type: options.type, data, diff --git a/src/helpers/messages/addReaction.ts b/src/helpers/messages/addReaction.ts index cb085f02a..1f4390a49 100644 --- a/src/helpers/messages/addReaction.ts +++ b/src/helpers/messages/addReaction.ts @@ -11,6 +11,7 @@ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint return await bot.rest.runMethod( bot.rest, "put", - bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction) + bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, encodeURIComponent(reaction)), + {} ); } diff --git a/src/helpers/messages/getReactions.ts b/src/helpers/messages/getReactions.ts index ae5c93f7a..b5fcfddc2 100644 --- a/src/helpers/messages/getReactions.ts +++ b/src/helpers/messages/getReactions.ts @@ -11,10 +11,16 @@ export async function getReactions( reaction: string, options?: GetReactions ) { + if (reaction.startsWith("<:")) { + reaction = reaction.substring(2, reaction.length - 1); + } else if (reaction.startsWith("( bot.rest, "get", - bot.constants.endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction), + bot.constants.endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, encodeURIComponent(reaction)), options ); diff --git a/src/helpers/messages/removeReaction.ts b/src/helpers/messages/removeReaction.ts index d43b84f5c..e15274565 100644 --- a/src/helpers/messages/removeReaction.ts +++ b/src/helpers/messages/removeReaction.ts @@ -18,7 +18,12 @@ export async function removeReaction( bot.rest, "delete", options?.userId - ? bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_USER(channelId, messageId, reaction, options.userId) - : bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction) + ? bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_USER( + channelId, + messageId, + encodeURIComponent(reaction), + options.userId + ) + : bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, encodeURIComponent(reaction)) ); } diff --git a/src/rest/createRequestBody.ts b/src/rest/createRequestBody.ts index 01045f4a4..4c7a9c88a 100644 --- a/src/rest/createRequestBody.ts +++ b/src/rest/createRequestBody.ts @@ -44,7 +44,7 @@ export function createRequestBody(rest: RestManager, queuedRequest: { request: R return { headers, - body: (queuedRequest.payload.body?.file || JSON.stringify(queuedRequest.payload.body)) as FormData | string, + body: (queuedRequest.payload.body?.file ?? JSON.stringify(queuedRequest.payload.body)) as FormData | string, method: queuedRequest.request.method.toUpperCase(), }; }