diff --git a/src/commands/checkroles.ts b/src/commands/checkroles.ts index 9d30118..93aa108 100644 --- a/src/commands/checkroles.ts +++ b/src/commands/checkroles.ts @@ -3,7 +3,7 @@ import { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } from 'discord.js' import { execute, type PermsNumbers } from '../db' -import { owner_id } from '../config.json' +import { owner_id, discord_guild_id } from '../config.json' module.exports = { global: false, @@ -17,6 +17,10 @@ module.exports = { } if (interaction.user.id !== owner_id) { + if (interaction.guildId !== discord_guild_id) { + void interaction.reply({ content: 'I am sorry dave, I\'m afraid I cannot do that\nRole settings are only available in main guild', ephemeral: true }) + 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 diff --git a/src/commands/setrole.ts b/src/commands/setrole.ts index 37a9f72..ea95719 100644 --- a/src/commands/setrole.ts +++ b/src/commands/setrole.ts @@ -3,10 +3,10 @@ import { SlashCommandBuilder, PermissionsBitField } from 'discord.js' import { execute } from '../db' -import { discord_guild_id } from '../config.json' +import { discord_guild_id, owner_id } from '../config.json' module.exports = { - global: false, + global: true, data: new SlashCommandBuilder() .setName('setrole') .setDescription('Adds permissions to a discord role') @@ -39,10 +39,13 @@ module.exports = { void interaction.reply({ content: 'Cannot find role', ephemeral: true }) return } - if (interaction.guildId !== discord_guild_id) { - void interaction.reply({ content: 'I am sorry dave, I\'m afraid I cannot do that\nRole settings are only available in main guild', ephemeral: true }) - return + if (interaction.user.id !== owner_id) { + if (interaction.guildId !== discord_guild_id) { + void interaction.reply({ content: 'I am sorry dave, I\'m afraid I cannot do that\nRole settings are only available in main guild', ephemeral: true }) + return + } } + if ((interaction.memberPermissions?.has(PermissionsBitField.Flags.ManageRoles, true)) !== true) { void 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