forked from afspiegeling/NitoriBot
added fallback partically to commands *yes i know its shit*, made the prefix selfcare check the display and more
This commit is contained in:
Generated
+41
-50
@@ -8,7 +8,7 @@
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.98.0",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.11.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
@@ -40,15 +40,6 @@
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/biome": {
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz",
|
||||
@@ -383,12 +374,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz",
|
||||
"integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==",
|
||||
"version": "24.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.0.tgz",
|
||||
"integrity": "sha512-y1dMvuvJspJiPSDZUQ+WMBvF7dpnEqN4x9DDC9ie5Fs/HUZJA3wFp7EhHoVaKX/iI0cRoECV8X2jL8zi0xrHCg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.10.0"
|
||||
"undici-types": "~7.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-rsa": {
|
||||
@@ -444,15 +435,6 @@
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@xboxreplay/xboxlive-auth/node_modules/axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
@@ -500,14 +482,12 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz",
|
||||
"integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==",
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
@@ -613,9 +593,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
||||
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
@@ -645,9 +625,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/discord-api-types": {
|
||||
"version": "0.38.24",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.24.tgz",
|
||||
"integrity": "sha512-P7/DkcFIiIoaBogStnhhcGRX7KR+gIFp0SpmwsZUIM0bgDkYMEUx+8l+t3quYc/KSgg92wvE9w/4mabO57EMug==",
|
||||
"version": "0.38.25",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.25.tgz",
|
||||
"integrity": "sha512-3edaLHuCdzzfTL1OCpl98G3mrlf+45FpxY+8f+5dRLnZD8R6QzIhapoCefqz6mhaygD+iqTVLtD4u6j57PRiFw==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"scripts/actions/documentation"
|
||||
@@ -1268,9 +1248,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-chat": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-chat/-/prismarine-chat-1.11.0.tgz",
|
||||
"integrity": "sha512-VJT/MWYB3qoiznUhrgvSQh76YFpzpCZpY85kJKxHLbd3UVoM0wsfs43Eg8dOltiZG92wc5/DTMLlT07TEeoa9w==",
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-chat/-/prismarine-chat-1.12.0.tgz",
|
||||
"integrity": "sha512-+1QBUn4WGXbAGwoGwJy31/FvH6JtTBHh//yU0xwOiVnBO71+6Ij0hYMd9PzTTAwR9bySfl/YLltGPBftUAOYOA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mojangson": "^2.0.1",
|
||||
@@ -1491,9 +1471,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
|
||||
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz",
|
||||
"integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
@@ -1505,6 +1485,15 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid-1345": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid-1345/-/uuid-1345-1.0.2.tgz",
|
||||
@@ -1543,6 +1532,17 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/wikipedia/node_modules/axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.18.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
||||
@@ -1573,15 +1573,6 @@
|
||||
"node-fetch": "^2.6.1",
|
||||
"uuid": "^8.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yggdrasil/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.98.0",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.11.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ class Bot {
|
||||
|
||||
client.on("disconnect", (data) => {
|
||||
if (
|
||||
JSON.parse(data.reason) ===
|
||||
data.reason ===
|
||||
"Wait 5 seconds before connecting, thanks! :)"
|
||||
)
|
||||
bot.reconnectDelay = 5000;
|
||||
@@ -64,7 +64,7 @@ class Bot {
|
||||
} else {
|
||||
bot.console.warn(
|
||||
ChatMessage(bot._client.version)
|
||||
.fromNotch(`§8[§bClient Reconnect§8]§r ${error.toString()}`)
|
||||
.fromNotch(`§8[§bClient Reconnect§8]§r ${error.stack}`)
|
||||
?.toAnsi(),
|
||||
);
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
|
||||
@@ -19,7 +19,7 @@ function chipmunkmod(message, data, context, bot) {
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
.toString(); // TypeError: data.getMessageAsPrismarine is not a function
|
||||
?.toString();
|
||||
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
|
||||
@@ -10,7 +10,15 @@ function kaboom (message, data) {
|
||||
const prefix = children[0]
|
||||
let displayName = data.senderName ?? { text: '' }
|
||||
let contents = { text: '' }
|
||||
//console.log(data.players.find((e) => e.uuid ==))
|
||||
/*
|
||||
player chat:
|
||||
senderUuid: '85f5b68d-a567-3877-9701-3cd7404bc9d9',
|
||||
networkName: { extra: [ [Object] ], text: '' },
|
||||
|
||||
diguised chat:
|
||||
senderName: { extra: [ [Object] ], text: '' },
|
||||
*/
|
||||
if (isSeparatorAt(children, 1)) { // Missing/blank display name
|
||||
if (children.length > 3) contents = children[3]
|
||||
} else if (isSeparatorAt(children, 2)) {
|
||||
@@ -21,6 +29,10 @@ function kaboom (message, data) {
|
||||
}
|
||||
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
// console.log(JSON.stringify(playerListDisplayName))
|
||||
//console.log(JSON.stringify())
|
||||
//console.log(`Player list display name from Chat Parser ${data.getMessageAsPrismarine(playerListDisplayName)?.toMotd()}`)
|
||||
//console.log(`${data.getMessageAsPrismarine(displayName)?.toMotd()}`)
|
||||
let sender
|
||||
if (data.uuid) {
|
||||
sender = data.players.find(player => player.uuid === data.senderUuid)
|
||||
|
||||
@@ -17,12 +17,12 @@ function parseMessage(message, data, context) {
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
.toString(); // TypeError: data.getMessageAsPrismarine is not a function
|
||||
.toString();
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
if (!sender) return; //stringUsername
|
||||
if (!sender) return;
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
const CommandError = require('./command_error');
|
||||
const translations = require('../data/translations.json');
|
||||
|
||||
class CommandArguments {
|
||||
static getInteger (integer) {
|
||||
if (isNaN(integer)) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${integer}` }
|
||||
]
|
||||
})
|
||||
else return String(Number(integer))
|
||||
}
|
||||
|
||||
static getJson (json) {
|
||||
|
||||
}
|
||||
|
||||
static getArguments () {
|
||||
|
||||
}
|
||||
|
||||
static getMaxArguments (commandArgs, args) {
|
||||
if (commandArgs < args) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.max_exceeded",
|
||||
fallback: translations["fnfboyfriendbot.arguments.max_exceeded"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${commandArgs}` },
|
||||
{ text: `${args}` }
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandArguments;
|
||||
@@ -1,5 +1,5 @@
|
||||
class CommandContext {
|
||||
constructor(name, aliases, description, trustLevel, usages, playerChat) {
|
||||
constructor(name, aliases, description, trustLevel, usages, playerChat, args) {
|
||||
this.data = {};
|
||||
this.data.name = name;
|
||||
this.data.aliases = aliases;
|
||||
@@ -7,6 +7,7 @@ class CommandContext {
|
||||
this.data.trustLevel = trustLevel;
|
||||
this.data.usages = usages;
|
||||
this.data.playerChat = playerChat;
|
||||
this.data.args = args
|
||||
}
|
||||
}
|
||||
module.exports = CommandContext;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: Improve how messages are stringified
|
||||
const ChatMessage = require("prismarine-chat")("1.20.2");
|
||||
const ChatMessage = require("prismarine-chat")("1.21.8");
|
||||
const stringify = (message) => new ChatMessage(message)?.toString();
|
||||
|
||||
class CommandError extends Error {
|
||||
|
||||
@@ -5,7 +5,6 @@ class command_trust_level {
|
||||
owner = 3;
|
||||
console = 4;
|
||||
disabled = 5;
|
||||
|
||||
}
|
||||
|
||||
module.exports = command_trust_level;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { stylize } = require("../../util/stylizeEval");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require("../../command_util/command_trust_level");
|
||||
const trustLevel = new CommandTrustLevel();
|
||||
|
||||
class servereval extends CommandContext {
|
||||
constructor() {
|
||||
super("servereval", ["se"], "run code unisolated", 4, ["<code>"], true);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(" ");
|
||||
const { MessageBuilder } = require("prismarine-chat")(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(
|
||||
bot
|
||||
.getMessageAsPrismarine({
|
||||
text: util.inspect(eval(args.join(" ")), { stylize }),
|
||||
})
|
||||
?.toAnsi(),
|
||||
);
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(
|
||||
`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
|
||||
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = servereval
|
||||
+81
-35
@@ -20,6 +20,7 @@ class help extends CommandContext {
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
@@ -30,29 +31,51 @@ class help extends CommandContext {
|
||||
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",
|
||||
translate: "%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,
|
||||
translate: "fnfboyfriendbot.command.help.command_layout",
|
||||
fallback: translations["fnfboyfriendbot.command.help.command_layout"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ':', color: config.colors.commands.tertiary },
|
||||
{ text: '(', color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
{ text: ')', color: config.colors.commands.tertiary }
|
||||
]
|
||||
},
|
||||
cat,
|
||||
],
|
||||
});
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.category",
|
||||
fallback: translations["fnfboyfriendbot.command.help.category"],
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.public",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.public"],
|
||||
color: config.colors.help.public
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.trusted",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.trusted"],
|
||||
color: config.colors.help.trusted
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.admin",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.admin"],
|
||||
color: config.colors.help.admin
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.owner",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.owner"],
|
||||
color: config.colors.help.owner
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
@@ -116,34 +139,57 @@ class help extends CommandContext {
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
|
||||
translate: "%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Name", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.help.info.command",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.command"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.name,
|
||||
]
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases.toString().replaceAll(",", " ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.help.info.alias",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.alias"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.aliases.toString().replaceAll(',',' ')
|
||||
]
|
||||
},
|
||||
{ text: "Description", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.help.info.description",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.description"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.description
|
||||
]
|
||||
},
|
||||
{ text: "Trust Level", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
translate: "fnfboyfriendbot.command.help.info.trust_level",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.trust_level"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.usages",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.usages"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
usagesComponent
|
||||
]
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
],
|
||||
});
|
||||
|
||||
infoComponent.push(usagesComponent);
|
||||
]
|
||||
})
|
||||
source.sendFeedback(infoComponent)
|
||||
return;
|
||||
}
|
||||
|
||||
+317
-258
@@ -1,8 +1,6 @@
|
||||
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");
|
||||
const CommandTrustLevel = require("../../command_util/command_trust_level");
|
||||
@@ -38,9 +36,9 @@ class info extends CommandContext {
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages ",
|
||||
"uptimes/uptime",
|
||||
"uptimes",
|
||||
"server",
|
||||
"version/ver",
|
||||
"version/",
|
||||
],
|
||||
false,
|
||||
);
|
||||
@@ -52,14 +50,18 @@ class info extends CommandContext {
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
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: "",
|
||||
translate: "fnfboyfriendbot.command.info.about",
|
||||
fallback: translations["fnfboyfriendbot.command.info.about"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${botInfo.buildstring.url}`, color: config.colors.commands.secondary }
|
||||
],
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
@@ -72,70 +74,100 @@ class info extends CommandContext {
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${botInfo.buildstring.url}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "config":
|
||||
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",
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%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",
|
||||
translate: "fnfboyfriendbot.command.info.config.server.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
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",
|
||||
translate: "fnfboyfriendbot.command.info.config.server.name",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.name"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
bot.options.serverName
|
||||
]
|
||||
},
|
||||
{
|
||||
text: `${discordClient.user?.tag}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Discord Channel",
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: `${bot.discord.channel?.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.version}`, 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,
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${discordClient?.user?.tag}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{ text: "Mode", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${bot.options.mode}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.channel",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.channel"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
],
|
||||
});
|
||||
break
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.count",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.count"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.prefixes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.prefixes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.mode",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.mode"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
@@ -156,261 +188,288 @@ class info extends CommandContext {
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
text: `the discord server invite is ${config.discord.invite}`,
|
||||
translate: "fnfboyfriendbot.command.info.discord",
|
||||
fallback: translations["fnfboyfriendbot.command.info.discord"],
|
||||
color: config.colors.commands.primary,
|
||||
translate: "",
|
||||
with: [
|
||||
{ text: `${config.discord.invite}`, color: config.colors.commands.secondary }
|
||||
],
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: config.colors.commands.secondary,
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${config.discord.invite}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s %s\n%s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
translate: "%s\n%s",
|
||||
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":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Server Memory",
|
||||
translate: "fnfboyfriendbot.command.info.loaded.commands",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.commands"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer}
|
||||
]
|
||||
},
|
||||
{
|
||||
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",
|
||||
translate: "fnfboyfriendbot.command.info.loaded.modules",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.modules"],
|
||||
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;
|
||||
case "uptimes":
|
||||
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;
|
||||
with: [
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
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",
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.hostname",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.hostname"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.user",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.user"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.directory",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.directory"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${require.main.path}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.arch",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.arch"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.arch}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.primary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.kernel_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.kernel_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus()[0].model }`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu.cores",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu.cores"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.processes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.processes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.node_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.node_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.npm_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.npm_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("npm -v").toString().replaceAll("\n", "")}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "usages":
|
||||
component.push({
|
||||
translate: "%s\n%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",
|
||||
translate: "fnfboyfriendbot.command.info.usages.botmem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.botmem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
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 },
|
||||
translate: "fnfboyfriendbot.command.info.usages.servermem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.servermem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
break;
|
||||
case "uptimes":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: `${os.version()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.bot",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.bot"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(process.uptime())}`}
|
||||
]
|
||||
},
|
||||
{ text: "Kernel Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${os.release()}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "CPU", color: config.colors.commands.primary },
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.server",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.server"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s\n%s\n%s\n%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: `${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", "")}`,
|
||||
text: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "Node Version", color: config.colors.commands.primary },
|
||||
botInfo.buildstring.codename || '',
|
||||
{
|
||||
text: `${process.version}`,
|
||||
color: config.colors.commands.secondary,
|
||||
translate: "fnfboyfriendbot.command.info.version.build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{ text: "NPM Version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("npm -v").toString().replaceAll("\n", "")}`,
|
||||
translate: "fnfboyfriendbot.command.info.version.repo_build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.repo_build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.version_release_date",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.version_release_date"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.commit",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.commit"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ 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;
|
||||
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:
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
|
||||
source.sendFeedback(component)
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,12 @@ class list extends CommandContext {
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
component.push({
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
translate: "%s \u203a %s [%s: %s]\n",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
@@ -41,11 +42,8 @@ class list extends CommandContext {
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
});
|
||||
component.push("\n");
|
||||
})
|
||||
}
|
||||
component.pop();
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,39 +13,70 @@ class mcserver extends CommandContext {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(":");
|
||||
const source = context.source;
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
const translations = bot.translations
|
||||
const [host, port] = args[0].split(':')
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
if (isNaN(port) && port) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: "ip", color: config.colors.commands.primary },
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Number(port ?? 25565)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "players", color: config.colors.commands.primary },
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer },
|
||||
{ text: "server version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${server.version.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
server.description,
|
||||
],
|
||||
});
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
{ text: "Port" }
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
process.once('uncaughtException', (error) => {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.unknown",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.unknown"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${host}` },
|
||||
{ text: `${Number(port ?? 25565)}` }
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.players",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.players"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.version",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
server.description
|
||||
]
|
||||
})
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
module.exports = mcserver;
|
||||
|
||||
@@ -17,9 +17,13 @@ class refillcore extends CommandContext {
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
bot.core.move(bot.position);
|
||||
bot.tellraw("@a", "refilling core");
|
||||
|
||||
source.sendFeedback({
|
||||
translation: "command.core.refill",
|
||||
}) // most likely wont be seen most of the time
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require("../../command_util/command_trust_level");
|
||||
const trustLevel = new CommandTrustLevel();
|
||||
const CommandArguments = require('../../command_util/command_arguments');
|
||||
|
||||
class test extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"test",
|
||||
[],
|
||||
"testing stuff",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
source.sendFeedback(CommandArguments.getMaxArguments(this.data.maxArgs, args.join(' ')))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = test;
|
||||
@@ -0,0 +1,157 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandTrustLevel = require("../../command_util/command_trust_level");
|
||||
const trustLevel = new CommandTrustLevel();
|
||||
|
||||
class weather extends CommandContext {
|
||||
constructor() {
|
||||
super("weather", [], "check the weather in locations", trustLevel.public, [
|
||||
"<weather/zip code>",
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(
|
||||
`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(" ").replaceAll(" ", "%20")}`,
|
||||
);
|
||||
const info = await url.body.json();
|
||||
|
||||
if (info.error) source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.weather.unknown_location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.unknown_location"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${args.join(' ')}`}
|
||||
]
|
||||
})
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.location"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.location.region}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.country}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.coords",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.coords"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.time",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.time"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id })}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${info.location.tz_id}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.temp",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.temp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.wind_speed",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.wind_speed"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_kph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "kph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.wind_mph)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "mph", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${info.current.wind_dir}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.condition",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.condition"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.humidity",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.humidity"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')") return
|
||||
else source.sendFeedback(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = weather;
|
||||
@@ -6,6 +6,7 @@ module.exports = {
|
||||
prefix: "!",
|
||||
invite: "discord invite here",
|
||||
enabled: true,
|
||||
serverID: 'server id here',
|
||||
presence: {
|
||||
name: "amogus",
|
||||
status: "dnd",
|
||||
@@ -101,10 +102,18 @@ module.exports = {
|
||||
// channelId is for discord logging
|
||||
// logging is for console logging
|
||||
// reconnectDelay is for the delay for reconnecting to a server
|
||||
/*
|
||||
logging options
|
||||
console true or false
|
||||
file true or false
|
||||
*/
|
||||
// modes:
|
||||
// kaboom: for the server kaboom.pw
|
||||
// savageFriends: for the server savage Friends
|
||||
// creayun for the server creayun
|
||||
// version: 1.21.8
|
||||
// port: a number lmao
|
||||
// itemRefill: for refilling the core via chat or a command block
|
||||
{
|
||||
host: "localhost",
|
||||
username: "FNFBoyfriendBot",
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"fnfboyfriendbot.arguments": "Expected %s Arguments, recieved %s",
|
||||
"fnfboyfriendbot.arguments.invalid_integer": "Expected %s to be an Integer",
|
||||
"fnfboyfriendbot.arguments.max_exceeded": "Expected %s Arguments not %s",
|
||||
"fnfboyfriendbot.arguments.no_args": "Expected no Arguments",
|
||||
"fnfboyfriendbot.arguments.not_enough_args": "Expected more than 0 Arguments",
|
||||
"fnfboyfriendbot.command.arguments.unknown": "Invalid Argument",
|
||||
|
||||
"fnfboyfriendbot.command.auth.as": "Authed as %s",
|
||||
"fnfboyfriendbot.command.auth.exists": "You are already authed with the trust level: %s",
|
||||
|
||||
"fnfboyfriendbot.command.cloop.list.text": "Cloops (%s):",
|
||||
"fnfboyfriendbot.command.cloop.remove": "Removed %s from the cloops",
|
||||
"fnfboyfriendbot.command.cloop.clear": "Cleared the cloops",
|
||||
"fnfboyfriendbot.command.cloop.not_an_integer": "Interval must be an Integer!",
|
||||
"fnfboyfriendbot.command.cloop.add": "Added %s to the cloops with the interval %s",
|
||||
|
||||
"fnfboyfriendbot.command.core.refill": "Refilling core",
|
||||
|
||||
"fnfboyfriendbot.command.extras.send": "Sent %s to Channel %s",
|
||||
"fnfboyfriendbot.command.extras.register": "Registered %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregister": "Unregistered from %s Channel",
|
||||
"fnfboyfriendbot.command.extras.unregisterAll": "Unregistered from all channels",
|
||||
|
||||
"fnfboyfriendbot.command.help.category": "(%s | %s | %s | %s)",
|
||||
"fnfboyfriendbot.command.help.command_layout": "Commands%s %s%s%s",
|
||||
"fnfboyfriendbot.command.help.info.alias": "Aliases%s %s",
|
||||
"fnfboyfriendbot.command.help.info.command": "Command%s %s",
|
||||
"fnfboyfriendbot.command.help.info.description": "Descripton%s %s",
|
||||
"fnfboyfriendbot.command.help.info.trust_level": "Trust Level%s %s",
|
||||
"fnfboyfriendbot.command.help.info.usages": "Usages%s\n%s",
|
||||
"fnfboyfriendbot.command.help.trust_level.public": "Public",
|
||||
"fnfboyfriendbot.command.help.trust_level.trusted": "Trusted",
|
||||
"fnfboyfriendbot.command.help.trust_level.admin": "Admin",
|
||||
"fnfboyfriendbot.command.help.trust_level.owner": "Owner",
|
||||
|
||||
"fnfboyfriendbot.command.info.about": "FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.config.discord.channel": "Discord Channel%s %s",
|
||||
"fnfboyfriendbot.command.info.config.discord.username": "Discord Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.username": "Minecraft Username%s %s",
|
||||
"fnfboyfriendbot.command.info.config.minecraft.version": "Minecraft Version%s %s",
|
||||
"fnfboyfriendbot.command.info.config.mode": "Mode%s %s",
|
||||
"fnfboyfriendbot.command.info.config.prefixes": "Prefixes%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.ip": "Server%s %s%s%s",
|
||||
"fnfboyfriendbot.command.info.config.server.name": "Server Name%s %s",
|
||||
"fnfboyfriendbot.command.info.config.server.count": "Server Count%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.discord": "the discord server invite is %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.loaded.commands": "%s Commands",
|
||||
"fnfboyfriendbot.command.info.loaded.modules": "%s Modules",
|
||||
|
||||
"fnfboyfriendbot.command.info.server.arch": "Arch%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu": "CPU%s %s",
|
||||
"fnfboyfriendbot.command.info.server.cpu.cores": "CPU Cores%s %s",
|
||||
"fnfboyfriendbot.command.info.server.directory": "Directory%s %s",
|
||||
"fnfboyfriendbot.command.info.server.hostname": "Hostname%s %s",
|
||||
"fnfboyfriendbot.command.info.server.kernel_version": "Kernel Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os": "OS%s %s",
|
||||
"fnfboyfriendbot.command.info.server.os.version": "OS Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.processes": "Processes%s %s",
|
||||
"fnfboyfriendbot.command.info.server.node_version": "Node Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.npm_version": "NPM Version%s %s",
|
||||
"fnfboyfriendbot.command.info.server.user": "Username%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.uptimes.bot": "Bot Uptime%s %s",
|
||||
"fnfboyfriendbot.command.info.uptimes.server": "Server Uptime%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.info.usages.botmem": "Bot Memory%s %s MB / %s MB",
|
||||
"fnfboyfriendbot.command.info.usages.servermem": "Server Memory%s %s MB / %s MB",
|
||||
|
||||
"fnfboyfriendbot.command.info.version.build": "Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.commit": "Commit%s %s",
|
||||
"fnfboyfriendbot.command.info.version.repo_build": "Repo Build%s %s",
|
||||
"fnfboyfriendbot.command.info.version.version_release_date": "Version Release Date%s %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.latency": "Latency: %s",
|
||||
"fnfboyfriendbot.command.list.gamemode": "Gamemode: %s",
|
||||
|
||||
"fnfboyfriendbot.command.list.text": "Players: (%s)\n",
|
||||
|
||||
"fnfboyfriendbot.command.mcserver.ip": "Ip: %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.players": "Players: %s/%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.unknown": "could not ping %s:%s",
|
||||
"fnfboyfriendbot.command.mcserver.server.version": "Server Version: %s",
|
||||
|
||||
"fnfboyfriendbot.command.rtp": "Telported %s to X%s %s Y%s %s Z%s%s",
|
||||
|
||||
"fnfboyfriendbot.command.urban.definition_not_found": "Urban Definition not found!",
|
||||
|
||||
"fnfboyfriendbot.command.validate.owner": "Validated as Owner",
|
||||
"fnfboyfriendbot.command.validate.admin": "Validated as Admin",
|
||||
"fnfboyfriendbot.command.validate.trusted": "Validated as Trusted",
|
||||
|
||||
"fnfboyfriendbot.command.weather.condition": "Condition: %s",
|
||||
"fnfboyfriendbot.command.weather.coords": "Coords: %s, %s",
|
||||
"fnfboyfriendbot.command.weather.humidity": "Humidity: %s",
|
||||
"fnfboyfriendbot.command.weather.location": "Location: %s %s, %s %s",
|
||||
"fnfboyfriendbot.command.weather.time": "Time: %s (%s)",
|
||||
"fnfboyfriendbot.command.weather.temp": "Temp: %s (\u00b0C), %s (\u00b0F)",
|
||||
"fnfboyfriendbot.command.weather.unknown_location": "%s is not a valid location!",
|
||||
"fnfboyfriendbot.command.weather.wind_speed": "Wind Speed: %s (%s, %s), %s (%s, %s)",
|
||||
|
||||
"fnfboyfriendbot.command.wiki.article_not_found": "Wiki Article not found!",
|
||||
|
||||
"fnfboyfriendbot.commandManager.trust_level.consoleOnly": "This command can only be ran via console!",
|
||||
"fnfboyfriendbot.commandManager.validation.invalid_admin_hash": "Invalid Admin Hash",
|
||||
"fnfboyfriendbot.commandManager.validation.invalid_hash": "Invalid Hash",
|
||||
"fnfboyfriendbot.commandManager.validation.invalid_owner_hash": "Invalid Owner Hash",
|
||||
"fnfboyfriendbot.commandManager.validation.invalid_trusted_hash": "Invalid Trusted Hash",
|
||||
"fnfboyfriendbot.commandManager.validation.invalid_role": "Invalid Role",
|
||||
|
||||
"fnfboyfriendbot.reconnect.stop_logging": "stopped logging disconnect messages for now"
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
class directMessages {
|
||||
constructor (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
|
||||
discordClient.on("messageCreate", async (message) => {
|
||||
if (message.guildId !== null) return;
|
||||
else {
|
||||
const server = discordClient.guilds.cache.get(`${config.discord.serverID}`)
|
||||
const member = await server.members.fetch(message.author.id);
|
||||
const roles = member.roles.cache;
|
||||
let trustLevel = 0;
|
||||
let hash;
|
||||
const hasRole = roles.some((role) => {
|
||||
if (role.name === `${config.discord.roles.trusted}`) trustLevel = 1;
|
||||
else if (role.name === `${config.discord.roles.admin}`) trustLevel = 2;
|
||||
else if (role.name === `${config.discord.roles.owner}`) trustLevel = 3;
|
||||
})
|
||||
|
||||
if (message.content === "hash") {
|
||||
if (trustLevel === 1) bot.validation.discord.trusted = crypto.createHash("sha512").digest("hex").substring(0, 16)
|
||||
else if (trustLevel === 2) bot.validation.discord.admin = crypto.createHash("sha512").digest("hex").substring(0, 16)
|
||||
else if (trustLevel === 3) bot.validation.discord.owner = crypto.createHash("sha512").digest("hex").substring(0, 16)
|
||||
|
||||
if (trustLevel === 1) hash = bot.validation.discord.trusted;
|
||||
else if (trustLevel === 2) hash = bot.validation.discord.admin;
|
||||
else if (trustLevel === 3) hash = bot.validation.discord.owner
|
||||
message.reply(`The hash for trust level ${trustLevel} is ${hash}`)
|
||||
} else if (message.content === "key") {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = directMessages;
|
||||
@@ -4,6 +4,7 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
const loadModules = require("./util/loadModules");
|
||||
const { Client, GatewayIntentBits, Partials } = require("discord.js");
|
||||
const fixansi = require("./util/ansi");
|
||||
const { MessageContent, GuildMessages, Guilds, DirectMessages } =
|
||||
GatewayIntentBits;
|
||||
const discordClient = new Client({
|
||||
@@ -43,12 +44,18 @@ let bot;
|
||||
for (const botOptions of config.bots) {
|
||||
options = botOptions;
|
||||
bot = new createBot(options, config);
|
||||
bot.translations = require('./data/translations.json')
|
||||
|
||||
bots.push(bot);
|
||||
bot.bots = bots;
|
||||
loadModules(bot, options, config, discordClient);
|
||||
bot.console.readlineInterface(rl);
|
||||
}
|
||||
const discord = [
|
||||
require('./discord/directMessages.js'),
|
||||
]
|
||||
|
||||
for (const file of discord) new file({ bot, config, discordClient })
|
||||
|
||||
discordClient.on("messageCreate", (message) => {
|
||||
try {
|
||||
@@ -58,6 +65,7 @@ discordClient.on("messageCreate", (message) => {
|
||||
bot.getMessageAsPrismarine = (message) => {
|
||||
return new ChatMessage(message);
|
||||
};
|
||||
|
||||
config.prefixes.map((prefix) => {
|
||||
if (message.content.startsWith(prefix)) {
|
||||
const source = new CommandSource(
|
||||
@@ -74,6 +82,9 @@ discordClient.on("messageCreate", (message) => {
|
||||
message,
|
||||
);
|
||||
|
||||
source.sendFeedback = input => {
|
||||
message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(input)?.toAnsi()?.replaceAll('`', '`\u200b').substring(0, 1780))}\`\`\``);
|
||||
}
|
||||
bot.commandManager.executeString(
|
||||
source,
|
||||
message.content.substring(prefix.length),
|
||||
|
||||
+4
-2
@@ -74,8 +74,10 @@ class chat {
|
||||
tryParsingMessage(parsed, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine, chatType: "minecraft:diguised_chat" })
|
||||
});
|
||||
|
||||
bot.on("packet.player_chat", (packet, data) => {
|
||||
bot.on("packet.player_chat", (packet) => {
|
||||
|
||||
const unsigned = convertNbtComponentToJson(null, packet.unsignedChatContent);
|
||||
const networkName = convertNbtComponentToJson(null, packet.networkName)
|
||||
bot.emit('message', {
|
||||
type: "minecraft:player_chat",
|
||||
message: unsigned
|
||||
@@ -104,13 +106,13 @@ class chat {
|
||||
|
||||
if (message.translate === "advMode.notAllowed") return;
|
||||
|
||||
// console.log(JSON.stringify(message))
|
||||
bot.emit("message", {
|
||||
type: "minecraft:system_chat",
|
||||
message: message
|
||||
});
|
||||
bot.emit("system_chat", message);
|
||||
|
||||
//if (bot.options.mode !== "savageFriends") return;
|
||||
tryParsingMessage(message, {
|
||||
players: bot.players,
|
||||
getMessageAsPrismarine: bot.getMessageAsPrismarine,
|
||||
|
||||
@@ -149,7 +149,6 @@ class command_core {
|
||||
},
|
||||
|
||||
run(command) {
|
||||
if (!bot.loggedIn) return;
|
||||
const location = bot.core.currentBlock();
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class command_handler {
|
||||
);
|
||||
|
||||
source.sendFeedback = (message) => {
|
||||
if (options.mode === "savageFriends") bot.tellraw(`@a[name=${source.player.profile.name}]`, [
|
||||
if (options.mode === "savageFriends") bot.tellraw(`@a`, [
|
||||
message
|
||||
])
|
||||
else bot.tellraw(`@a[name="${source.player.profile.name}"]`, message)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const CommandError = require("../command_util/command_error.js");
|
||||
const CommandError = require("../command_util/command_error");
|
||||
const CommandSource = require("../command_util/command_source");
|
||||
const CommandArguments = require('../command_util/command_arguments')
|
||||
const fixansi = require("../util/ansi");
|
||||
const sleep = require("../util/sleep.js");
|
||||
const trustLevels = require('../command_util/command_trust_level.js')
|
||||
|
||||
function unknownCommand(commandName, bot) {
|
||||
return {
|
||||
@@ -25,6 +25,7 @@ class command_manager {
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const options = context.options;
|
||||
const translations = bot.translations;
|
||||
|
||||
bot.commandManager = {
|
||||
commands: {},
|
||||
@@ -34,11 +35,21 @@ class command_manager {
|
||||
try {
|
||||
const authFind = bot.auth.list.find((e) => e.player === source.player.uuid)
|
||||
if (!command) {
|
||||
source.sendFeedback(
|
||||
throw new CommandError(
|
||||
unknownCommand(commandName, bot),
|
||||
);
|
||||
}
|
||||
|
||||
if (args.length > command.data.args) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments",
|
||||
fallback: translations["fnfboyfriendbot.arguments"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${command.data.args}` },
|
||||
{ text: `${args.length}`}
|
||||
]
|
||||
})
|
||||
|
||||
if (authFind) {
|
||||
source.player.validateBypass = true
|
||||
if (authFind.trustLevel === "trusted") source.player.trustLevel = 1;
|
||||
@@ -46,7 +57,7 @@ class command_manager {
|
||||
else if (authFind.trustLevel === "owner") source.player.trustLevel = 3;
|
||||
}
|
||||
|
||||
if (command?.data?.trustLevel !== 0) {
|
||||
if (command?.data?.trustLevel !== 0 && command?.data.trustLevel < 4) {
|
||||
if (!source.player.validateBypass && !source.sources.console && !source.sources.discord) {
|
||||
if (args[0] === bot.validation.trusted)
|
||||
source.player.trustLevel = 1
|
||||
@@ -54,10 +65,24 @@ class command_manager {
|
||||
source.player.trustLevel = 2
|
||||
else if (args[0] === bot.validation.owner)
|
||||
source.player.trustLevel = 3
|
||||
|
||||
if (args[0] === bot.validation.discord.trusted) {
|
||||
source.player.trustLevel = 1
|
||||
bot.validation.discord.trusted = undefined;
|
||||
} else if (args[0] === bot.validation.discord.admin) {
|
||||
source.player.trustLevel = 2;
|
||||
bot.validation.discord.admin = undefined;
|
||||
} else if (args[0] === bot.validation.discord.owner) {
|
||||
console.log(args[0])
|
||||
console.log(bot.validation.discord.owner)
|
||||
source.player.trustLevel = 3
|
||||
bot.validation.discord.owner = undefined
|
||||
}
|
||||
args = args.slice(1)
|
||||
if (source.player.trustLevel < command?.data?.trustLevel && !source.sources.console) {
|
||||
throw new CommandError({
|
||||
text: "Invalid Hash",
|
||||
translate: "fnfboyfriendbot.commandManager.validation.invalid_hash",
|
||||
fallback: translations["fnfboyfriendbot.commandManager.validation.invalid_hash"],
|
||||
color: "red"
|
||||
})
|
||||
}
|
||||
@@ -72,11 +97,17 @@ class command_manager {
|
||||
|
||||
if (source.player.trustLevel < command?.data?.trustLevel)
|
||||
throw new CommandError({
|
||||
text: "Invalid Role",
|
||||
translate: "fnfboyfriendbot.commandManager.validation.invalid_role",
|
||||
fallback: translations["fnfboyfriendbot.commandManager.validation.invalid_role"],
|
||||
color: "red"
|
||||
})
|
||||
}
|
||||
}
|
||||
} if (command?.data?.trustLevel === 4 && !source.sources.console)
|
||||
throw new CommandError({
|
||||
translate: "fnfboyfriendbot.commandManager.trustLevel.consoleOnly",
|
||||
fallback: translations["fnfboyfriendbot.commandManager.trustLevel.consoleOnly"],
|
||||
color: "red"
|
||||
})
|
||||
|
||||
if (
|
||||
command?.data.playerChat
|
||||
@@ -86,6 +117,8 @@ class command_manager {
|
||||
!source.sources.console
|
||||
&&
|
||||
!source.sources.discord
|
||||
&&
|
||||
bot.options.mode === 'kaboom'
|
||||
) return
|
||||
return command?.execute({
|
||||
bot,
|
||||
@@ -97,7 +130,6 @@ class command_manager {
|
||||
|
||||
} catch (error) {
|
||||
if (error instanceof CommandError) {
|
||||
|
||||
source.sendFeedback(error._message);
|
||||
} else {
|
||||
bot.console.error(error.stack)
|
||||
|
||||
@@ -10,7 +10,6 @@ class command_spy {
|
||||
?.name === message.text;
|
||||
if (!child || !message.text || !message.color || !sender) return;
|
||||
const command = child[1].substring("/".length);
|
||||
|
||||
if (
|
||||
(message.color === "yellow" &&
|
||||
child[0] === ": " &&
|
||||
|
||||
+5
-14
@@ -17,6 +17,9 @@ class Console {
|
||||
serverName = `§1${bot.options.host}:§9${bot.options.port}`;
|
||||
}
|
||||
|
||||
/*
|
||||
process.stdin.on('keypress', (str, key) => {
|
||||
*/
|
||||
bot.console = {
|
||||
readline: null,
|
||||
server: "all",
|
||||
@@ -33,15 +36,12 @@ class Console {
|
||||
} else if (args.startsWith("")) {
|
||||
bot.chat.send(args);
|
||||
}
|
||||
|
||||
rl.on("close", () => {
|
||||
this.readline = null;
|
||||
});
|
||||
});
|
||||
},
|
||||
/*
|
||||
data.trustLevel,
|
||||
data.validateBypass
|
||||
*/
|
||||
source: new CommandSource(
|
||||
{
|
||||
profile: {
|
||||
@@ -58,7 +58,7 @@ class Console {
|
||||
),
|
||||
|
||||
refreshLine(...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
this?.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
this.readline._refreshLine();
|
||||
},
|
||||
@@ -98,15 +98,6 @@ class Console {
|
||||
?.toAnsi() + message,
|
||||
);
|
||||
},
|
||||
debug(message) {
|
||||
console.log(
|
||||
prismarineChat
|
||||
.fromNotch(
|
||||
`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6debug§8] §8[${serverName}§8] `,
|
||||
)
|
||||
?.toAnsi() + message,
|
||||
);
|
||||
},
|
||||
command(message) {
|
||||
console.log(
|
||||
prismarineChat
|
||||
|
||||
@@ -22,7 +22,7 @@ class discord {
|
||||
invite: config.discord.invite || undefined,
|
||||
prefix: config.discord.prefix,
|
||||
};
|
||||
discordClient.once("ready", (context) => {
|
||||
discordClient.once("clientReady", (context) => {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId);
|
||||
discordClient.user.setPresence({
|
||||
activities: [
|
||||
@@ -89,8 +89,10 @@ class discord {
|
||||
false,
|
||||
message,
|
||||
);
|
||||
|
||||
sendComponent(message);
|
||||
|
||||
source.sendFeedback = input => {
|
||||
message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(input)?.toAnsi()?.replaceAll('`', '`\u200b').substring(0, 1780))}\`\`\``);
|
||||
}
|
||||
|
||||
bot.commandManager.executeString(
|
||||
source,
|
||||
@@ -134,7 +136,7 @@ class discord {
|
||||
: undefined,
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
contents: "Click to join the discord",
|
||||
value: [ "Click to join the discord" ],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -47,9 +47,10 @@ class player_list {
|
||||
|
||||
function addPlayer(entry) {
|
||||
bot.players = bot.players.filter((_entry) => _entry.uuid !== entry.uuid);
|
||||
//console.log(convertNbtComponentToJson(null, entry.displayName).extra[0])
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
mcUUID: "",
|
||||
// mcUUID: "",
|
||||
profile: {
|
||||
name: entry.player.name,
|
||||
properties: entry.player.properties,
|
||||
@@ -59,8 +60,10 @@ class player_list {
|
||||
listed: undefined,
|
||||
latency: undefined,
|
||||
displayName: undefined,
|
||||
prefix: undefined,
|
||||
vanished: false,
|
||||
});
|
||||
|
||||
bot.emit('player_info', entry)
|
||||
}
|
||||
|
||||
@@ -92,12 +95,14 @@ class player_list {
|
||||
|
||||
try {
|
||||
target.displayName = convertNbtComponentToJson(null, entry.displayName);
|
||||
if (bot.options.mode === "kaboom") target.prefix = convertNbtComponentToJson(null, entry.displayName).extra[0]
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
bot.on("end", () => (bot.players = []));
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = player_list;
|
||||
|
||||
+25
-55
@@ -23,64 +23,30 @@ class selfcare {
|
||||
position_count: 0,
|
||||
};
|
||||
|
||||
let selfcare = [];
|
||||
for (const file of fs.readdirSync(
|
||||
path.join(__dirname, "../selfcare/extras"),
|
||||
)) {
|
||||
try {
|
||||
const extrasSelfcare = require(
|
||||
path.join(__dirname, "../selfcare/extras", file),
|
||||
);
|
||||
selfcare.push(extrasSelfcare);
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
}
|
||||
}
|
||||
const messageSelfcare = [
|
||||
require('../selfcare/extras/command_spy'),
|
||||
require('../selfcare/essentials/god'),
|
||||
require('../selfcare/essentials/mute'),
|
||||
require('../selfcare/auth/login'),
|
||||
require('../selfcare/auth/register'),
|
||||
require('../selfcare/essentials/vanish')
|
||||
]
|
||||
|
||||
for (const file of fs.readdirSync(
|
||||
path.join(__dirname, "../selfcare/essentials"),
|
||||
)) {
|
||||
try {
|
||||
const essentialsSelfcare = require(
|
||||
path.join(__dirname, "../selfcare/essentials", file),
|
||||
);
|
||||
selfcare.push(essentialsSelfcare);
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync(
|
||||
path.join(__dirname, "../selfcare/auth"),
|
||||
)) {
|
||||
try {
|
||||
const authSelfcare = require(
|
||||
path.join(__dirname, "../selfcare/auth", file),
|
||||
);
|
||||
selfcare.push(authSelfcare);
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync(
|
||||
path.join(__dirname, "../selfcare/entity"),
|
||||
)) {
|
||||
try {
|
||||
const loadEntitySelfcare = require(
|
||||
path.join(__dirname, "../selfcare/entity", file),
|
||||
);
|
||||
|
||||
new loadEntitySelfcare({ bot, config, options });
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
}
|
||||
}
|
||||
const entitySelfcare = [
|
||||
require('../selfcare/entity/gamemode'),
|
||||
require('../selfcare/entity/icu'),
|
||||
require('../selfcare/entity/op'),
|
||||
require('../selfcare/extras/prefix'),
|
||||
require('../selfcare/extras/username'),
|
||||
require('../selfcare/entity/death')
|
||||
//require('../selfcare/essentials/vanish')
|
||||
]
|
||||
for (const entity of entitySelfcare) new entity({ bot, config, options });
|
||||
|
||||
bot.on("system_chat", (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
|
||||
for (const file of selfcare)
|
||||
for (const file of messageSelfcare)
|
||||
new file({ bot, config, options, stringMessage });
|
||||
});
|
||||
let timer;
|
||||
@@ -108,7 +74,10 @@ class selfcare {
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
if (bot.selfcare.register) bot.chat.command('register amogusissus amogusissus')
|
||||
else if (bot.selfcare.login) bot.chat.command('login amogusissus')
|
||||
|
||||
else if (bot.selfcare.permissionLevel < 2)
|
||||
bot.chat.command(`minecraft:op ${bot._client.username}`);
|
||||
else if (bot.selfcare.gameMode !== 1)
|
||||
bot._client.write('change_gamemode', { mode: 1 })
|
||||
} else if (bot.options.mode === "kaboom") {
|
||||
if (!bot.selfcare.prefix)
|
||||
bot.chat.command(
|
||||
@@ -118,7 +87,8 @@ class selfcare {
|
||||
bot.chat.command("minecraft:op @s[type=player]");
|
||||
else if (bot.selfcare.username) bot.chat.command(`extras:username ${bot._client.username}`)
|
||||
else if (bot.selfcare.gameMode !== 1)
|
||||
bot.chat.command("minecraft:gamemode creative");
|
||||
if (bot.options.chatGamemodeChange) bot.chat.command("minecraft:gamemode creative")
|
||||
else bot._client.write("change_gamemode", { mode: 1 })
|
||||
else if (!bot.selfcare.commandSpy)
|
||||
bot.core.run(`commandspy ${bot.uuid} on`);
|
||||
else if (!bot.selfcare.vanished)
|
||||
|
||||
+11
-18
@@ -4,25 +4,18 @@ class validation {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.validation = {
|
||||
discord: {}
|
||||
}
|
||||
setInterval(() => {
|
||||
bot.validation = {
|
||||
trusted: crypto
|
||||
.createHash("sha512")
|
||||
.update(Math.floor(Date.now() / 2000) + config.keys.trusted)
|
||||
.digest("hex")
|
||||
.substring(0, 16),
|
||||
admin: crypto
|
||||
.createHash("sha512")
|
||||
.update(Math.floor(Date.now() / 2000) + config.keys.admin)
|
||||
.digest("hex")
|
||||
.substring(0, 16),
|
||||
owner: crypto
|
||||
.createHash("sha512")
|
||||
.update(Math.floor(Date.now() / 2000) + config.keys.owner)
|
||||
.digest("hex")
|
||||
.substring(0, 16),
|
||||
};
|
||||
}, 100);
|
||||
bot.validation.trusted = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.trusted).digest("hex").substring(0, 16)
|
||||
bot.validation.admin = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.admin).digest("hex").substring(0, 16)
|
||||
bot.validation.owner = crypto.createHash("sha512").update(Math.floor(Date.now() / 2000) + config.keys.owner).digest("hex").substring(0, 16)
|
||||
}, 100)
|
||||
|
||||
setInterval(() => {
|
||||
bot.validation.discord = {} // to clear discord hashes if they were sent and not used
|
||||
}, 10000)
|
||||
}
|
||||
}
|
||||
module.exports = validation;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class deathSelfcare {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
|
||||
bot.on('packet.update_health', (data) => { // had to add this because some idiot kept killing the bot in savageFriends
|
||||
if (data.health == 0) bot._client.write('client_command', { action: 0 })
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = deathSelfcare
|
||||
@@ -1,25 +1,22 @@
|
||||
const player_list = require("../../modules/player_list");
|
||||
|
||||
class prefixSelfcare {
|
||||
constructor(context) {
|
||||
const bot = context.bot;
|
||||
const options = context.options;
|
||||
const stringMessage = context.stringMessage;
|
||||
const config = context.config;
|
||||
|
||||
if (options.mode === "savageFriends") {
|
||||
} 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."
|
||||
)
|
||||
bot.selfcare.prefix = true;
|
||||
else if (
|
||||
stringMessage?.startsWith("You now have the tag: ") ||
|
||||
stringMessage === "You no longer have a tag"
|
||||
)
|
||||
bot.selfcare.prefix = false;
|
||||
}
|
||||
if (bot.options.mode === "savageFriends") return
|
||||
bot.on('packet.player_info', (packet) => {
|
||||
const uuid = packet.data[0].uuid
|
||||
if (uuid === bot.uuid) {
|
||||
const player = bot.players.find((player) => player.uuid === uuid)
|
||||
const prefix = bot.getMessageAsPrismarine(player.prefix)?.toMotd()?.replaceAll('§','&')
|
||||
const forcedPrefix = `&8[&bPrefix&8: &3${config.prefixes[0]}&8] ` // i put a space here because text: ' ' is outputted at the end of player.prefix in raw json form
|
||||
if (prefix !== forcedPrefix) bot.selfcare.prefix = false
|
||||
else bot.selfcare.prefix = true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ const BOOLEAN_TYPES = [
|
||||
"underlined",
|
||||
"strikethrough",
|
||||
"obfuscated",
|
||||
"float"
|
||||
];
|
||||
function convertNbtComponentToJson(key, tag) {
|
||||
let chatTypes;
|
||||
|
||||
Reference in New Issue
Block a user