mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-17 03:38:17 +00:00
fix(handlers): support for custom emoji in reaction remove functions (#400)
This commit is contained in:
@@ -152,6 +152,12 @@ export function removeReaction(
|
|||||||
messageID: string,
|
messageID: string,
|
||||||
reaction: string,
|
reaction: string,
|
||||||
) {
|
) {
|
||||||
|
if (reaction.startsWith("<:")) {
|
||||||
|
reaction = reaction.substring(2, reaction.length - 1);
|
||||||
|
} else if (reaction.startsWith("<a:")) {
|
||||||
|
reaction = reaction.substring(3, reaction.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
return RequestManager.delete(
|
return RequestManager.delete(
|
||||||
endpoints.CHANNEL_MESSAGE_REACTION_ME(
|
endpoints.CHANNEL_MESSAGE_REACTION_ME(
|
||||||
channelID,
|
channelID,
|
||||||
@@ -176,6 +182,12 @@ export async function removeUserReaction(
|
|||||||
throw new Error(Errors.MISSING_MANAGE_MESSAGES);
|
throw new Error(Errors.MISSING_MANAGE_MESSAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reaction.startsWith("<:")) {
|
||||||
|
reaction = reaction.substring(2, reaction.length - 1);
|
||||||
|
} else if (reaction.startsWith("<a:")) {
|
||||||
|
reaction = reaction.substring(3, reaction.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
return RequestManager.delete(
|
return RequestManager.delete(
|
||||||
endpoints.CHANNEL_MESSAGE_REACTION_USER(
|
endpoints.CHANNEL_MESSAGE_REACTION_USER(
|
||||||
channelID,
|
channelID,
|
||||||
@@ -217,6 +229,13 @@ export async function removeReactionEmoji(
|
|||||||
) {
|
) {
|
||||||
throw new Error(Errors.MISSING_MANAGE_MESSAGES);
|
throw new Error(Errors.MISSING_MANAGE_MESSAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reaction.startsWith("<:")) {
|
||||||
|
reaction = reaction.substring(2, reaction.length - 1);
|
||||||
|
} else if (reaction.startsWith("<a:")) {
|
||||||
|
reaction = reaction.substring(3, reaction.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
return RequestManager.delete(
|
return RequestManager.delete(
|
||||||
endpoints.CHANNEL_MESSAGE_REACTION(channelID, messageID, reaction),
|
endpoints.CHANNEL_MESSAGE_REACTION(channelID, messageID, reaction),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user