From caa7d25bb5d83fe3fbf67ea79ee49002f40ca5a9 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Wed, 7 Aug 2024 03:30:15 +0300 Subject: [PATCH] fix: lock brain save to admins --- src/commands/chat.command.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/chat.command.ts b/src/commands/chat.command.ts index 594495f..bab704a 100644 --- a/src/commands/chat.command.ts +++ b/src/commands/chat.command.ts @@ -10,6 +10,7 @@ import { } from '@/core/megahal' import { CHAT_TRIGGERS, DEFAULT_COMMAND_PREFIX } from '@/env' import { isWhitelisted, manipulateWhitelist } from '@/lib/blacklist' +import { isAdministrator } from '@/utils/discord_utils' export default command({ command: 'chat', @@ -53,6 +54,11 @@ export default command({ message.reply('I am now unmuted') break case 'save': { + const isAdmin = await isAdministrator(message.member!) + if (!isAdmin) { + message.reply('You are not allowed to do that!') + break + } const success = await saveBrain() if (success) { const size = await getMegahalBrainSize('string')