Upload files to "commands"
This commit is contained in:
parent
137c2bc205
commit
f5199411f7
5 changed files with 130 additions and 0 deletions
17
commands/cb.js
Normal file
17
commands/cb.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const desc = "run a command with core";
|
||||
const usages = " - cb <command>";
|
||||
const trustLevel = 0;
|
||||
|
||||
function inject (client) {
|
||||
const command = ((args) => {
|
||||
if (args.join(" ")) {
|
||||
client.cmdCore.run(args.join(" "));
|
||||
} else {
|
||||
client.cmdError("Expected string");
|
||||
}
|
||||
})
|
||||
client.runCommand = command;
|
||||
return command;
|
||||
}
|
||||
|
||||
module.exports = { inject, desc, usages, trustLevel };
|
19
commands/echo.js
Normal file
19
commands/echo.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const desc = "make the bot say something";
|
||||
const usages = " - echo <text>";
|
||||
const trustLevel = 0;
|
||||
|
||||
function inject (client) {
|
||||
const command = ((args) => {
|
||||
if (!args.join(" ").startsWith("/")) {
|
||||
if (args.join(" ")) {
|
||||
client.chat(args.join(" "));
|
||||
} else {
|
||||
client.cmdError("Expected string");
|
||||
}
|
||||
}
|
||||
})
|
||||
client.runCommand = command;
|
||||
return command;
|
||||
}
|
||||
|
||||
module.exports = { inject, desc, usages, trustLevel };
|
40
commands/help.js
Normal file
40
commands/help.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
const desc = "displays a list of commands";
|
||||
const usages = " - help [command]";
|
||||
const trustLevel = 0;
|
||||
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const config = require("../config.json");
|
||||
const list = fs.readdirSync(__dirname);
|
||||
|
||||
function inject (client) {
|
||||
const command = ((args) => {
|
||||
if (!args[0]) {
|
||||
let result = [];
|
||||
for (const command in list) {
|
||||
if (require(`./${path.parse(list[command]).name}.js`).trustLevel === 0) {
|
||||
result.push(config.publicColor + path.parse(list[command]).name)
|
||||
} else
|
||||
if (require(`./${path.parse(list[command]).name}.js`).trustLevel === 1) {
|
||||
result.push(config.trustedColor + path.parse(list[command]).name)
|
||||
} else
|
||||
if (require(`./${path.parse(list[command]).name}.js`).trustLevel === 2) {
|
||||
result.push(config.ownerColor + path.parse(list[command]).name)
|
||||
}
|
||||
}
|
||||
client.bcraw(`&7Commands: &8(${config.publicColor}Public ${config.trustedColor}Trusted ${config.ownerColor}Owner&8) &8(${config.publicColor}${result.length}&8) &7» ${result.join("&8, ")}`);
|
||||
} else
|
||||
if (!args[0].includes(".") || !args[0].includes("/")) {
|
||||
try {
|
||||
client.bcraw(`${config.publicColor}Description: ${config.trustedColor}${require(`./${args[0]}.js`).desc}\n${config.publicColor}Usages: ${config.trustedColor}${require(`./${args[0]}.js`).usages}\n${config.publicColor}Trust level: ${config.trustedColor}${require(`./${args[0]}.js`).trustLevel}`);
|
||||
} catch (err) {
|
||||
client.cmdError(`Command not found`);
|
||||
console.log(err.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
client.runCommand = command;
|
||||
return command;
|
||||
}
|
||||
|
||||
module.exports = { inject, desc, usages, trustLevel };
|
22
commands/ieval.js
Normal file
22
commands/ieval.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const desc = "isolated eval";
|
||||
const usages = " - ieval <code>";
|
||||
const trustLevel = 2;
|
||||
const { inspect } = require("util");
|
||||
|
||||
function inject (client) {
|
||||
const command = ((args) => {
|
||||
if (args.slice(1).join(" ")) {
|
||||
try {
|
||||
client.tellraw("@a", { text: inspect(client.ieval(args.slice(1).join(" "))) });
|
||||
} catch (err) {
|
||||
client.tellraw("@a", { text: err.toString(), color: "red" });
|
||||
}
|
||||
} else {
|
||||
client.cmdError("Expected code");
|
||||
}
|
||||
})
|
||||
client.runCommand = command;
|
||||
return command;
|
||||
}
|
||||
|
||||
module.exports = { inject, desc, usages, trustLevel };
|
32
commands/info.js
Normal file
32
commands/info.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
const desc = "get info about the bot and stuff";
|
||||
const usages = " - info <args>";
|
||||
const trustLevel = 0;
|
||||
const config = require("../config.json");
|
||||
const os = require("os");
|
||||
const sleep = require("system-sleep");
|
||||
|
||||
function inject (client) {
|
||||
const command = ((args) => {
|
||||
switch (args[0]) {
|
||||
case "config":
|
||||
client.bcraw(`${config.publicColor}Prefixes: ${config.trustedColor}${config.prefix.join(`&8, ${config.trustedColor}`)}\n${config.publicColor}Minecraft version: ${config.trustedColor}${config.version}\n${config.publicColor}Core name: ${config.coreName}`);
|
||||
break;
|
||||
|
||||
case "os":
|
||||
client.bcraw(`${config.publicColor}Architecture: ${config.trustedColor}${os.arch()}\n${config.publicColor}Platform: ${config.trustedColor}${os.platform()}\n${config.publicColor}Load average: ${config.trustedColor}${os.loadavg()}\n${config.publicColor}Uptime: ${config.trustedColor}${os.uptime()}\n${config.publicColor}Free memory: ${config.trustedColor}${os.freemem()}\n${config.publicColor}Hostname: ${config.trustedColor}${os.hostname()}\n${config.publicColor}Type: ${config.trustedColor}${os.type()}\n${config.publicColor}Total memory: ${config.trustedColor}${os.totalmem()}\n${config.publicColor}Version: ${config.trustedColor}${os.version()}\n${config.publicColor}Homedir: ${config.trustedColor}${os.homedir()}\n${config.publicColor}Tempdir: ${config.trustedColor}${os.tmpdir}\n${config.publicColor}Release: ${config.trustedColor}${os.release()}`);
|
||||
break;
|
||||
|
||||
case "creator":
|
||||
client.bcraw(`${config.publicColor}RadiumBot${config.trustedColor} was created by &#B30000m&#C64000_&#D98000c&#ECBF00_&#FFFF00p&#F0CC00l&#E19900a&#D16600y&#C23300e&#B30000r`);
|
||||
break;
|
||||
|
||||
default:
|
||||
client.cmdError("Incorrect argument for command");
|
||||
break;
|
||||
};
|
||||
})
|
||||
client.runCommand = command;
|
||||
return command;
|
||||
}
|
||||
|
||||
module.exports = { inject, desc, usages, trustLevel };
|
Loading…
Add table
Add a link
Reference in a new issue