From 195c63c35ce5d817325b073811aed8e13647211c Mon Sep 17 00:00:00 2001 From: Expand-sys Date: Fri, 29 Oct 2021 20:10:39 +1100 Subject: [PATCH] yes --- commands/ccash/link.js | 3 +++ commands/moderation/ccash.js | 43 ------------------------------------ helpers/ccash.js | 2 +- 3 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 commands/moderation/ccash.js diff --git a/commands/ccash/link.js b/commands/ccash/link.js index c385499..0434488 100644 --- a/commands/ccash/link.js +++ b/commands/ccash/link.js @@ -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) { diff --git a/commands/moderation/ccash.js b/commands/moderation/ccash.js deleted file mode 100644 index b8119f4..0000000 --- a/commands/moderation/ccash.js +++ /dev/null @@ -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}`); - }); -} diff --git a/helpers/ccash.js b/helpers/ccash.js index 4892540..0ed1c72 100644 --- a/helpers/ccash.js +++ b/helpers/ccash.js @@ -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,