From 4e3cfacfa445f77bfd731af3437473a44ec2328d Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Fri, 9 Feb 2024 22:41:58 +0100 Subject: [PATCH] bugfix: default permissions for members to use commands --- commands/admin/custom_vc/slash.js | 3 ++- commands/admin/self_roles/context/add.js | 5 +++-- commands/admin/self_roles/context/register.js | 5 +++-- commands/admin/self_roles/context/remove.js | 5 +++-- commands/admin/self_roles/slash.js | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/commands/admin/custom_vc/slash.js b/commands/admin/custom_vc/slash.js index 8b612c6..36b1b2e 100644 --- a/commands/admin/custom_vc/slash.js +++ b/commands/admin/custom_vc/slash.js @@ -1,10 +1,11 @@ -import { ChannelType, SlashCommandBuilder } from 'discord.js'; +import { ChannelType, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js'; import { VoiceChannel } from '../../../database.js'; export const data = new SlashCommandBuilder() .setName('custom_vc') .setDMPermission(false) .setDescription('Manages reactions for self roles.') + .setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels) .addSubcommand((subcommand) => subcommand .setName('create') diff --git a/commands/admin/self_roles/context/add.js b/commands/admin/self_roles/context/add.js index f45babc..3456acf 100644 --- a/commands/admin/self_roles/context/add.js +++ b/commands/admin/self_roles/context/add.js @@ -1,4 +1,4 @@ -import { TextInputBuilder, TextInputStyle } from 'discord.js'; +import { PermissionFlagsBits, TextInputBuilder, TextInputStyle } from 'discord.js'; import { ModalBuilder, ActionRowBuilder, @@ -10,7 +10,8 @@ import { addSelfRoles } from '../../../../shared.js'; export const data = new ContextMenuCommandBuilder() .setDMPermission(false) .setName('Add role emoji pair') - .setType(ApplicationCommandType.Message); + .setType(ApplicationCommandType.Message) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles); export async function modalSubmit(interaction) { const { fields, guild } = interaction; // Get text inputs from modal diff --git a/commands/admin/self_roles/context/register.js b/commands/admin/self_roles/context/register.js index ece08c0..5612b99 100644 --- a/commands/admin/self_roles/context/register.js +++ b/commands/admin/self_roles/context/register.js @@ -1,10 +1,11 @@ import { Message } from '../../../../database.js'; -import { ApplicationCommandType, ContextMenuCommandBuilder } from 'discord.js'; +import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits } from 'discord.js'; export const data = new ContextMenuCommandBuilder() .setDMPermission(false) .setName('Register self roles') - .setType(ApplicationCommandType.Message); + .setType(ApplicationCommandType.Message) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles); export async function execute(interaction) { const id = interaction.targetMessage.id; diff --git a/commands/admin/self_roles/context/remove.js b/commands/admin/self_roles/context/remove.js index 75fc6ca..c091368 100644 --- a/commands/admin/self_roles/context/remove.js +++ b/commands/admin/self_roles/context/remove.js @@ -1,10 +1,11 @@ import { removeSelfRoles } from '../../../../shared.js'; -import { ApplicationCommandType, ContextMenuCommandBuilder } from 'discord.js'; +import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits } from 'discord.js'; export const data = new ContextMenuCommandBuilder() .setDMPermission(false) .setName('Remove self roles') - .setType(ApplicationCommandType.Message); + .setType(ApplicationCommandType.Message) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles); export async function execute(interaction) { const id = interaction.targetMessage.id; await removeSelfRoles(interaction, id); diff --git a/commands/admin/self_roles/slash.js b/commands/admin/self_roles/slash.js index c539059..e977007 100644 --- a/commands/admin/self_roles/slash.js +++ b/commands/admin/self_roles/slash.js @@ -1,5 +1,5 @@ import { addSelfRoles } from '../../../shared.js'; -import { SlashCommandBuilder } from 'discord.js'; +import { PermissionFlagsBits, SlashCommandBuilder } from 'discord.js'; import { Message } from '../../../database.js'; const createSelfRoles = async (interaction) => { @@ -73,6 +73,7 @@ export const data = new SlashCommandBuilder() .setName('self_roles') .setDMPermission(false) .setDescription('Manages reactions for self roles.') + .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles) .addSubcommand((subcommand) => subcommand .setName('create')