From d63e6de3ae2304d892bc36c3adf86eb7af654039 Mon Sep 17 00:00:00 2001 From: Legonzaur Date: Sat, 17 Jun 2023 00:00:50 +0200 Subject: [PATCH] allow owner to check roles --- src/commands/checkroles.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commands/checkroles.ts b/src/commands/checkroles.ts index 47d5bd9..9d30118 100644 --- a/src/commands/checkroles.ts +++ b/src/commands/checkroles.ts @@ -3,6 +3,7 @@ import { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } from 'discord.js' import { execute, type PermsNumbers } from '../db' +import { owner_id } from '../config.json' module.exports = { global: false, @@ -15,9 +16,11 @@ module.exports = { return } - if ((interaction.memberPermissions?.has(PermissionsBitField.Flags.ManageRoles, true)) !== true) { - await interaction.reply({ content: 'I am sorry dave, I\'m afraid I cannot do that\nYou don\'t have the permission to manage roles on this server', ephemeral: true }) - return + if (interaction.user.id !== owner_id) { + if ((interaction.memberPermissions?.has(PermissionsBitField.Flags.ManageRoles, true)) !== true) { + await interaction.reply({ content: 'I am sorry dave, I\'m afraid I cannot do that\nYou don\'t have the permission to manage roles on this server', ephemeral: true }) + return + } } const permissionList = await execute('SELECT * FROM permissions') as Array<{ guild: string, role: string } & PermsNumbers>