Skip to content

Commit

Permalink
fix: implement valueOf on pseudomanagers (#4595)
Browse files Browse the repository at this point in the history
  • Loading branch information
almostSouji authored Dec 14, 2020
1 parent 75e6dfb commit 8883a01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/managers/GuildEmojiRoleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class GuildEmojiRoleManager {
_patch(roles) {
this.emoji._roles = roles;
}

valueOf() {
return this.cache;
}
}

module.exports = GuildEmojiRoleManager;
4 changes: 4 additions & 0 deletions src/managers/GuildMemberRoleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class GuildMemberRoleManager {
clone.member._roles = [...this._roles.keyArray()];
return clone;
}

valueOf() {
return this.cache;
}
}

module.exports = GuildMemberRoleManager;
2 changes: 2 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,7 @@ declare module 'discord.js' {
public remove(
roleOrRoles: RoleResolvable | readonly RoleResolvable[] | Collection<Snowflake, Role>,
): Promise<GuildEmoji>;
public valueOf(): Collection<Snowflake, Role>;
}

export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> {
Expand Down Expand Up @@ -1965,6 +1966,7 @@ declare module 'discord.js' {
roleOrRoles: RoleResolvable | readonly RoleResolvable[] | Collection<Snowflake, Role>,
reason?: string,
): Promise<GuildMember>;
public valueOf(): Collection<Snowflake, Role>;
}

export class MessageManager extends BaseManager<Snowflake, Message, MessageResolvable> {
Expand Down

0 comments on commit 8883a01

Please sign in to comment.