From bc238d919ddd5b0b5af16ecbb0ed011d3940b518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 6 Jun 2023 04:37:06 +0300 Subject: [PATCH] Rename devId to devIds in config --- src/Client.ts | 1 - src/client/commands/maintenance.ts | 2 +- src/client/events/ready.ts | 14 ++++---------- src/client/funcs/isDev.ts | 12 ++++++------ src/config.ts | 2 +- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index cb598d8..336bf33 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -28,7 +28,6 @@ export default class RadioClient extends Client { public streamer: Streamer | null; public statistics: Statistics | null; public radio: Radio | null; - public developers: string | undefined; constructor() { super({ diff --git a/src/client/commands/maintenance.ts b/src/client/commands/maintenance.ts index 4331714..6c2e82b 100644 --- a/src/client/commands/maintenance.ts +++ b/src/client/commands/maintenance.ts @@ -13,7 +13,7 @@ export default { async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) { let message: any = {}; - if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({ + if(!client.funcs.isDev(client.config.devIDs, interaction.user.id)) return interaction.reply({ content: client.messages.emojis["error"] + client.messages.notAllowed, ephemeral: true }); diff --git a/src/client/events/ready.ts b/src/client/events/ready.ts index ec75ba3..b36ebf5 100644 --- a/src/client/events/ready.ts +++ b/src/client/events/ready.ts @@ -20,17 +20,11 @@ export default async function ready(client: RadioClient) { client.funcs.logger('Datastore', 'Ready'); /*DEVELOPERS*/ - client.developers = ""; - let user : any= ""; - for (let i = 0; i < client.config.devId.length; i++) { - user = await client.users.fetch(client.config.devId[i]); - client.funcs.logger('Developers', user.tag); - if (i == client.config.devId.length - 1) { - client.developers += user.tag; - } else { - client.developers += user.tag + " & "; - } + let developers : string[] = []; + for(let devID of client.config.devIDs){ + developers.push((await client.users.fetch(devID)).tag); } + client.funcs.logger('Developers', developers.join(" & ")); /*STATIONS*/ client.stations = new Stations(); diff --git a/src/client/funcs/isDev.ts b/src/client/funcs/isDev.ts index 5d54e06..e601633 100644 --- a/src/client/funcs/isDev.ts +++ b/src/client/funcs/isDev.ts @@ -1,10 +1,10 @@ -export default function isDev(devList : any, authorID : any){ +import { Snowflake } from "discord.js"; + +export default function isDev(devIDs : any[], authorID : Snowflake){ let response = false; - Object.keys(devList).forEach(function(oneDev) { - let devID = devList[oneDev]; + for (const devID of devIDs){ if(authorID == devID){ - response = true; + return true; } - }); - return response; + } } diff --git a/src/config.ts b/src/config.ts index 747e8b1..aa8aa22 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,7 +8,7 @@ export default { //support supportGuild: "https://discord.gg/rRA65Mn", - devId: [ + devIDs: [ "493174343484833802", "360363051792203779" ],