Skip to content

Commit

Permalink
fix(GuildEmojiRoleManager): bug in #remove (#5666)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed May 28, 2021
1 parent b90b0c3 commit c89bdd7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/managers/GuildEmojiRoleManager.js
Expand Up @@ -74,16 +74,16 @@ class GuildEmojiRoleManager {
remove(roleOrRoles) {
if (!Array.isArray(roleOrRoles) && !(roleOrRoles instanceof Collection)) roleOrRoles = [roleOrRoles];

const resolvedRoles = [];
const resolvedRoleIDs = [];
for (const role of roleOrRoles.values()) {
const resolvedRole = this.guild.roles.resolveID(role);
if (!resolvedRole) {
const roleID = this.guild.roles.resolveID(role);
if (!roleID) {
return Promise.reject(new TypeError('INVALID_ELEMENT', 'Array or Collection', 'roles', role));
}
resolvedRoles.push(resolvedRole);
resolvedRoleIDs.push(roleID);
}

const newRoles = this._roles.keyArray().filter(role => !resolvedRoles.includes(role.id));
const newRoles = this._roles.keyArray().filter(id => !resolvedRoleIDs.includes(id));
return this.set(newRoles);
}

Expand Down

0 comments on commit c89bdd7

Please sign in to comment.