From 2f5df2725f6eb972134e5da74b61e375877b5d43 Mon Sep 17 00:00:00 2001 From: Alex <43963205+AHanadsaker@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:35:27 -0600 Subject: [PATCH] Update giveroles.ts --- src/commands/giveroles.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/commands/giveroles.ts b/src/commands/giveroles.ts index 4105cf5..7e81d90 100644 --- a/src/commands/giveroles.ts +++ b/src/commands/giveroles.ts @@ -136,6 +136,44 @@ export class VerifyCommand extends Command { } } console.log(user.roles.length); + + if (user.roles.length > 0) { + for (let i = 0; i < user.roles.length; i++) { + if (user.roles[i].facility == "ZAE") { + break; + } + if (user.roles[i].facility != "ZMA") { + break; + } + //Really pointless since the role bot is not able to assign roles higher than itself + switch (user.roles[i].role) { + case "ATM": + roles.push(await interaction.guild?.roles.fetch(config.atm)); + break; + case "DATM": + roles.push(await interaction.guild?.roles.fetch(config.datm)); + break; + case "TA": + roles.push(await interaction.guild?.roles.fetch(config.ta)); + break; + case "FE": + roles.push(await interaction.guild?.roles.fetch(config.fe)); + break; + case "EC": + roles.push(await interaction.guild?.roles.fetch(config.ec)); + break; + case "WM": + roles.push(await interaction.guild?.roles.fetch(config.wm)); + break; + case "MTR": + roles.push(await interaction.guild?.roles.fetch(config.mtr)); + break; + case "FACCBT": + roles.push(await interaction.guild?.roles.fetch(config.mtr)); + break; + } + } + } console.log(roles);