This commit is contained in:
Expand-sys 2021-10-29 20:10:39 +11:00
parent 668cf9b78d
commit 195c63c35c
3 changed files with 4 additions and 44 deletions

View file

@ -4,6 +4,9 @@ module.exports = {
name: "link",
description: "link your ccash account",
async execute(message, args) {
if (!args[0] || !args[1]) {
message.reply("You need to enter arguments for this command to work");
}
let result = await link(message.author, args[0], args[1]);
console.log(result);
if (result == true) {

View file

@ -1,43 +0,0 @@
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, message);
},
};
function spawnMC(channel, message) {
let options = {
shell: true,
cwd: "/CCash/CCash/build",
};
let arguments = message.content.split("!ccash ");
const ccash = spawn(`./bank ${arguments[1]}`, [``], 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}`);
});
}

View file

@ -1,7 +1,7 @@
const db = require("quick.db");
const got = require("got");
api = process.env.CCASHAPIURL;
async function link(disc, user, pass) {
async function link(disc, userpass) {
let verified = await got.post(process.env.CCASHAPIURL + "BankF/vpass", {
json: {
name: user,