feat: ✨ Finish bot v1
This commit is contained in:
23
commands/server/stop-mc.js
Normal file
23
commands/server/stop-mc.js
Normal file
@ -0,0 +1,23 @@
|
||||
const { SlashCommandBuilder } = require('discord.js')
|
||||
const config = require('../../config.json')
|
||||
|
||||
if (!config.proxmoxUser || !config.proxmoxPass || !config.proxmoxHostname) {
|
||||
console.error("Proxmox credentials not found in config.json. Exiting.");
|
||||
process.exit(1);
|
||||
}
|
||||
proxmox = require("proxmox")(config.proxmoxUser, config.proxmoxPass, config.proxmoxHostname);
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('stop-mc')
|
||||
.setDescription('Stops the minecraft server machine.'),
|
||||
async execute(interaction) {
|
||||
proxmox.qemu.shutdown("pve", "102", function(err, res) {
|
||||
if (err) {
|
||||
interaction.reply("Error starting the Minecraft server: " + err);
|
||||
} else {
|
||||
interaction.reply("Minecraft server stopped successfully.");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user