discord-multipurpose-bot/commands/minecraft/whitelist.js
Ayden cb5a906850
Some checks are pending
Docker / build (push) Waiting to run
Feat/Add Music Commands (#1)
* add simple music functionality

* update workflow

* update Dockerfile

* update Dockerfile

* update Dockerfile

* update Dockerfile

* add few more music commands

* add lyrics command

* update lyrics command

* add loop, and add categories to all commands

* change discord status

* seperate distube and change startup console theme

* Update README

* UPDATE LICENSE file

* fix docker compose image, add better error handling for distube and update tagging workflow

* switch to node-alpine image for docker

* switch to node-alpine image for docker

* update ascii

* music commands imporvements, implement live lyrics, some guards and bot leaving on empty

* use ffmpeg package rather than ffmpeg-static
2025-09-21 01:26:18 +01:00

39 lines
1.1 KiB
JavaScript

const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const { Rcon } = require("rcon-client");
module.exports = {
data: new SlashCommandBuilder()
.setName("whitelist")
.setDescription("Auto-whitelist a user on the Minecraft server")
.addStringOption((option) =>
option
.setName("username")
.setDescription("The Minecraft username to whitelist")
.setRequired(true)
),
isModOnly: true,
category: "Minecraft",
async execute(interaction) {
const username = interaction.options.getString("username");
await interaction.deferReply();
try {
const rcon = new Rcon({
host: process.env.RCON_HOST,
port: Number(process.env.RCON_PORT),
password: process.env.RCON_PASSWORD,
});
await rcon.connect();
const response = await rcon.send(`whitelist add ${username}`);
await rcon.end();
await interaction.editReply(`RCON Response: ${response}`);
} catch (error) {
console.error("RCON Error:", error);
await interaction.editReply(
"There was an error executing the whitelist command."
);
}
},
};