From 84ff17fd9bb5fcf3c85e3548e3e31b7fa1ebefe5 Mon Sep 17 00:00:00 2001 From: Dark <7890309+DarkView@users.noreply.github.com> Date: Thu, 19 Aug 2021 19:08:29 +0200 Subject: [PATCH] Fix "invalid role id" in addrole command --- backend/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/utils.ts b/backend/src/utils.ts index b9bd8d92..0c243941 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -1392,8 +1392,8 @@ export async function resolveRoleId(bot: Client, guildId: string, value: string) // Role name const roleList = (await bot.guilds.fetch(guildId as Snowflake)).roles.cache; const role = roleList.filter(x => x.name.toLocaleLowerCase() === value.toLocaleLowerCase()); - if (role[0]) { - return role[0].id; + if (role.size >= 1) { + return role.firstKey(); } // Role ID