use for of and remove awaits
parent
a475df226f
commit
dee8243ad1
|
@ -21,7 +21,7 @@ export default class Role extends Command {
|
|||
const rolesToAdd = [];
|
||||
const rolesToRemove = [];
|
||||
let stop = false;
|
||||
await rolesList.forEach((arg) => {
|
||||
for (const arg of rolesList) {
|
||||
const action = arg[0];
|
||||
let role;
|
||||
if (action !== '+' && action !== '-') {
|
||||
|
@ -57,10 +57,10 @@ export default class Role extends Command {
|
|||
}
|
||||
return rolesToRemove.push(role);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (stop) return;
|
||||
await rolesToAdd.forEach((role) => member.addRole(role.id));
|
||||
await rolesToRemove.forEach((role) => member.removeRole(role.id));
|
||||
rolesToAdd.forEach((role) => member.addRole(role.id));
|
||||
rolesToRemove.forEach((role) => member.removeRole(role.id));
|
||||
return this.success(message.channel, `Changed the roles for ${member.username}#${member.discriminator}${rolesToAdd.length > 0 ? `, added \`${rolesToAdd.map((r) => r.name).join('`, `')}\`` : ''}${rolesToRemove.length > 0 ? `, removed \`${rolesToRemove.map((r) => r.name).join('`, `')}\`` : ''}`);
|
||||
} catch (err) {
|
||||
return this.client.util.handleError(err, message, this);
|
||||
|
|
Loading…
Reference in New Issue