Skip to content

Commit

Permalink
fix(MessageReaction): toJSON() infinite recursion (#9070)
Browse files Browse the repository at this point in the history
* fix(MessageReaction): `toJSON()` infinite recursion

* fix: return type

Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>

---------

Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 17, 2023
1 parent 1ba22f4 commit f268e1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/discord.js/src/structures/MessageReaction.js
Expand Up @@ -117,6 +117,10 @@ class MessageReaction {
return flatten(this, { emoji: 'emojiId', message: 'messageId' });
}

valueOf() {
return this._emoji.id ?? this._emoji.name;
}

_add(user) {
if (this.partial) return;
this.users.cache.set(user.id, user);
Expand Down
1 change: 1 addition & 0 deletions packages/discord.js/typings/index.d.ts
Expand Up @@ -2156,6 +2156,7 @@ export class MessageReaction {
public remove(): Promise<MessageReaction>;
public fetch(): Promise<MessageReaction>;
public toJSON(): unknown;
public valueOf(): Snowflake | string;
}

export interface ModalComponentData {
Expand Down

2 comments on commit f268e1d

@vercel
Copy link

@vercel vercel bot commented on f268e1d Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on f268e1d Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.