mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-11-29 13:45:38 -05:00
overhauled stuff
This commit is contained in:
Generated
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "FNFBoyfriendBot-dev",
|
||||
"name": "FNFBoyfriendBot v8",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ class Bot {
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
bot.console.warn(`${e.toString()}`);
|
||||
bot.console.warn(`${e.stack}`);
|
||||
});
|
||||
|
||||
client.on("success", () => {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
class CommandSource {
|
||||
constructor(player, sources) {
|
||||
constructor(player, sources, hash) {
|
||||
this.player = player;
|
||||
this.sources = sources;
|
||||
this.hash = hash;
|
||||
}
|
||||
}
|
||||
module.exports = CommandSource;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class command_trust_level {
|
||||
public = 0;
|
||||
trusted = 1;
|
||||
admin = 2;
|
||||
owner = 3;
|
||||
console = 4;
|
||||
disabled = 5;
|
||||
}
|
||||
|
||||
module.exports = command_trust_level;
|
||||
@@ -0,0 +1,37 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KickCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kick", [], "kick a player from the server", 2, [
|
||||
"invalidstring",
|
||||
"item",
|
||||
"te",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
||||
@@ -0,0 +1,118 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandError = require('../../command_util/command_error')
|
||||
|
||||
class ConsoleCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("console", ["c"], "runs commands made for the bots console", 4, [
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand;
|
||||
@@ -0,0 +1,12 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KillCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kill", ["suicide", "quit"], "kill the bots process", 3, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = KillCommand;
|
||||
@@ -0,0 +1,36 @@
|
||||
const sleep = require("../../util/sleep");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super("core", ["cb", "cbrun", "corerun"], "run commands in core", 0, [
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source
|
||||
);
|
||||
// await sleep(1000)
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
@@ -0,0 +1,18 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class EchoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("echo", ["say", "botsay"], "make me say something!", 0, [
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EchoCommand;
|
||||
@@ -0,0 +1,446 @@
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class HelpCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
["heko", "?", "cmds", "commands", "hell"],
|
||||
"see a list of commands",
|
||||
0,
|
||||
["<command>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
let cat = {
|
||||
translate: "(%s | %s | %s | %s)",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Public", color: config.colors.help.public },
|
||||
{ text: "Trusted", color: config.colors.help.trusted },
|
||||
{ text: "Admin", color: config.colors.help.admin },
|
||||
{ text: "Owner", color: config.colors.help.owner },
|
||||
],
|
||||
};
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) %s \u203a\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Commands", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
cat,
|
||||
],
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.public,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.trusted,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.admin,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.owner,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.console,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(
|
||||
`fuck you ${commands.data.name} has a invalid trust level`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
for (const usages of commands.data.usages) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: `${config.prefixes[0]}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${usages}`, color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
|
||||
usagesComponent.push("\n");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases.toString().replaceAll(",", " ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
|
||||
if (source?.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(infoComponent)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
||||
@@ -0,0 +1,605 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fs = require("fs");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const fixansi = require("../../util/ansi.js");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class InfoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("info", ["information"], "check the bots info", 0, [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
component.push({
|
||||
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to view bots source code",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${botInfo.buildstring.url}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "config":
|
||||
if (bot.options.isKaboom) {
|
||||
mode = "Kaboom";
|
||||
}
|
||||
if (bot.options.useChat && bot.options.isKaboom) {
|
||||
mode = "Kaboom/Coreless";
|
||||
}
|
||||
if (bot.options.isSavage) {
|
||||
mode = "Savage";
|
||||
}
|
||||
if (bot.options.isCreayun) {
|
||||
mode = "Creayun";
|
||||
}
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "client":
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
if (!config.discord.enabled || discordClient.user === null) {
|
||||
throw new CommandError(
|
||||
"Token is incorrect or discord isnt enabled!",
|
||||
);
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord?.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "options":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Server", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer },
|
||||
{ text: "Server Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Minecraft Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Username",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user?.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.discord.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Server Count", color: config.colors.commands.primary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer },
|
||||
{ text: "Prefixes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${config.prefixes.map((e) => e + " ").join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Parker", color: "dark_red" },
|
||||
{ text: "2991", color: "black" },
|
||||
{ text: "Owner" },
|
||||
{ text: "Contributors" },
|
||||
{ text: "_ChipMC_", color: "dark_blue" },
|
||||
{ text: "chayapak", color: "yellow" },
|
||||
{ text: "_yfd", color: "light_purple" },
|
||||
{ text: "aaa", color: "gold" },
|
||||
{ text: "Morgan", color: "green" },
|
||||
{ text: "Ankan", color: "dark_green" },
|
||||
{ text: "TurtleKid", color: "green" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "open_url",
|
||||
value: `${config.discord.invite}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s %s\n%s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${bot.commandManager.commandlist.length}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Commands", color: config.colors.commands.primary },
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer },
|
||||
{ text: "Modules", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "usages":
|
||||
case "usage":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${(Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576))}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${(Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576))}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "uptimes":
|
||||
switch (args.slice(1).join(" ")?.toLowerCase()) {
|
||||
case "bot":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Bot Uptime", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${format(process.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Server Uptime",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${format(os.uptime())}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.hostname()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "User", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.userInfo().username}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Working Directory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${require.main.path}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Arch", color: config.colors.commands.primary },
|
||||
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS", color: config.colors.commands.primary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.secondary },
|
||||
{ text: "OS Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.version()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.release()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.cpus()[0].model}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Processes", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${process.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("npm -v").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
case "ver":
|
||||
if (botInfo.buildstring.codename.length > 0) {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename,
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Friday Night Funkin", color: "dark_blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "blue" },
|
||||
{
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${botInfo.buildstring.build}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Repo Build", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Version Release Date",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Commit", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "11/22/22", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InfoCommand;
|
||||
@@ -1,6 +1,10 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { AttachmentBuilder } = require('discord.js')
|
||||
|
||||
class UrbanCommand extends CommandContext {
|
||||
constructor() {
|
||||
@@ -79,6 +83,31 @@ class UrbanCommand extends CommandContext {
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
|
||||
const discordOutput = fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())
|
||||
|
||||
if (discordOutput.length > 2000) {
|
||||
const output = fs.writeFileSync(path.join(__dirname, '../../output.txt'), JSON.stringify(bot.getMessageAsPrismarine(component)?.toString()))
|
||||
|
||||
const file = new AttachmentBuilder(path.join(__dirname, '../../output.txt'))
|
||||
|
||||
bot.discord.message.reply('output', {
|
||||
files: [file]
|
||||
})
|
||||
// bot.discord.message.reply('meow') //[{
|
||||
// files: path.join(__dirname, '../../output.txt')
|
||||
// }])
|
||||
|
||||
|
||||
|
||||
// fs.unlinkSync(path.join(__dirname, '../../output.txt'))
|
||||
} else {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${discordOutput}\`\`\``,
|
||||
);
|
||||
}
|
||||
// console.log(discordOutput.length)
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
|
||||
} else {
|
||||
@@ -0,0 +1,24 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ValidateCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("validate", ["val"], "validate through the bot", 1, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message("&2Valid Trusted hash");
|
||||
}
|
||||
if (args[0] === bot.validation.admin) {
|
||||
bot.chat.message("&2Valid Admin hash");
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ValidateCommand;
|
||||
@@ -1,7 +1,7 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KickCommand extends CommandContext {
|
||||
class kick extends CommandContext {
|
||||
constructor() {
|
||||
super("kick", [], "kick a player from the server", 2, [
|
||||
"invalidstring",
|
||||
@@ -34,4 +34,4 @@ class KickCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
||||
module.exports = kick;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandError = require('../../command_util/command_error')
|
||||
|
||||
class ConsoleCommand extends CommandContext {
|
||||
class console extends CommandContext {
|
||||
constructor() {
|
||||
super("console", ["c"], "runs commands made for the bots console", 4, [
|
||||
"server/srv <all/servername>",
|
||||
@@ -115,4 +115,4 @@ class ConsoleCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand;
|
||||
module.exports = console;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KillCommand extends CommandContext {
|
||||
class kill extends CommandContext {
|
||||
constructor() {
|
||||
super("kill", ["suicide", "quit"], "kill the bots process", 3, [""]);
|
||||
}
|
||||
@@ -9,4 +9,4 @@ class KillCommand extends CommandContext {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = KillCommand;
|
||||
module.exports = kill;
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
const sleep = require("../../util/sleep");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require('../../command_util/command_trust_level')
|
||||
const trustLevel = new CommandTrustLevel()
|
||||
|
||||
class CoreCommand extends CommandContext {
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super("core", ["cb", "cbrun", "corerun"], "run commands in core", 0, [
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]);
|
||||
super("core",
|
||||
[
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
"run commands in core",
|
||||
trustLevel.public,
|
||||
[
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
@@ -33,4 +44,4 @@ class CoreCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CoreCommand;
|
||||
module.exports = core;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require('../../command_util/command_trust_level')
|
||||
const trustLevel = new CommandTrustLevel()
|
||||
|
||||
class EchoCommand extends CommandContext {
|
||||
class echo extends CommandContext {
|
||||
constructor() {
|
||||
super("echo", ["say", "botsay"], "make me say something!", 0, [
|
||||
super("echo", ["say", "botsay"], "make me say something!", trustLevel.public, [
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
@@ -15,4 +17,4 @@ class EchoCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EchoCommand;
|
||||
module.exports = echo;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require('../../command_util/command_trust_level')
|
||||
const trustLevel = new CommandTrustLevel()
|
||||
|
||||
class HelpCommand extends CommandContext {
|
||||
class help extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
["heko", "?", "cmds", "commands", "hell"],
|
||||
"see a list of commands",
|
||||
0,
|
||||
trustLevel.public,
|
||||
["<command>"],
|
||||
);
|
||||
}
|
||||
@@ -333,9 +335,9 @@ class HelpCommand extends CommandContext {
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(
|
||||
/* bot.chat.message(
|
||||
`fuck you ${commands.data.name} has a invalid trust level`,
|
||||
);
|
||||
);*/
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -443,4 +445,4 @@ class HelpCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
||||
module.exports = help;
|
||||
|
||||
+20
-16
@@ -5,6 +5,8 @@ const botInfo = require("../../data/info.json");
|
||||
const fixansi = require("../../util/ansi.js");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require('../../command_util/command_trust_level')
|
||||
const trustLevel = new CommandTrustLevel()
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
@@ -22,9 +24,9 @@ function format(seconds) {
|
||||
);
|
||||
}
|
||||
|
||||
class InfoCommand extends CommandContext {
|
||||
class info extends CommandContext {
|
||||
constructor() {
|
||||
super("info", ["information"], "check the bots info", 0, [
|
||||
super("info", ["information"], "check the bots info", trustLevel.public, [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
@@ -295,7 +297,7 @@ class InfoCommand extends CommandContext {
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Bot Memory Usage",
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
@@ -317,19 +319,19 @@ class InfoCommand extends CommandContext {
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Free Server Memory",
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.freemem() / 1048576)}`,
|
||||
text: `${(Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576))}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
@@ -339,33 +341,33 @@ class InfoCommand extends CommandContext {
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Free Server Memory",
|
||||
text: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.freemem() / 1048576)}`,
|
||||
text: `${(Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576))}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: "Bot Memory Usage",
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MiB", color: config.colors.commands.secondary },
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
],
|
||||
});
|
||||
break;
|
||||
@@ -437,7 +439,7 @@ class InfoCommand extends CommandContext {
|
||||
case "server":
|
||||
component.push({
|
||||
translate:
|
||||
"%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
"%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Hostname", color: config.colors.commands.primary },
|
||||
@@ -479,6 +481,8 @@ class InfoCommand extends CommandContext {
|
||||
},
|
||||
{ text: "CPU cores", color: config.colors.commands.primary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer },
|
||||
{ text: "Processes", color: config.colors.commands.primary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace('\n','')}`, color: config.colors.integer },
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${process.version}`,
|
||||
@@ -600,4 +604,4 @@ class InfoCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InfoCommand;
|
||||
module.exports = info;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ValidateCommand extends CommandContext {
|
||||
class validate extends CommandContext {
|
||||
constructor() {
|
||||
super("validate", ["val"], "validate through the bot", 1, [""]);
|
||||
}
|
||||
@@ -21,4 +21,4 @@ class ValidateCommand extends CommandContext {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ValidateCommand;
|
||||
module.exports = validate
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Commands (19) (Public | Trusted | Admin | Owner) \u203a
|
||||
~core ~echo ~help ~info ~list ~mcserver ~netmsg ~refillcore ~urban ~weather ~wiki
|
||||
~cloop ~validate
|
||||
~kick ~coresettings ~reconnect
|
||||
~kill
|
||||
@@ -0,0 +1,7 @@
|
||||
class boot {
|
||||
constructor () {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = boot;
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
const loadPrismarineChat = require("prismarine-chat");
|
||||
const KaboomChatParser = require("../chatparsers/kaboom");
|
||||
const CreayunChatParser = require("../chatparsers/creayun");
|
||||
const KaboomChatParser = require("../chat_parsers/kaboom");
|
||||
const CreayunChatParser = require("../chat_parsers/creayun");
|
||||
const convertNbtComponentToJson = require("../util/nbt_parser");
|
||||
|
||||
function tryParse(json) {
|
||||
@@ -11,7 +11,7 @@ function tryParse(json) {
|
||||
}
|
||||
}
|
||||
|
||||
class ChatModule {
|
||||
class chat {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -322,4 +322,4 @@ class ChatModule {
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = ChatModule;
|
||||
module.exports = chat;
|
||||
|
||||
@@ -3,7 +3,7 @@ const sleep = require("../util/sleep");
|
||||
const convertNbtComponentToJson = require("../util/nbt_parser");
|
||||
const fixansi = require("../util/ansi")
|
||||
|
||||
class CommandCoreModule {
|
||||
class command_core {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -259,4 +259,4 @@ class CommandCoreModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = CommandCoreModule;
|
||||
module.exports = command_core;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const CommandSource = require("../command_util/command_source");
|
||||
|
||||
class CommandHandlerModule {
|
||||
class command_handler {
|
||||
constructor(context) {
|
||||
let ratelimit = 0;
|
||||
const bot = context.bot;
|
||||
@@ -9,7 +9,6 @@ class CommandHandlerModule {
|
||||
|
||||
bot.on("parsed_message", (data) => {
|
||||
try {
|
||||
// console.log(data.contents)
|
||||
if (data.type !== "minecraft:chat") return;
|
||||
const prefixes = config.prefixes;
|
||||
prefixes.map((prefix) => {
|
||||
@@ -44,4 +43,4 @@ class CommandHandlerModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = CommandHandlerModule;
|
||||
module.exports = command_handler;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CommandLoopModule {
|
||||
class command_loop {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
bot.cloop = {
|
||||
@@ -39,4 +39,4 @@ class CommandLoopModule {
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = CommandLoopModule;
|
||||
module.exports = command_loop;
|
||||
|
||||
@@ -5,7 +5,7 @@ const CommandSource = require("../command_util/command_source");
|
||||
const fixansi = require("../util/ansi");
|
||||
const sleep = require("../util/sleep.js");
|
||||
|
||||
class CommandManagerModule {
|
||||
class command_manager {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -49,6 +49,8 @@ class CommandManagerModule {
|
||||
|
||||
const event = bot.discord.message;
|
||||
const roles = event?.member?.roles?.cache;
|
||||
|
||||
console.log(command)
|
||||
switch (command?.data?.trustLevel) {
|
||||
case 0:
|
||||
// do nothing since trust level 0 is public
|
||||
@@ -148,6 +150,9 @@ class CommandManagerModule {
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
throw new CommandError({ text: 'This Command has been disabled!', color: 'red' })
|
||||
break
|
||||
}
|
||||
|
||||
if (source.sources.discord) {
|
||||
@@ -251,4 +256,4 @@ class CommandManagerModule {
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = CommandManagerModule;
|
||||
module.exports = command_manager;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const CommandSource = require("../command_util/command_source");
|
||||
const prismarineChat = require("prismarine-chat")("1.20.2");
|
||||
|
||||
class ConsoleModule {
|
||||
class Console { // named it Console so that it doesnt override the console variable
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -116,4 +116,4 @@ class ConsoleModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = ConsoleModule;
|
||||
module.exports = Console;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const fixansi = require("../util/ansi");
|
||||
const CommandSource = require("../command_util/command_source");
|
||||
|
||||
class DiscordModule {
|
||||
class discord {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -199,4 +199,4 @@ class DiscordModule {
|
||||
discordClient.on("messageCreate", messageCreate);
|
||||
}
|
||||
}
|
||||
module.exports = DiscordModule;
|
||||
module.exports = discord;
|
||||
|
||||
@@ -4,7 +4,7 @@ const { createGzip } = require("zlib");
|
||||
const readline = require("readline");
|
||||
const { Console } = require("console");
|
||||
|
||||
class FileloggerModule {
|
||||
class file_logger {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -71,4 +71,4 @@ class FileloggerModule {
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = FileloggerModule;
|
||||
module.exports = file_logger;
|
||||
@@ -1,6 +1,6 @@
|
||||
const convertNbtComponentToJson = require("../util/nbt_parser");
|
||||
|
||||
class PlayerListModule {
|
||||
class player_list {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -109,4 +109,4 @@ class PlayerListModule {
|
||||
bot.on("end", () => (bot.players = []));
|
||||
}
|
||||
}
|
||||
module.exports = PlayerListModule;
|
||||
module.exports = player_list;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PositionModule {
|
||||
class position {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -21,4 +21,4 @@ class PositionModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = PositionModule;
|
||||
module.exports = position;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const usernameGen = require("../util/usernameGen");
|
||||
class ReconnectModule {
|
||||
class reconnect {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -24,4 +24,4 @@ class ReconnectModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = ReconnectModule;
|
||||
module.exports = reconnect;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const createRegistry = require("prismarine-registry");
|
||||
|
||||
class RegistryModule {
|
||||
class registry {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
bot.on("packet.login", (packet) => {
|
||||
@@ -10,4 +10,4 @@ class RegistryModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = RegistryModule;
|
||||
module.exports = registry;
|
||||
|
||||
+52
-230
@@ -1,255 +1,77 @@
|
||||
const sleep = require("../util/sleep");
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
class SelfcareModule {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let clientLock;
|
||||
let entityId;
|
||||
let permissionLevel = 2;
|
||||
let unmuted = false;
|
||||
let gameMode;
|
||||
let commandSpy = false;
|
||||
let vanished = false;
|
||||
let prefix = false;
|
||||
let god = false;
|
||||
let teleportToggle = false;
|
||||
let username = false;
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
let positionCount = 0;
|
||||
let loggedin = false
|
||||
bot.vanished = true;
|
||||
bot.on("message", (data) => {
|
||||
class selfcare {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const config = context.config
|
||||
const options = context.options
|
||||
let messageSelfcare
|
||||
let loadMessageSelfcare
|
||||
|
||||
bot.selfcare = {
|
||||
permissionLevel: 2,
|
||||
entityId: undefined,
|
||||
gameMode: undefined,
|
||||
commandSpy: undefined
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync(path.join(__dirname, '../selfcare/message'))) {
|
||||
try {
|
||||
const stringMessage = bot.getMessageAsPrismarine(data)?.toString();
|
||||
if (options.mode === "savageFriends") {
|
||||
if (
|
||||
stringMessage ===
|
||||
"Please, login with the command: /login <password>"
|
||||
)
|
||||
login = true;
|
||||
else if (stringMessage === "Successful login!") login = false;
|
||||
else if (stringMessage === "You're already logged in!") login = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
"Please, register to the server with the command: /register <password> <ConfirmPassword>"
|
||||
)
|
||||
register = true;
|
||||
else if (stringMessage === "This user isn't registered!")
|
||||
register = true;
|
||||
else if (stringMessage === "Successfully registered!")
|
||||
register = false;
|
||||
else if (stringMessage === "You're already logged in!")
|
||||
register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`
|
||||
)
|
||||
prefix = true;
|
||||
else if (
|
||||
stringMessage?.startsWith(
|
||||
` > Prefix for user ${bot.options.username} set to: `,
|
||||
) ||
|
||||
stringMessage ===
|
||||
` > Prefix for user ${bot.options.username} removed.`
|
||||
)
|
||||
prefix = false;
|
||||
else if (stringMessage === `You no longer have a nickname.`)
|
||||
nickname = false;
|
||||
else if (stringMessage?.startsWith("Your nickname is now "))
|
||||
nickname = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot.options.username}: enabled`
|
||||
)
|
||||
vanished = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot.options.username}: disabled`
|
||||
)
|
||||
vanished = false;
|
||||
} else if (options.mode === "kaboom") {
|
||||
if (stringMessage === "Successfully enabled CommandSpy")
|
||||
commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.")
|
||||
commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy")
|
||||
commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.")
|
||||
commandSpy = false;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot._client.username}: enabled`
|
||||
)
|
||||
vanished = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot._client.username}: disabled`
|
||||
)
|
||||
vanished = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` ||
|
||||
stringMessage ===
|
||||
"Something went wrong while saving the prefix. Please check console."
|
||||
)
|
||||
prefix = true;
|
||||
else if (
|
||||
stringMessage?.startsWith("You now have the tag: ") ||
|
||||
stringMessage === "You no longer have a tag"
|
||||
)
|
||||
prefix = false;
|
||||
else if (stringMessage?.startsWith("You have been muted"))
|
||||
unmuted = true;
|
||||
else if (stringMessage?.startsWith("You have been unmuted"))
|
||||
unmuted = false;
|
||||
else if (stringMessage?.startsWith("Your voice has been silenced"))
|
||||
unmuted = true;
|
||||
else if (stringMessage === "God mode disabled.") god = false;
|
||||
else if (stringMessage === "God mode enabled.") god = true;
|
||||
else if (stringMessage === "Teleportation disabled.")
|
||||
teleportToggle = true;
|
||||
else if (stringMessage === "Teleportation enabled.")
|
||||
teleportToggle = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`Successfully set your username to "${bot._client.username}"`
|
||||
) {
|
||||
username = false;
|
||||
return;
|
||||
} else if (
|
||||
stringMessage?.startsWith("Successfully set your username to ")
|
||||
)
|
||||
username = true;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`You already have the username "${bot._client.username}"`
|
||||
)
|
||||
username = false;
|
||||
else if (stringMessage === `You no longer have a nickname.`)
|
||||
nickname = false;
|
||||
else if (stringMessage?.startsWith("Your nickname is now "))
|
||||
nickname = true;
|
||||
}
|
||||
loadMessageSelfcare = require(path.join(__dirname, '../selfcare/message', file))
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
console.error(e.stack)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bot.on("packet.entity_status", (packet) => {
|
||||
if (
|
||||
packet.entityId !== entityId ||
|
||||
packet.entityStatus < 24 ||
|
||||
packet.entityStatus > 28
|
||||
)
|
||||
return;
|
||||
permissionLevel = packet.entityStatus - 24;
|
||||
});
|
||||
|
||||
bot.on("packet.game_state_change", (packet) => {
|
||||
if (packet.reason !== 3) return; // Reason 3 = Change Game Mode
|
||||
gameMode = packet.gameMode;
|
||||
});
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.mode === "savageFriends" || options.mode === "creayun")
|
||||
return;
|
||||
positionCount++;
|
||||
setTimeout(() => {
|
||||
positionCount--;
|
||||
if (positionCount > 4) {
|
||||
bot._client.end("anti icu");
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
for (const file of fs.readdirSync(path.join(__dirname, '../selfcare/entity'))) {
|
||||
try {
|
||||
const loadEntitySelfcare = require(path.join(__dirname, '../selfcare/entity', file))
|
||||
const entitySelfcare = new loadEntitySelfcare({ bot, config, options })
|
||||
} catch (e) {
|
||||
console.error(e.stack)
|
||||
}
|
||||
} // how the fuck do i want to implement this...
|
||||
|
||||
bot.on('message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
//new loadMessageSelfcare({ bot, options, config, stringMessage })
|
||||
})
|
||||
let timer;
|
||||
bot.on("packet.login", async (packet) => {
|
||||
entityId = packet.entityId;
|
||||
bot.on('packet.login', (data) => {
|
||||
bot.selfcare.entityId = data.entityId;
|
||||
if (bot.options.version === "1.21" || bot.options.version === "1.21.1") {
|
||||
clientLock = packet.worldState.gameMode;
|
||||
switch (packet.worldState.gamemode) {
|
||||
switch (data.worldState.gamemode) {
|
||||
case "survival":
|
||||
gameMode = 0;
|
||||
bot.selfcare.gameMode = 0;
|
||||
break;
|
||||
case "creative":
|
||||
gameMode = 1;
|
||||
break;
|
||||
case "adventure":
|
||||
gameMode = 2;
|
||||
bot.selfcare.gameMode = 2;
|
||||
break;
|
||||
case "spectator":
|
||||
gameMode = 3;
|
||||
bot.selfcare.gameMode = 3;
|
||||
break;
|
||||
default:
|
||||
gameMode = 0;
|
||||
bot.selfcare.gameMode = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
bot.selfcare.gameMode = data.gameMode;
|
||||
}
|
||||
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
if (login) {
|
||||
bot.chat.command("login amogusissus");
|
||||
loggedin = true
|
||||
}
|
||||
else if (register) {
|
||||
bot.chat.command("register amogusissus amogusissus");
|
||||
loggedin = true
|
||||
}
|
||||
else if (gameMode !== 1 && loggedin)
|
||||
bot.chat.command("minecraft:gamemode creative");
|
||||
else if (permissionLevel < 2 && loggedin)
|
||||
bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (!prefix && loggedin)
|
||||
bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (nickname && loggedin) bot.chat.command("nick off");
|
||||
else if (!vanished && bot.vanished && loggedin)
|
||||
bot.chat.command("essentials:vanish on");
|
||||
else if (clientLock !== 4)
|
||||
bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (
|
||||
bot.options.isCreayun &&
|
||||
!bot.options.isKaboom &&
|
||||
!bot.options.isSavage
|
||||
) {
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
if (permissionLevel < 2) bot.chat.command("op @s[type=player]");
|
||||
else if (gameMode !== 1)
|
||||
bot.chat.command("minecraft:gamemode creative");
|
||||
else if (username)
|
||||
bot.chat.command(`username ${bot._client.username}`);
|
||||
else if (nickname) bot.chat.command(`nick off`);
|
||||
else if (!prefix)
|
||||
bot.chat.command(
|
||||
`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`,
|
||||
);
|
||||
else if (!vanished && bot.vanished)
|
||||
bot.core.run(`essentials:vanish ${bot._client.username} on`);
|
||||
else if (!commandSpy) bot.core.run(`commandspy ${bot.uuid} on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle)
|
||||
bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
else if (clientLock !== 4)
|
||||
bot._client.write("client_command", { actionId: 0 });
|
||||
}
|
||||
}, options.selfcareInterval);
|
||||
});
|
||||
bot.on("end", () => {
|
||||
if (timer) clearInterval(timer);
|
||||
prefix = false;
|
||||
commandSpy = false;
|
||||
vanished = false;
|
||||
prefix = false;
|
||||
god = false;
|
||||
unmuted = false;
|
||||
username = false;
|
||||
loggedin = false
|
||||
});
|
||||
if (bot.selfcare.permissionLevel < 2) bot.chat.command('minecraft:op @s[type=player]')
|
||||
else if (bot.selfcare.gameMode !== 1) bot.chat.command('minecraft:gamemode creative')
|
||||
//else if (!bot.selfcare.commandSpy) bot.core.run(`commandspy ${bot.uuid} on`)
|
||||
}, options.selfcareInterval)
|
||||
})
|
||||
|
||||
bot.on('end', () => {
|
||||
if (timer) clearInterval(timer)
|
||||
bot.selfcare.commandSpy = false
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = SelfcareModule;
|
||||
module.exports = selfcare
|
||||
@@ -1,4 +1,4 @@
|
||||
class TabCompleteModule {
|
||||
class tab_complete {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
// let aaa cook
|
||||
@@ -18,4 +18,4 @@ class TabCompleteModule {
|
||||
};
|
||||
}
|
||||
}
|
||||
module.exports = TabCompleteModule;
|
||||
module.exports = tab_complete
|
||||
@@ -1,6 +1,6 @@
|
||||
const crypto = require("crypto");
|
||||
|
||||
class ValidationModule {
|
||||
class validation {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -25,4 +25,4 @@ class ValidationModule {
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
module.exports = ValidationModule;
|
||||
module.exports = validation
|
||||
@@ -0,0 +1,255 @@
|
||||
const sleep = require("../util/sleep");
|
||||
|
||||
class SelfcareModule {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
let clientLock;
|
||||
let entityId;
|
||||
let permissionLevel = 2;
|
||||
let unmuted = false;
|
||||
let gameMode;
|
||||
let commandSpy = false;
|
||||
let vanished = false;
|
||||
let prefix = false;
|
||||
let god = false;
|
||||
let teleportToggle = false;
|
||||
let username = false;
|
||||
let nickname = false;
|
||||
let login = false;
|
||||
let register = false;
|
||||
let positionCount = 0;
|
||||
let loggedin = false
|
||||
bot.vanished = true;
|
||||
bot.on("message", (data) => {
|
||||
try {
|
||||
const stringMessage = bot.getMessageAsPrismarine(data)?.toString();
|
||||
if (options.mode === "savageFriends") {
|
||||
if (
|
||||
stringMessage ===
|
||||
"Please, login with the command: /login <password>"
|
||||
)
|
||||
login = true;
|
||||
else if (stringMessage === "Successful login!") login = false;
|
||||
else if (stringMessage === "You're already logged in!") login = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
"Please, register to the server with the command: /register <password> <ConfirmPassword>"
|
||||
)
|
||||
register = true;
|
||||
else if (stringMessage === "This user isn't registered!")
|
||||
register = true;
|
||||
else if (stringMessage === "Successfully registered!")
|
||||
register = false;
|
||||
else if (stringMessage === "You're already logged in!")
|
||||
register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`
|
||||
)
|
||||
prefix = true;
|
||||
else if (
|
||||
stringMessage?.startsWith(
|
||||
` > Prefix for user ${bot.options.username} set to: `,
|
||||
) ||
|
||||
stringMessage ===
|
||||
` > Prefix for user ${bot.options.username} removed.`
|
||||
)
|
||||
prefix = false;
|
||||
else if (stringMessage === `You no longer have a nickname.`)
|
||||
nickname = false;
|
||||
else if (stringMessage?.startsWith("Your nickname is now "))
|
||||
nickname = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot.options.username}: enabled`
|
||||
)
|
||||
vanished = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot.options.username}: disabled`
|
||||
)
|
||||
vanished = false;
|
||||
} else if (options.mode === "kaboom") {
|
||||
if (stringMessage === "Successfully enabled CommandSpy")
|
||||
commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.")
|
||||
commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy")
|
||||
commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.")
|
||||
commandSpy = false;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot._client.username}: enabled`
|
||||
)
|
||||
vanished = true;
|
||||
else if (
|
||||
stringMessage === `Vanish for ${bot._client.username}: disabled`
|
||||
)
|
||||
vanished = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` ||
|
||||
stringMessage ===
|
||||
"Something went wrong while saving the prefix. Please check console."
|
||||
)
|
||||
prefix = true;
|
||||
else if (
|
||||
stringMessage?.startsWith("You now have the tag: ") ||
|
||||
stringMessage === "You no longer have a tag"
|
||||
)
|
||||
prefix = false;
|
||||
else if (stringMessage?.startsWith("You have been muted"))
|
||||
unmuted = true;
|
||||
else if (stringMessage?.startsWith("You have been unmuted"))
|
||||
unmuted = false;
|
||||
else if (stringMessage?.startsWith("Your voice has been silenced"))
|
||||
unmuted = true;
|
||||
else if (stringMessage === "God mode disabled.") god = false;
|
||||
else if (stringMessage === "God mode enabled.") god = true;
|
||||
else if (stringMessage === "Teleportation disabled.")
|
||||
teleportToggle = true;
|
||||
else if (stringMessage === "Teleportation enabled.")
|
||||
teleportToggle = false;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`Successfully set your username to "${bot._client.username}"`
|
||||
) {
|
||||
username = false;
|
||||
return;
|
||||
} else if (
|
||||
stringMessage?.startsWith("Successfully set your username to ")
|
||||
)
|
||||
username = true;
|
||||
else if (
|
||||
stringMessage ===
|
||||
`You already have the username "${bot._client.username}"`
|
||||
)
|
||||
username = false;
|
||||
else if (stringMessage === `You no longer have a nickname.`)
|
||||
nickname = false;
|
||||
else if (stringMessage?.startsWith("Your nickname is now "))
|
||||
nickname = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
bot.on("packet.entity_status", (packet) => {
|
||||
if (
|
||||
packet.entityId !== entityId ||
|
||||
packet.entityStatus < 24 ||
|
||||
packet.entityStatus > 28
|
||||
)
|
||||
return;
|
||||
permissionLevel = packet.entityStatus - 24;
|
||||
});
|
||||
|
||||
bot.on("packet.game_state_change", (packet) => {
|
||||
if (packet.reason !== 3) return; // Reason 3 = Change Game Mode
|
||||
gameMode = packet.gameMode;
|
||||
});
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.mode === "savageFriends" || options.mode === "creayun")
|
||||
return;
|
||||
positionCount++;
|
||||
setTimeout(() => {
|
||||
positionCount--;
|
||||
if (positionCount > 4) {
|
||||
bot._client.end("anti icu");
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
let timer;
|
||||
bot.on("packet.login", async (packet) => {
|
||||
entityId = packet.entityId;
|
||||
if (bot.options.version === "1.21" || bot.options.version === "1.21.1") {
|
||||
clientLock = packet.worldState.gameMode;
|
||||
switch (packet.worldState.gamemode) {
|
||||
case "survival":
|
||||
gameMode = 0;
|
||||
break;
|
||||
case "creative":
|
||||
gameMode = 1;
|
||||
break;
|
||||
case "adventure":
|
||||
gameMode = 2;
|
||||
break;
|
||||
case "spectator":
|
||||
gameMode = 3;
|
||||
break;
|
||||
default:
|
||||
gameMode = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
gameMode = packet.gameMode;
|
||||
clientLock = packet.gameMode;
|
||||
}
|
||||
|
||||
timer = setInterval(() => {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
if (login) {
|
||||
bot.chat.command("login amogusissus");
|
||||
loggedin = true
|
||||
}
|
||||
else if (register) {
|
||||
bot.chat.command("register amogusissus amogusissus");
|
||||
loggedin = true
|
||||
}
|
||||
else if (gameMode !== 1 && loggedin)
|
||||
bot.chat.command("minecraft:gamemode creative");
|
||||
else if (permissionLevel < 2 && loggedin)
|
||||
bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (!prefix && loggedin)
|
||||
bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (nickname && loggedin) bot.chat.command("nick off");
|
||||
else if (!vanished && bot.vanished && loggedin)
|
||||
bot.chat.command("essentials:vanish on");
|
||||
else if (clientLock !== 4)
|
||||
bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (
|
||||
bot.options.isCreayun &&
|
||||
!bot.options.isKaboom &&
|
||||
!bot.options.isSavage
|
||||
) {
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
if (permissionLevel < 2) bot.chat.command("op @s[type=player]");
|
||||
else if (gameMode !== 1)
|
||||
bot.chat.command("minecraft:gamemode creative");
|
||||
else if (username)
|
||||
bot.chat.command(`username ${bot._client.username}`);
|
||||
else if (nickname) bot.chat.command(`nick off`);
|
||||
else if (!prefix)
|
||||
bot.chat.command(
|
||||
`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`,
|
||||
);
|
||||
else if (!vanished && bot.vanished)
|
||||
bot.core.run(`essentials:vanish ${bot._client.username} on`);
|
||||
else if (!commandSpy) bot.core.run(`commandspy ${bot.uuid} on`);
|
||||
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
|
||||
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
|
||||
else if (!teleportToggle)
|
||||
bot.core.run(`tptoggle ${bot.options.username} disable`);
|
||||
else if (clientLock !== 4)
|
||||
bot._client.write("client_command", { actionId: 0 });
|
||||
}
|
||||
}, options.selfcareInterval);
|
||||
});
|
||||
bot.on("end", () => {
|
||||
if (timer) clearInterval(timer);
|
||||
prefix = false;
|
||||
commandSpy = false;
|
||||
vanished = false;
|
||||
prefix = false;
|
||||
god = false;
|
||||
unmuted = false;
|
||||
username = false;
|
||||
loggedin = false
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = SelfcareModule;
|
||||
@@ -0,0 +1,15 @@
|
||||
class gamemodeSelfcare {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const config = context.config
|
||||
const options = context.options
|
||||
bot.selfcare.gameMode = null
|
||||
|
||||
bot.on("packet.game_state_change", (packet) => {
|
||||
if (packet.reason !== 3) return; // Reason 3 = Change Game Mode
|
||||
bot.selfcare.gameMode = packet.gameMode;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = gamemodeSelfcare
|
||||
@@ -0,0 +1,20 @@
|
||||
class opSelfcare {
|
||||
constructor (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config
|
||||
const options = context.options
|
||||
bot.selfcare.entityId = undefined
|
||||
|
||||
bot.on("packet.entity_status", (packet) => {
|
||||
if (
|
||||
packet.entityId !== bot.selfcare.entityId ||
|
||||
packet.entityStatus < 24 ||
|
||||
packet.entityStatus > 28
|
||||
)
|
||||
return;
|
||||
bot.selfcare.permissionLevel = packet.entityStatus - 24;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = opSelfcare
|
||||
@@ -0,0 +1,17 @@
|
||||
class commandSpySelfcare {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const stringMessage = context.stringMessage
|
||||
|
||||
if (stringMessage === "Successfully enabled CommandSpy")
|
||||
bot.selfcare.commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.")
|
||||
bot.selfcare.commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy")
|
||||
bot.selfcare.commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.")
|
||||
bot.selfcare.commandSpy = false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = commandSpySelfcare
|
||||
@@ -0,0 +1,15 @@
|
||||
class prefixSelfcare {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
const options = context.options
|
||||
const stringMessage = context.stringMessage
|
||||
|
||||
if (options.mode === "savageFriends") {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = prefixSelfcare
|
||||
Reference in New Issue
Block a user