mirror of
https://github.com/Expand-sys/ccashbot
synced 2025-12-16 23:52:14 +11:00
added ccash management
This commit is contained in:
parent
c5f0808867
commit
3a03348836
2 changed files with 43 additions and 30 deletions
43
commands/moderation/ccash.js
Normal file
43
commands/moderation/ccash.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
const fs = require("fs");
|
||||
const got = require("got");
|
||||
|
||||
const { spawn } = require("child_process");
|
||||
let minecraftin;
|
||||
module.exports = {
|
||||
name: "ccash",
|
||||
description: "start mc server",
|
||||
guildOnly: true,
|
||||
permissions: "KICK_MEMBERS",
|
||||
async execute(message, args) {
|
||||
let channel = message.guild.channels.cache.get(process.env.CCASHCHAN);
|
||||
spawnMC(channel);
|
||||
},
|
||||
};
|
||||
|
||||
function spawnMC(channel) {
|
||||
let options = {
|
||||
shell: true,
|
||||
cwd: "/CCash/CCash/build",
|
||||
};
|
||||
let arguments = message.content.split("!ccash ");
|
||||
const ccash = spawn("./bank", [`${arguments[0]}`], options);
|
||||
ccash.stdout.on("data", (data) => {
|
||||
try {
|
||||
channel.send(`${data}`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
ccash.stderr.on("data", (data) => {
|
||||
try {
|
||||
channel.send(`${data}`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
ccash.on("close", (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
const fs = require("fs");
|
||||
const got = require("got");
|
||||
const { Rcon } = require("rcon-client");
|
||||
|
||||
const { spawn } = require("child_process");
|
||||
let minecraftin;
|
||||
module.exports = {
|
||||
name: "stop",
|
||||
description: "stop mc server",
|
||||
guildOnly: true,
|
||||
permissions: "KICK_MEMBERS",
|
||||
async execute(message, args) {
|
||||
const rcon = new Rcon({
|
||||
host: "mc.expand.gay",
|
||||
port: 25575,
|
||||
password: "6pnyf2DsCfHV67d3",
|
||||
});
|
||||
await rcon.connect();
|
||||
let res = await rcon.send(`/stop`);
|
||||
message.reply(`Server stopped Safely`);
|
||||
},
|
||||
};
|
||||
|
||||
function spawnMC(channel) {
|
||||
let options = {
|
||||
detached: true,
|
||||
shell: true,
|
||||
cwd: "/home/harrison/Desktop/minecraft/",
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue