26 lines
459 B
JavaScript
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;
|
|
}
|
|
|