server: fix the workaround logic issue

This commit is contained in:
liushuyu 2024-02-27 17:15:55 -07:00
parent 31d188933b
commit 6e27ab6c91
No known key found for this signature in database
GPG key ID: 23D1CE4534419437

View file

@ -196,8 +196,8 @@ client.on('messageCreate', async (message) => {
logger.error(`Unable to get the roles for ${message.author}`);
return;
}
const isAllowed = (cmd === 'case' && findArray(authorRoles, ['Admins', 'Moderators', 'Developer'])) ||
(cachedModule?.roles && findArray(authorRoles, cachedModule.roles));
const allowedRoles = cmd === 'case' ? ['Admins', 'Moderators', 'Developer'] : cachedModule?.roles;
const isAllowed = (!allowedRoles) || (allowedRoles && findArray(authorRoles, allowedRoles));
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}`);