Skip to content

Commit

Permalink
feat: message#deleteReaction with userId (#238)
Browse files Browse the repository at this point in the history
* message.deleteReaction() with userId

* chore: changeset

---------

Co-authored-by: Nico <[email protected]>
  • Loading branch information
GoodOne120 and zaida04 authored Jun 30, 2023
1 parent 83e1ce0 commit 011c9c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-years-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"guilded.js": patch
---

message.deleteReaction() with userId
6 changes: 3 additions & 3 deletions packages/guilded.js/lib/managers/global/MessageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ export class GlobalMessageManager extends CacheableStructManager<string, Message
}

/**
* Deletes a reaction from a message.
* Deletes either a whole reaction emote from a message or a specific user's if a userId is provided.
*
* @param channelId The ID of the channel containing the message.
* @param contentId The ID of the message to delete the reaction from.
* @param emoteId The ID of the emote to delete as a reaction.
* @returns A promise that resolves to nothing when the reaction is deleted.
*/
async deleteReaction(channelId: string, contentId: string, emoteId: number): Promise<void> {
await this.client.reactions.delete(channelId, contentId, emoteId);
async deleteReaction(channelId: string, contentId: string, emoteId: number, userId?: string): Promise<void> {
await this.client.reactions.delete(channelId, contentId, emoteId, userId);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/guilded.js/lib/structures/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,17 @@ export class Message extends Base<ChatMessagePayload> {
}

/**
* Delete a reaction emote.
* Deletes either a whole reaction emote from a message or a specific user's if a userId is provided.
*
* @param emoteId - The ID of the emote to delete.
* @returns A promise that resolves when the emote has been deleted.
*/
deleteReaction(emoteId: number): Promise<void> {
deleteReaction(emoteId: number, userId?: string): Promise<void> {
return this.client.rest.router.reactions.channelMessageReactionDelete({
channelId: this.channelId,
messageId: this.id,
emoteId,
userId,
});
}

Expand Down

0 comments on commit 011c9c5

Please sign in to comment.