From c5bf06fafe218e14365b38824207af66c6e09f6d Mon Sep 17 00:00:00 2001 From: liushuyu Date: Tue, 27 Feb 2024 16:41:27 -0700 Subject: [PATCH] server: temporarily making some commands as admin-only --- src/server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 58404ac..7534d6a 100644 --- a/src/server.ts +++ b/src/server.ts @@ -196,7 +196,9 @@ client.on('messageCreate', async (message) => { logger.error(`Unable to get the roles for ${message.author}`); return; } - if (cachedModule && cachedModule.roles && !findArray(authorRoles, cachedModule.roles)) { + const isAllowed = (cmd === 'case' && findArray(authorRoles, ['Admins', 'Moderators', 'Developer'])) || + (cachedModule?.roles && findArray(authorRoles, cachedModule.roles)); + if (!isAllowed) { await state.logChannel?.send(`${message.author.toString()} attempted to use admin command: ${message.content}`); logger.info(`${message.author.username} ${message.author} attempted to use admin command: ${message.content}`); return;