to an option object

This commit is contained in:
ITOH
2021-04-30 18:57:44 +02:00
parent ce5f890973
commit 5a526c809b
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -7,9 +7,9 @@ export async function removeReaction(
channelId: string, channelId: string,
messageId: string, messageId: string,
reaction: string, reaction: string,
userId?: string, options?: { userId?: string },
) { ) {
if (userId) { if (options?.userId) {
await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]); await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]);
} }
@@ -21,12 +21,12 @@ export async function removeReaction(
return await rest.runMethod<undefined>( return await rest.runMethod<undefined>(
"delete", "delete",
userId options?.userId
? endpoints.CHANNEL_MESSAGE_REACTION_USER( ? endpoints.CHANNEL_MESSAGE_REACTION_USER(
channelId, channelId,
messageId, messageId,
reaction, reaction,
userId, options.userId,
) )
: endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction), : endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction),
); );
+1 -1
View File
@@ -122,7 +122,7 @@ const baseMessage: Partial<DiscordenoMessage> = {
return removeReactionEmoji(this.channelId!, this.id!, reaction); return removeReactionEmoji(this.channelId!, this.id!, reaction);
}, },
removeReaction(reaction, userId) { removeReaction(reaction, userId) {
return removeReaction(this.channelId!, this.id!, reaction, userId); return removeReaction(this.channelId!, this.id!, reaction, { userId });
}, },
}; };
+1 -1
View File
@@ -31,7 +31,7 @@ async function ifItFailsBlameWolf(type: "getter" | "raw", user = false) {
message.channelId, message.channelId,
message.id, message.id,
"❤", "❤",
user ? message.author.id : undefined, user ? { userId: message.author.id } : undefined,
); );
} else { } else {
await message.removeReaction("❤", user ? message.author.id : undefined); await message.removeReaction("❤", user ? message.author.id : undefined);