bugfix: default permissions for members to use commands

This commit is contained in:
Baipyrus 2024-02-09 22:41:58 +01:00
parent 4ab74597b7
commit 4e3cfacfa4
5 changed files with 13 additions and 8 deletions

View File

@ -1,10 +1,11 @@
import { ChannelType, SlashCommandBuilder } from 'discord.js'; import { ChannelType, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
import { VoiceChannel } from '../../../database.js'; import { VoiceChannel } from '../../../database.js';
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName('custom_vc') .setName('custom_vc')
.setDMPermission(false) .setDMPermission(false)
.setDescription('Manages reactions for self roles.') .setDescription('Manages reactions for self roles.')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels)
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName('create') .setName('create')

View File

@ -1,4 +1,4 @@
import { TextInputBuilder, TextInputStyle } from 'discord.js'; import { PermissionFlagsBits, TextInputBuilder, TextInputStyle } from 'discord.js';
import { import {
ModalBuilder, ModalBuilder,
ActionRowBuilder, ActionRowBuilder,
@ -10,7 +10,8 @@ import { addSelfRoles } from '../../../../shared.js';
export const data = new ContextMenuCommandBuilder() export const data = new ContextMenuCommandBuilder()
.setDMPermission(false) .setDMPermission(false)
.setName('Add role emoji pair') .setName('Add role emoji pair')
.setType(ApplicationCommandType.Message); .setType(ApplicationCommandType.Message)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles);
export async function modalSubmit(interaction) { export async function modalSubmit(interaction) {
const { fields, guild } = interaction; const { fields, guild } = interaction;
// Get text inputs from modal // Get text inputs from modal

View File

@ -1,10 +1,11 @@
import { Message } from '../../../../database.js'; import { Message } from '../../../../database.js';
import { ApplicationCommandType, ContextMenuCommandBuilder } from 'discord.js'; import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits } from 'discord.js';
export const data = new ContextMenuCommandBuilder() export const data = new ContextMenuCommandBuilder()
.setDMPermission(false) .setDMPermission(false)
.setName('Register self roles') .setName('Register self roles')
.setType(ApplicationCommandType.Message); .setType(ApplicationCommandType.Message)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles);
export async function execute(interaction) { export async function execute(interaction) {
const id = interaction.targetMessage.id; const id = interaction.targetMessage.id;

View File

@ -1,10 +1,11 @@
import { removeSelfRoles } from '../../../../shared.js'; import { removeSelfRoles } from '../../../../shared.js';
import { ApplicationCommandType, ContextMenuCommandBuilder } from 'discord.js'; import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits } from 'discord.js';
export const data = new ContextMenuCommandBuilder() export const data = new ContextMenuCommandBuilder()
.setDMPermission(false) .setDMPermission(false)
.setName('Remove self roles') .setName('Remove self roles')
.setType(ApplicationCommandType.Message); .setType(ApplicationCommandType.Message)
.setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles);
export async function execute(interaction) { export async function execute(interaction) {
const id = interaction.targetMessage.id; const id = interaction.targetMessage.id;
await removeSelfRoles(interaction, id); await removeSelfRoles(interaction, id);

View File

@ -1,5 +1,5 @@
import { addSelfRoles } from '../../../shared.js'; import { addSelfRoles } from '../../../shared.js';
import { SlashCommandBuilder } from 'discord.js'; import { PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
import { Message } from '../../../database.js'; import { Message } from '../../../database.js';
const createSelfRoles = async (interaction) => { const createSelfRoles = async (interaction) => {
@ -73,6 +73,7 @@ export const data = new SlashCommandBuilder()
.setName('self_roles') .setName('self_roles')
.setDMPermission(false) .setDMPermission(false)
.setDescription('Manages reactions for self roles.') .setDescription('Manages reactions for self roles.')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles)
.addSubcommand((subcommand) => .addSubcommand((subcommand) =>
subcommand subcommand
.setName('create') .setName('create')