Skip to content

Commit

Permalink
fix(MessageReaction): toJSON() infinite recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jan 17, 2023
1 parent 56ef3ad commit ab066d3
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,7 @@ export class MessageReaction {
public remove(): Promise<MessageReaction>;
public fetch(): Promise<MessageReaction>;
public toJSON(): unknown;
public valueOf(): Snowflake;
}

export interface ModalComponentData {
Expand Down

0 comments on commit ab066d3

Please sign in to comment.