From dee8243ad1b0cce48ea50a0b49ec79da0dfbf6dd Mon Sep 17 00:00:00 2001 From: hector6704 Date: Tue, 25 Aug 2020 15:28:53 +0200 Subject: [PATCH] use for of and remove awaits --- src/commands/role.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/role.ts b/src/commands/role.ts index cfb6519..46d2dfb 100644 --- a/src/commands/role.ts +++ b/src/commands/role.ts @@ -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);