mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2025-04-10 14:06:24 +01:00
Compare commits
No commits in common. "0ddaf4caea97ca59dd30776639222cb3427f5be6" and "7d8e76f875f7756fbeff61e43d21818ae71bcb70" have entirely different histories.
0ddaf4caea
...
7d8e76f875
3 changed files with 1 additions and 56 deletions
|
@ -15,9 +15,4 @@ TRACKER_API_URL=YOUR_TRACKER_API_URL
|
|||
TRACKER_API_KEY=YOUR_TRACKER_API_KEY
|
||||
|
||||
# Database
|
||||
MONGODB_URI=YOUR_MONGODB_URI
|
||||
|
||||
# RCON
|
||||
RCON_HOST=your_rcon_host
|
||||
RCON_PORT=your_rcon_port
|
||||
RCON_PASSWORD=your_rcon_password
|
||||
MONGODB_URI=YOUR_MONGODB_URI
|
|
@ -1,49 +0,0 @@
|
|||
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,
|
||||
|
||||
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 {
|
||||
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."
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
|
@ -21,7 +21,6 @@
|
|||
"nodemailer": "^6.9.14",
|
||||
"owoify-js": "^2.0.0",
|
||||
"puppeteer": "^23.4.1",
|
||||
"rcon-client": "^4.2.5",
|
||||
"uuid": "^11.0.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue