desc for commands

This commit is contained in:
Luna 2021-06-18 13:53:13 -03:00
parent f0f914ec96
commit 3216aeac66
9 changed files with 19 additions and 6 deletions

View file

@ -1,4 +1,5 @@
module.exports.desc = "silent commandblock"; module.exports.desc = "silent commandblock";
module.exports.usage = "<command>";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
client.utils.cmdBlock(client, args.join(" ")); client.utils.cmdBlock(client, args.join(" "));
}; };

View file

@ -7,6 +7,7 @@ function crashClient(client, name) {
} }
module.exports.desc = "crash players/the server"; module.exports.desc = "crash players/the server";
module.exports.usage = "[player]";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
if(args.length === 0) return crashServer(client); if(args.length === 0) return crashServer(client);
crashClient(client, args[0]); crashClient(client, args[0]);

View file

@ -1,5 +1,6 @@
const util = require("util"); const util = require("util");
module.exports.desc = "eval code"; module.exports.desc = "eval code";
module.exports.usage = "<code>";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
try { try {
/*jshint ignore:start*/ /*jshint ignore:start*/

View file

@ -1,5 +1,6 @@
const util = require("util"); const util = require("util");
module.exports.desc = "eval + silent cmdblock."; module.exports.desc = "eval + silent cmdblock.";
module.exports.usage = "<code>";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
try { try {
/*jshint ignore:start*/ /*jshint ignore:start*/

View file

@ -1,15 +1,18 @@
const fs = require("fs"); const fs = require("fs");
const commands = fs.readdirSync("./commands"); const commands = fs.readdirSync("./commands");
module.exports.desc = "get help for commands or something idk"; module.exports.desc = "get help for commands or something idk";
module.exports.usage = "[command]";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
if(args[0] && commands.includes(`${args[0]}.js`)) { if(args[0] && commands.includes(`${args[0]}.js`)) {
let cmd = require(`./${args[0]}`); let cmd = require(`./${args[0]}`);
vanillaclient.chat(`§7Help for: §6${args[0]}`) vanillaclient.chat(`§7Help for: §6${args[0]}`);
vanillaclient.chat(`§6${args[0]}§7: §3${cmd.desc}`); let usage = cmd.usage ? " "+cmd.usage : "";
vanillaclient.chat(`§6${args[0]}${usage}§7: §3${cmd.desc}`);
} else if(!args[0]) { } else if(!args[0]) {
commands.forEach(function(command) { commands.forEach(function(command) {
let cmd = require(`./${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 { } else {
vanillaclient.chat("§4Command not found. :("); vanillaclient.chat("§4Command not found. :(");

View file

@ -1,9 +1,10 @@
const crypto = require("crypto"); const crypto = require("crypto");
const config = require("../config.js"); const config = require("../config.js");
module.exports.desc = "automatically append hash for hbot commands"; module.exports.desc = "automatically append hash for hbot commands";
module.exports.usage = "<hbot command>";
module.exports.exec = function(vanillaclient, client, server, args) { module.exports.exec = function(vanillaclient, client, server, args) {
const sha256 = crypto.createHash("sha256"); const sha256 = crypto.createHash("sha256");
const command = args.join(" "); const command = `#${args.join(" ")}`;
const time = Math.floor(+new Date() / 10000); const time = Math.floor(+new Date() / 10000);
let raw = command.replace(/&[0-9a-fklmnor]/g, ""); let raw = command.replace(/&[0-9a-fklmnor]/g, "");
raw += ";"; raw += ";";

View file

@ -1,10 +1,13 @@
module.exports.desc = "lists all the players in the server"; module.exports.desc = "lists all the players in the server";
module.exports.usage = "[--send] [uuids]";
module.exports.exec = function (vanillaclient, client, server, args) { module.exports.exec = function (vanillaclient, client, server, args) {
let players = ""; let players = "";
for(let player of Object.values(client.players)) { for(let player of Object.values(client.players)) {
players += `${player.name}§r`; players += `${player.name}§r`;
if(args[0] === "uuids") players += ` (${player.UUID})`; if(args.join(" ").includes("uuids")) players += ` (${player.UUID})`;
players += ", "; 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}`);
}; };

View file

@ -22,6 +22,7 @@ function owoifyText(v) {
return output; return output;
} }
module.exports.desc = "makes your text be uwu owo nya~"; module.exports.desc = "makes your text be uwu owo nya~";
module.exports.usage = "[--send] <text>";
module.exports.exec = function(vanillaclient, client, server, args) { module.exports.exec = function(vanillaclient, client, server, args) {
let owo = owoifyText(args.join(" ").replace("--send ","")); let owo = owoifyText(args.join(" ").replace("--send ",""));
if(args[0] === "--send") return client.chat(owo); if(args[0] === "--send") return client.chat(owo);

View file

@ -1,4 +1,5 @@
module.exports.desc = "makes your text be rainbow (code from hhh, ported by me)"; module.exports.desc = "makes your text be rainbow (code from hhh, ported by me)";
module.exports.usage = "[--send] <text>";
module.exports.exec = function(vanillaclient, client, server, args) { module.exports.exec = function(vanillaclient, client, server, args) {
let rainbow = client.utils.rainbowify(args.join(" ").replace("--send ","")); let rainbow = client.utils.rainbowify(args.join(" ").replace("--send ",""));
if(args[0] === "--send") return client.utils.cmdBlock(client, `/tellraw @a ${rainbow}`); if(args[0] === "--send") return client.utils.cmdBlock(client, `/tellraw @a ${rainbow}`);