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';
export const data = new SlashCommandBuilder()
.setName('custom_vc')
.setDMPermission(false)
.setDescription('Manages reactions for self roles.')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels)
.addSubcommand((subcommand) =>
subcommand
.setName('create')

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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')