From 0ddaf4caea97ca59dd30776639222cb3427f5be6 Mon Sep 17 00:00:00 2001 From: Ayden Jahola Date: Tue, 18 Feb 2025 13:46:35 +0000 Subject: [PATCH] minecraft: forgot to include permissions import on whitelist command --- commands/minecraft/whitelist.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/commands/minecraft/whitelist.js b/commands/minecraft/whitelist.js index cfbaabe..d5d9ffe 100644 --- a/commands/minecraft/whitelist.js +++ b/commands/minecraft/whitelist.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder } = require("discord.js"); +const { SlashCommandBuilder, PermissionsBitField } = require("discord.js"); const { Rcon } = require("rcon-client"); module.exports = { @@ -14,21 +14,21 @@ module.exports = { isModOnly: true, async execute(interaction) { + // Check if the user has the Manage Server permission + if ( + !interaction.member.permissions.has(PermissionsBitField.Flags.ManageGuild) + ) { + await interaction.reply({ + content: "You do not have permission to use this command!", + ephemeral: false, + }); + return; + } + const username = interaction.options.getString("username"); await interaction.deferReply(); try { - // committee only for now, remove once opened to public - if ( - !interaction.member.permissions.has(PermissionFlagsBits.ManageGuild) - ) { - await interaction.reply({ - content: "You do not have permission to use this command!", - ephemeral: true, - }); - return; - } - const rcon = new Rcon({ host: process.env.RCON_HOST, port: Number(process.env.RCON_PORT),