Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message.deleteReaction() with userId #238

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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