Louis Gallet a0656c5831
All checks were successful
Publish staging Docker image / Push Docker image to Gitea Container Registry (push) Successful in 1m40s
feat: Introduce role check and timer before server stop
2024-03-03 15:10:08 +01:00

24 lines
852 B
JavaScript

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", "103", function(err, res) {
if (err) {
interaction.reply("Error starting the Minecraft server: " + err);
} else {
interaction.reply("Minecraft server stopped successfully.");
}
})
}
}