From b6c58e32e4c7b2dc586ce5f4853a52c98a42f83d Mon Sep 17 00:00:00 2001 From: Techbot121 Date: Sun, 1 Dec 2024 12:49:30 +0100 Subject: [PATCH] actually this whole statement was wrong --- app/services/discord/modules/discord-events.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/services/discord/modules/discord-events.ts b/app/services/discord/modules/discord-events.ts index 7500675..4bba409 100644 --- a/app/services/discord/modules/discord-events.ts +++ b/app/services/discord/modules/discord-events.ts @@ -40,13 +40,12 @@ export default (bot: DiscordBot): void => { ) => { console.log(`Event "${event.name}" ended! Removing roles...`); const users = await GetParticipants(event); - if (users.length === 0) { - return; + if (users.length > 0) { + users.forEach(usr => { + if (usr.roles.cache.some(role => role.id === DiscordConfig.roles.event)) + usr.roles.remove(DiscordConfig.roles.event); + }); } - users.forEach(usr => { - if (usr.roles.cache.some(role => role.id === DiscordConfig.roles.event)) - usr.roles.remove(DiscordConfig.roles.event); - }); await event.guild?.setIcon(data.lastDiscordGuildIcon); await bot.discord.user?.setAvatar(data.lastDiscordGuildIcon); await bot.setNickname(data.lastDiscordNickName, event.name + " ended");