Files
MinecraftManager/minecraft.js
2026-05-10 22:19:52 +02:00

26 lines
459 B
JavaScript

/*
Imports
*/
const { Rcon } = require("rcon-client");
require('dotenv').config()
/*
helper functions (eg, getOnlinePlayers())
*/
export async function runCommand(command){
if (typeof command != String) return;
const rcon = await Rcon.connect({
host: process.env.MC_HOST, port: process.env.MC_RCON_PORT, password: process.env.MC_RCON_PASSWORD
})
let response = await rcon.send(command);
rcon.end();
return response;
}