From 5a526c809b18a17c7422fe61434bdd7e7f53620f Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Fri, 30 Apr 2021 18:57:44 +0200 Subject: [PATCH] to an option object --- src/helpers/messages/remove_reaction.ts | 8 ++++---- src/structures/message.ts | 2 +- tests/messages/remove_reaction.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/helpers/messages/remove_reaction.ts b/src/helpers/messages/remove_reaction.ts index 1be275af9..36866d010 100644 --- a/src/helpers/messages/remove_reaction.ts +++ b/src/helpers/messages/remove_reaction.ts @@ -7,9 +7,9 @@ export async function removeReaction( channelId: string, messageId: string, reaction: string, - userId?: string, + options?: { userId?: string }, ) { - if (userId) { + if (options?.userId) { await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]); } @@ -21,12 +21,12 @@ export async function removeReaction( return await rest.runMethod( "delete", - userId + options?.userId ? endpoints.CHANNEL_MESSAGE_REACTION_USER( channelId, messageId, reaction, - userId, + options.userId, ) : endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction), ); diff --git a/src/structures/message.ts b/src/structures/message.ts index 6e8f22bdf..014e6ea37 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -122,7 +122,7 @@ const baseMessage: Partial = { return removeReactionEmoji(this.channelId!, this.id!, reaction); }, removeReaction(reaction, userId) { - return removeReaction(this.channelId!, this.id!, reaction, userId); + return removeReaction(this.channelId!, this.id!, reaction, { userId }); }, }; diff --git a/tests/messages/remove_reaction.ts b/tests/messages/remove_reaction.ts index 722631769..0d02e83ef 100644 --- a/tests/messages/remove_reaction.ts +++ b/tests/messages/remove_reaction.ts @@ -31,7 +31,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", user = false) { message.channelId, message.id, "❤", - user ? message.author.id : undefined, + user ? { userId: message.author.id } : undefined, ); } else { await message.removeReaction("❤", user ? message.author.id : undefined);