From 3e81e076b777fd1964cad975cc274e58eda1ba52 Mon Sep 17 00:00:00 2001 From: metal Date: Sat, 21 Aug 2021 18:52:41 +0100 Subject: [PATCH] Update backend/src/plugins/CustomEvents/actions/addRoleAction.ts Co-authored-by: Almeida --- backend/src/plugins/CustomEvents/actions/addRoleAction.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/plugins/CustomEvents/actions/addRoleAction.ts b/backend/src/plugins/CustomEvents/actions/addRoleAction.ts index 87e94519..7833d431 100644 --- a/backend/src/plugins/CustomEvents/actions/addRoleAction.ts +++ b/backend/src/plugins/CustomEvents/actions/addRoleAction.ts @@ -28,8 +28,7 @@ export async function addRoleAction( if (event.trigger.type === "command" && !canActOn(pluginData, eventData.msg.member, target)) { throw new ActionError("Missing permissions"); } - const targetRoles = [...target.roles.cache.keys()]; - const rolesToAdd = (Array.isArray(action.role) ? action.role : [action.role]).filter(id => !targetRoles.includes(id)); + const rolesToAdd = (Array.isArray(action.role) ? action.role : [action.role]).filter(id => !target.roles.cache.has(id)); if (rolesToAdd.length === 0) { throw new ActionError("Target already has the role(s) specified"); }