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

fix(GuildEmojiRoleManager): bug in #remove #5666

Merged
merged 1 commit into from May 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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