From 3216aeac660c5ce3c28de08927fe5c469cc30dbc Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 18 Jun 2021 13:53:13 -0300 Subject: [PATCH] desc for commands --- commands/cb.js | 1 + commands/crash.js | 1 + commands/eval.js | 1 + commands/evalcb.js | 1 + commands/help.js | 9 ++++++--- commands/hval.js | 3 ++- commands/list.js | 7 +++++-- commands/owo.js | 1 + commands/rainbowify.js | 1 + 9 files changed, 19 insertions(+), 6 deletions(-) diff --git a/commands/cb.js b/commands/cb.js index 722f23d..26f53cc 100644 --- a/commands/cb.js +++ b/commands/cb.js @@ -1,4 +1,5 @@ module.exports.desc = "silent commandblock"; +module.exports.usage = ""; module.exports.exec = function (vanillaclient, client, server, args) { client.utils.cmdBlock(client, args.join(" ")); }; \ No newline at end of file diff --git a/commands/crash.js b/commands/crash.js index ae7b439..26d9515 100644 --- a/commands/crash.js +++ b/commands/crash.js @@ -7,6 +7,7 @@ function crashClient(client, name) { } module.exports.desc = "crash players/the server"; +module.exports.usage = "[player]"; module.exports.exec = function (vanillaclient, client, server, args) { if(args.length === 0) return crashServer(client); crashClient(client, args[0]); diff --git a/commands/eval.js b/commands/eval.js index a4c8a33..e1ee1b0 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,5 +1,6 @@ const util = require("util"); module.exports.desc = "eval code"; +module.exports.usage = ""; module.exports.exec = function (vanillaclient, client, server, args) { try { /*jshint ignore:start*/ diff --git a/commands/evalcb.js b/commands/evalcb.js index 6ce360f..cb5d99b 100644 --- a/commands/evalcb.js +++ b/commands/evalcb.js @@ -1,5 +1,6 @@ const util = require("util"); module.exports.desc = "eval + silent cmdblock."; +module.exports.usage = ""; module.exports.exec = function (vanillaclient, client, server, args) { try { /*jshint ignore:start*/ diff --git a/commands/help.js b/commands/help.js index 956edac..21d35ff 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,15 +1,18 @@ const fs = require("fs"); const commands = fs.readdirSync("./commands"); module.exports.desc = "get help for commands or something idk"; +module.exports.usage = "[command]"; module.exports.exec = function (vanillaclient, client, server, args) { if(args[0] && commands.includes(`${args[0]}.js`)) { let cmd = require(`./${args[0]}`); - vanillaclient.chat(`§7Help for: §6${args[0]}`) - vanillaclient.chat(`§6${args[0]}§7: §3${cmd.desc}`); + vanillaclient.chat(`§7Help for: §6${args[0]}`); + let usage = cmd.usage ? " "+cmd.usage : ""; + vanillaclient.chat(`§6${args[0]}${usage}§7: §3${cmd.desc}`); } else if(!args[0]) { commands.forEach(function(command) { let cmd = require(`./${command}`); - vanillaclient.chat(`§6${command.replace(".js","")}§7: §3${cmd.desc}`); + let usage = cmd.usage ? " "+cmd.usage : ""; + vanillaclient.chat(`§6${command.replace(".js","")}${usage}§7: §3${cmd.desc}`); }); } else { vanillaclient.chat("§4Command not found. :("); diff --git a/commands/hval.js b/commands/hval.js index a0ef104..fbd3d6f 100644 --- a/commands/hval.js +++ b/commands/hval.js @@ -1,9 +1,10 @@ const crypto = require("crypto"); const config = require("../config.js"); module.exports.desc = "automatically append hash for hbot commands"; +module.exports.usage = ""; module.exports.exec = function(vanillaclient, client, server, args) { const sha256 = crypto.createHash("sha256"); - const command = args.join(" "); + const command = `#${args.join(" ")}`; const time = Math.floor(+new Date() / 10000); let raw = command.replace(/&[0-9a-fklmnor]/g, ""); raw += ";"; diff --git a/commands/list.js b/commands/list.js index d93f1a0..05048c0 100644 --- a/commands/list.js +++ b/commands/list.js @@ -1,10 +1,13 @@ module.exports.desc = "lists all the players in the server"; +module.exports.usage = "[--send] [uuids]"; module.exports.exec = function (vanillaclient, client, server, args) { let players = ""; for(let player of Object.values(client.players)) { players += `${player.name}§r`; - if(args[0] === "uuids") players += ` (${player.UUID})`; + if(args.join(" ").includes("uuids")) players += ` (${player.UUID})`; players += ", "; } - vanillaclient.chat(`There are ${Object.keys(client.players).length} players online: ${players.substr(0, players.length-2)}.`); + let str = `There are ${Object.keys(client.players).length} players online: ${players.substr(0, players.length-2)}.`; + if(!args.join(" ").includes("--send")) return vanillaclient.chat(str); + client.utils.cmdBlock(client, `/bcraw ${str}`); }; \ No newline at end of file diff --git a/commands/owo.js b/commands/owo.js index 90cc846..a8c6a21 100644 --- a/commands/owo.js +++ b/commands/owo.js @@ -22,6 +22,7 @@ function owoifyText(v) { return output; } module.exports.desc = "makes your text be uwu owo nya~"; +module.exports.usage = "[--send] "; module.exports.exec = function(vanillaclient, client, server, args) { let owo = owoifyText(args.join(" ").replace("--send ","")); if(args[0] === "--send") return client.chat(owo); diff --git a/commands/rainbowify.js b/commands/rainbowify.js index 856eba7..e82e0de 100644 --- a/commands/rainbowify.js +++ b/commands/rainbowify.js @@ -1,4 +1,5 @@ module.exports.desc = "makes your text be rainbow (code from hhh, ported by me)"; +module.exports.usage = "[--send] "; module.exports.exec = function(vanillaclient, client, server, args) { let rainbow = client.utils.rainbowify(args.join(" ").replace("--send ","")); if(args[0] === "--send") return client.utils.cmdBlock(client, `/tellraw @a ${rainbow}`);