started with simple rcon code

This commit is contained in:
Valentijn
2026-05-10 22:19:52 +02:00
parent ad34ff36c3
commit 6fd6aa756d
2 changed files with 36 additions and 9 deletions

View File

@@ -1,13 +1,25 @@
/*
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;
}
/*
module.exports all those functions
*/