diff --git a/src/chat_parsers/chipmunkmod.js b/src/chatParsers/chipmunkmod.js similarity index 100% rename from src/chat_parsers/chipmunkmod.js rename to src/chatParsers/chipmunkmod.js diff --git a/src/chat_parsers/creayun.js b/src/chatParsers/creayun.js similarity index 100% rename from src/chat_parsers/creayun.js rename to src/chatParsers/creayun.js diff --git a/src/chat_parsers/kaboom.js b/src/chatParsers/kaboom.js similarity index 97% rename from src/chat_parsers/kaboom.js rename to src/chatParsers/kaboom.js index 351932f..a20ef94 100644 --- a/src/chat_parsers/kaboom.js +++ b/src/chatParsers/kaboom.js @@ -34,7 +34,8 @@ diguised chat: //console.log(`Player list display name from Chat Parser ${data.getMessageAsPrismarine(playerListDisplayName)?.toMotd()}`) //console.log(`${data.getMessageAsPrismarine(displayName)?.toMotd()}`) let sender - if (data.uuid) { + //console.log(data) + if (data.senderUuid) { sender = data.players.find(player => player.uuid === data.senderUuid) } else { const playerListDisplayName = { extra: [prefix, displayName], text: '' } diff --git a/src/chat_parsers/vanilla.js b/src/chatParsers/vanilla.js similarity index 100% rename from src/chat_parsers/vanilla.js rename to src/chatParsers/vanilla.js diff --git a/src/command_util/command_arguments.js b/src/commandUtil/CommandArguments.js similarity index 94% rename from src/command_util/command_arguments.js rename to src/commandUtil/CommandArguments.js index e839ff0..ea3e76c 100644 --- a/src/command_util/command_arguments.js +++ b/src/commandUtil/CommandArguments.js @@ -1,4 +1,4 @@ -const CommandError = require('./command_error'); +const CommandError = require('./CommandError'); const translations = require('../data/translations.json'); class CommandArguments { diff --git a/src/command_util/command_context.js b/src/commandUtil/CommandContext.js similarity index 63% rename from src/command_util/command_context.js rename to src/commandUtil/CommandContext.js index 0f47d0f..63d1f28 100644 --- a/src/command_util/command_context.js +++ b/src/commandUtil/CommandContext.js @@ -1,13 +1,11 @@ class CommandContext { - constructor(name, aliases, description, trustLevel, usages, playerChat, args) { + constructor(name, aliases, description, trustLevel, usages) { this.data = {}; this.data.name = name; this.data.aliases = aliases; this.data.description = description; this.data.trustLevel = trustLevel; this.data.usages = usages; - this.data.playerChat = playerChat; - this.data.args = args } } module.exports = CommandContext; diff --git a/src/command_util/command_error.js b/src/commandUtil/CommandError.js similarity index 100% rename from src/command_util/command_error.js rename to src/commandUtil/CommandError.js diff --git a/src/command_util/command_source.js b/src/commandUtil/CommandSource.js similarity index 100% rename from src/command_util/command_source.js rename to src/commandUtil/CommandSource.js diff --git a/src/commandUtil/CommandTrustLevel.js b/src/commandUtil/CommandTrustLevel.js new file mode 100644 index 0000000..961e325 --- /dev/null +++ b/src/commandUtil/CommandTrustLevel.js @@ -0,0 +1,10 @@ +class CommandTrustLevel { + static public = 0; + static trusted = 1; + static admin = 2; + static owner = 3; + static console = 4; + static disabled = 5; +} + +module.exports = CommandTrustLevel; diff --git a/src/command_util/command_trust_level.js b/src/command_util/command_trust_level.js deleted file mode 100644 index c1bcfbe..0000000 --- a/src/command_util/command_trust_level.js +++ /dev/null @@ -1,10 +0,0 @@ -class command_trust_level { - public = 0; - trusted = 1; - admin = 2; - owner = 3; - console = 4; - disabled = 5; -} - -module.exports = command_trust_level; diff --git a/src/commands/admin/kick.js b/src/commands/admin/kick.js index 47e3d0b..a3860e5 100644 --- a/src/commands/admin/kick.js +++ b/src/commands/admin/kick.js @@ -1,7 +1,6 @@ -const CommandError = require("../../command_util/command_error"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandError = require("../../commandUtil/CommandError"); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class kick extends CommandContext { constructor() { diff --git a/src/commands/console/console.js b/src/commands/console/console.js index 1f5e86a..d7344f2 100644 --- a/src/commands/console/console.js +++ b/src/commands/console/console.js @@ -1,7 +1,6 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandError = require("../../command_util/command_error"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandError = require("../../commandUtil/CommandError"); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class console extends CommandContext { constructor() { @@ -17,7 +16,6 @@ class console extends CommandContext { "validate/validation/val ", "logging/togglelogging/logtoconsole ", ], - false, ); } execute(context) { diff --git a/src/commands/owner/kill.js b/src/commands/owner/kill.js index 2c2914f..cc456fd 100644 --- a/src/commands/owner/kill.js +++ b/src/commands/owner/kill.js @@ -1,16 +1,17 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class kill extends CommandContext { constructor() { super( "kill", - ["suicide", "quit"], + [ + "suicide", + "quit" + ], "kill the bots process", trustLevel.owner, [""], - true, ); } execute(context) { diff --git a/src/commands/owner/servereval.js b/src/commands/owner/servereval.js deleted file mode 100644 index 92c8856..0000000 --- a/src/commands/owner/servereval.js +++ /dev/null @@ -1,44 +0,0 @@ -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, [""], 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 diff --git a/src/commands/public/core.js b/src/commands/public/core.js index f895e98..78361ac 100644 --- a/src/commands/public/core.js +++ b/src/commands/public/core.js @@ -1,17 +1,22 @@ -const sleep = require("../../util/sleep"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class core extends CommandContext { constructor() { super( "core", - ["cb", "cbrun", "corerun"], + [ + "cb", + "cbrun", + "corerun" + ], "run commands in core", trustLevel.public, - ["$username ", "$uuid ", ""], - false, + [ + "$username ", + "$uuid ", + "" + ], ); } execute(context) { diff --git a/src/commands/public/echo.js b/src/commands/public/echo.js index 8c94bfc..f2e2992 100644 --- a/src/commands/public/echo.js +++ b/src/commands/public/echo.js @@ -1,16 +1,17 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class echo extends CommandContext { constructor() { super( "echo", - ["say", "botsay"], + [ + "say", + "botsay" + ], "make me say something!", trustLevel.public, [""], - true, ); } diff --git a/src/commands/public/extras.js b/src/commands/public/extras.js index de27ef2..024fc36 100644 --- a/src/commands/public/extras.js +++ b/src/commands/public/extras.js @@ -1,6 +1,5 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class extras extends CommandContext { constructor() { @@ -9,8 +8,12 @@ class extras extends CommandContext { [], "send messages via the extras channel", trustLevel.public, - ["send", "register", "unregister", "unregisterall"], - true, + [ + "send", + "register", + "unregister", + "unregisterall" + ], ); } execute(context) { diff --git a/src/commands/public/help.js b/src/commands/public/help.js index a5d65fa..662b758 100644 --- a/src/commands/public/help.js +++ b/src/commands/public/help.js @@ -1,17 +1,20 @@ -const fixansi = require("../../util/ansi"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require('../../command_util/command_trust_level') -const trustLevel = new CommandTrustLevel() +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class help extends CommandContext { constructor() { super( "help", - ["heko", "?", "cmds", "commands", "hell"], + [ + "heko", + "?", + "cmds", + "commands", + "hell" + ], "see a list of commands", trustLevel.public, [""], - false ); } diff --git a/src/commands/public/info.js b/src/commands/public/info.js index b5ec0bb..4b4d65f 100644 --- a/src/commands/public/info.js +++ b/src/commands/public/info.js @@ -1,10 +1,9 @@ const os = require("os"); -const CommandError = require("../../command_util/command_error"); +const CommandError = require("../../commandUtil/CommandError"); const botInfo = require("../../data/info.json"); const { execSync } = require("child_process"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); function format(seconds) { function pad(s) { @@ -40,7 +39,6 @@ class info extends CommandContext { "server", "version/", ], - false, ); } diff --git a/src/commands/public/list.js b/src/commands/public/list.js index 069488e..d5dce4d 100644 --- a/src/commands/public/list.js +++ b/src/commands/public/list.js @@ -1,14 +1,17 @@ -const CommandError = require("../../command_util/command_error"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class list extends CommandContext { constructor() { - super("list", ["pl", "playerlist"], "check whos online on the server", trustLevel.public, [ - "", - ], - false, + super( + "list", + [ + "pl", + "playerlist" + ], + "check whos online on the server", + trustLevel.public, + [""], ); } execute(context) { diff --git a/src/commands/public/mcserver.js b/src/commands/public/mcserver.js index a85c630..44b6b14 100644 --- a/src/commands/public/mcserver.js +++ b/src/commands/public/mcserver.js @@ -1,12 +1,15 @@ const mc = require("minecraft-protocol"); -const util = require("util"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class mcserver extends CommandContext { constructor() { - super("mcserver", ["pingserver"], "pings minecraft servers", trustLevel.public, [""], false); + super("mcserver", + ["pingserver"], + "pings minecraft servers", + trustLevel.public, + [""], + ); } async execute(context) { diff --git a/src/commands/public/refillcore.js b/src/commands/public/refillcore.js index ea85f6e..0b31dae 100644 --- a/src/commands/public/refillcore.js +++ b/src/commands/public/refillcore.js @@ -1,16 +1,17 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class refillcore extends CommandContext { constructor() { super( "rc", - ["refill", "refillcore"], + [ + "refill", + "refillcore" + ], "refill the bots core", trustLevel.public, [""], - false, ); } diff --git a/src/commands/public/test.js b/src/commands/public/test.js index 3a1ed82..8f17ca4 100644 --- a/src/commands/public/test.js +++ b/src/commands/public/test.js @@ -1,7 +1,5 @@ -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'); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class test extends CommandContext { constructor() { @@ -11,8 +9,6 @@ class test extends CommandContext { "testing stuff", trustLevel.public, [""], - false, - 1 ); } @@ -20,7 +16,7 @@ class test extends CommandContext { const bot = context.bot; const args = context.arguments; const source = context.source; - source.sendFeedback(CommandArguments.getMaxArguments(this.data.maxArgs, args.join(' '))) + } } diff --git a/src/commands/public/weather.js b/src/commands/public/weather.js index 2a4e329..a257f01 100644 --- a/src/commands/public/weather.js +++ b/src/commands/public/weather.js @@ -1,15 +1,15 @@ -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(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class weather extends CommandContext { constructor() { - super("weather", [], "check the weather in locations", trustLevel.public, [ - "", - ], - false + super( + "weather", + [], + "check the weather in locations", + trustLevel.public, + [""], ); } async execute(context) { diff --git a/src/commands/trusted/auth.js b/src/commands/trusted/auth.js index 73e6efe..52e4c68 100644 --- a/src/commands/trusted/auth.js +++ b/src/commands/trusted/auth.js @@ -1,7 +1,5 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const CommandError = require("../../command_util/command_error"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class auth extends CommandContext { constructor() { @@ -11,7 +9,6 @@ class auth extends CommandContext { "auth through the bot so you dont need to use a hash everytime", trustLevel.trusted, [""], - true, ); } execute(context) { diff --git a/src/commands/trusted/cloop.js b/src/commands/trusted/cloop.js index 6657905..2889693 100644 --- a/src/commands/trusted/cloop.js +++ b/src/commands/trusted/cloop.js @@ -1,18 +1,23 @@ -const CommandError = require("../../command_util/command_error"); -const fixAnsi = require("../../util/ansi"); -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandError = require("../../commandUtil/CommandError"); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class cloop extends CommandContext { constructor() { super( "cloop", - ["commandloop", "loop"], + [ + "commandloop", + "loop" + ], "loops commands", trustLevel.trusted, - ["add ", "remove ", "list", "clear"], - true, + [ + "add ", + "remove ", + "list", + "clear" + ], ); } execute(context) { diff --git a/src/commands/trusted/reconnect.js b/src/commands/trusted/reconnect.js index c8bc693..196a132 100644 --- a/src/commands/trusted/reconnect.js +++ b/src/commands/trusted/reconnect.js @@ -1,6 +1,5 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class reconnect extends CommandContext { constructor() { @@ -10,7 +9,6 @@ class reconnect extends CommandContext { "reconnect the bot", trustLevel.trusted, [""], - true, ); } execute(context) { diff --git a/src/commands/trusted/validate.js b/src/commands/trusted/validate.js index 8c76560..44c8d1c 100644 --- a/src/commands/trusted/validate.js +++ b/src/commands/trusted/validate.js @@ -1,6 +1,5 @@ -const CommandContext = require("../../command_util/command_context"); -const CommandTrustLevel = require("../../command_util/command_trust_level"); -const trustLevel = new CommandTrustLevel(); +const CommandContext = require("../../commandUtil/CommandContext"); +const trustLevel = require("../../commandUtil/CommandTrustLevel"); class validate extends CommandContext { constructor() { @@ -10,7 +9,6 @@ class validate extends CommandContext { "validate through the bot", trustLevel.trusted, [""], - true, ); } execute(context) { diff --git a/src/data/translations.json b/src/data/translations.json index 319b6ef..cb7e7e2 100644 --- a/src/data/translations.json +++ b/src/data/translations.json @@ -104,12 +104,12 @@ "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.command_manager.trust_level.console_only": "This command can only be ran via console!", + "fnfboyfriendbot.command_manager.validation.invalid_admin_hash": "Invalid Admin Hash", + "fnfboyfriendbot.command_manager.validation.invalid_hash": "Invalid Hash", + "fnfboyfriendbot.command_manager.validation.invalid_owner_hash": "Invalid Owner Hash", + "fnfboyfriendbot.command_manager.validation.invalid_trusted_hash": "Invalid Trusted Hash", + "fnfboyfriendbot.command_manager.validation.invalid_role": "Invalid Role", "fnfboyfriendbot.reconnect.stop_logging": "stopped logging disconnect messages for now" diff --git a/src/discord/directMessages.js b/src/discord/directMessages.js index 7858bf7..b36d869 100644 --- a/src/discord/directMessages.js +++ b/src/discord/directMessages.js @@ -20,18 +20,6 @@ class directMessages { 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") { - - } } }); } diff --git a/src/index.js b/src/index.js index a1674fb..90093ec 100644 --- a/src/index.js +++ b/src/index.js @@ -16,7 +16,7 @@ const discordClient = new Client({ ], partials: [Partials.Channel], }); -const CommandSource = require("./command_util/command_source"); +const CommandSource = require("./commandUtil/CommandSource"); console.log("Starting FNFBoyfriendBot"); diff --git a/src/modules/chat.js b/src/modules/chat.js index 260ad16..03ee7a1 100644 --- a/src/modules/chat.js +++ b/src/modules/chat.js @@ -1,9 +1,9 @@ const loadPrismarineChat = require("prismarine-chat"); -const KaboomChatParser = require("../chat_parsers/kaboom"); -const CreayunChatParser = require("../chat_parsers/creayun"); -const ChipmunkModChatParser = require("../chat_parsers/chipmunkmod"); -const VanilaChatParser = require("../chat_parsers/vanilla"); -const convertNbtComponentToJson = require("../util/nbt_parser"); +const KaboomChatParser = require("../chatParsers/kaboom"); +const CreayunChatParser = require("../chatParsers/creayun"); +const ChipmunkModChatParser = require("../chatParsers/chipmunkmod"); +const VanilaChatParser = require("../chatParsers/vanilla"); +const convertNbtComponentToJson = require("../util/convertNbtComponentToJson"); function tryParse(json) { try { diff --git a/src/modules/command_core.js b/src/modules/commandCore.js similarity index 97% rename from src/modules/command_core.js rename to src/modules/commandCore.js index ca2f45f..1930401 100644 --- a/src/modules/command_core.js +++ b/src/modules/commandCore.js @@ -1,8 +1,7 @@ -const nbt = require("prismarine-nbt"); const sleep = require("../util/sleep"); -const convertNbtComponentToJson = require("../util/nbt_parser"); +const convertNbtComponentToJson = require("../util/convertNbtComponentToJson"); -class command_core { +class commandCore { constructor(context) { const bot = context.bot; const config = context.config; @@ -243,4 +242,4 @@ class command_core { }); } } -module.exports = command_core; +module.exports = commandCore; diff --git a/src/modules/command_handler.js b/src/modules/commandHandler.js similarity index 92% rename from src/modules/command_handler.js rename to src/modules/commandHandler.js index 7332e0c..13f98d1 100644 --- a/src/modules/command_handler.js +++ b/src/modules/commandHandler.js @@ -1,6 +1,6 @@ -const CommandSource = require("../command_util/command_source"); +const CommandSource = require("../commandUtil/CommandSource"); -class command_handler { +class commandHandler { constructor(context) { let ratelimit = 0; const bot = context.bot; @@ -51,4 +51,4 @@ class command_handler { }); } } -module.exports = command_handler; \ No newline at end of file +module.exports = commandHandler; \ No newline at end of file diff --git a/src/modules/command_loop.js b/src/modules/commandLoop.js similarity index 91% rename from src/modules/command_loop.js rename to src/modules/commandLoop.js index 33b0aaf..f3dd578 100644 --- a/src/modules/command_loop.js +++ b/src/modules/commandLoop.js @@ -1,4 +1,4 @@ -class command_loop { +class commandLoop { constructor(context) { const bot = context.bot; bot.cloop = { @@ -25,4 +25,4 @@ class command_loop { }; } } -module.exports = command_loop; +module.exports = commandLoop; diff --git a/src/modules/command_manager.js b/src/modules/commandManager.js similarity index 76% rename from src/modules/command_manager.js rename to src/modules/commandManager.js index e1e4374..1a2228f 100644 --- a/src/modules/command_manager.js +++ b/src/modules/commandManager.js @@ -1,8 +1,8 @@ const fs = require("fs"); const path = require("path"); -const CommandError = require("../command_util/command_error"); -const CommandSource = require("../command_util/command_source"); -const CommandArguments = require('../command_util/command_arguments') +const CommandError = require("../commandUtil/CommandError"); +const CommandSource = require("../commandUtil/CommandSource"); +const CommandArguments = require('../commandUtil/CommandArguments') const fixansi = require("../util/ansi"); const sleep = require("../util/sleep.js"); @@ -19,7 +19,7 @@ function unknownCommand(commandName, bot) { } } -class command_manager { +class commandManager { constructor(context) { const bot = context.bot; const config = context.config; @@ -40,16 +40,6 @@ class command_manager { ); } - 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; @@ -66,23 +56,11 @@ class command_manager { 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({ - translate: "fnfboyfriendbot.commandManager.validation.invalid_hash", - fallback: translations["fnfboyfriendbot.commandManager.validation.invalid_hash"], + translate: "fnfboyfriendbot.command_manager.validation.invalid_hash", + fallback: translations["fnfboyfriendbot.command_manager.validation.invalid_hash"], color: "red" }) } @@ -97,15 +75,15 @@ class command_manager { if (source.player.trustLevel < command?.data?.trustLevel) throw new CommandError({ - translate: "fnfboyfriendbot.commandManager.validation.invalid_role", - fallback: translations["fnfboyfriendbot.commandManager.validation.invalid_role"], + translate: "fnfboyfriendbot.command_manager.validation.invalid_role", + fallback: translations["fnfboyfriendbot.command_manager.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"], + translate: "fnfboyfriendbot.command_manager.trust_level.console_only", + fallback: translations["fnfboyfriendbot.command_manager.trust_level.console_only"], color: "red" }) @@ -195,4 +173,4 @@ class command_manager { } } } -module.exports = command_manager; +module.exports = commandManager; diff --git a/src/modules/command_spy.js b/src/modules/commandSpy.js similarity index 95% rename from src/modules/command_spy.js rename to src/modules/commandSpy.js index 3cf57f6..2cf15c0 100644 --- a/src/modules/command_spy.js +++ b/src/modules/commandSpy.js @@ -1,4 +1,4 @@ -class command_spy { +class commandSpy { constructor(context) { const bot = context.bot; @@ -35,4 +35,4 @@ class command_spy { } } -module.exports = command_spy; +module.exports = commandSpy; diff --git a/src/modules/console.js b/src/modules/console.js index 81eaf6e..4cd1a67 100644 --- a/src/modules/console.js +++ b/src/modules/console.js @@ -1,5 +1,5 @@ -const CommandSource = require("../command_util/command_source"); -const prismarineChat = require("prismarine-chat")("1.20.2"); +const CommandSource = require("../commandUtil/CommandSource"); +const prismarineChat = require("prismarine-chat")("1.21.8"); class Console { // named it Console so that it doesnt override the console variable diff --git a/src/modules/discord.js b/src/modules/discord.js index 1000a5b..33b5ec8 100644 --- a/src/modules/discord.js +++ b/src/modules/discord.js @@ -1,5 +1,5 @@ const fixansi = require("../util/ansi"); -const CommandSource = require("../command_util/command_source"); +const CommandSource = require("../commandUtil/CommandSource"); class discord { constructor(context) { diff --git a/src/modules/extras_messages.js b/src/modules/extrasMessages.js similarity index 96% rename from src/modules/extras_messages.js rename to src/modules/extrasMessages.js index 55fef9a..05afb2d 100644 --- a/src/modules/extras_messages.js +++ b/src/modules/extrasMessages.js @@ -1,5 +1,5 @@ const channels = "extras:register\0extras:unregister\0extras:message\0"; -class extras_message { +class extrasMessages { constructor (context) { const bot = context.bot const config = context.config @@ -60,4 +60,4 @@ class extras_message { } } -module.exports = extras_message; +module.exports = extrasMessages; diff --git a/src/modules/file_logger.js b/src/modules/fileLogger.js similarity index 97% rename from src/modules/file_logger.js rename to src/modules/fileLogger.js index 226d8d5..86cd7ea 100644 --- a/src/modules/file_logger.js +++ b/src/modules/fileLogger.js @@ -4,7 +4,7 @@ const { createGzip } = require("zlib"); const readline = require("readline"); const { Console } = require("console"); -class file_logger { +class fileLogger { constructor(context) { const bot = context.bot; const config = context.config; @@ -71,4 +71,4 @@ class file_logger { }; } } -module.exports = file_logger; +module.exports = fileLogger; diff --git a/src/modules/owner_auth.js b/src/modules/ownerAuth.js similarity index 95% rename from src/modules/owner_auth.js rename to src/modules/ownerAuth.js index 4c6a016..2b43f5c 100644 --- a/src/modules/owner_auth.js +++ b/src/modules/ownerAuth.js @@ -1,8 +1,8 @@ const sleep = require('../util/sleep'); const decryption = require('../SkiBot/decryption') -const CommandSource = require('../command_util/command_source') +const CommandSource = require('../commandUtil/CommandSource') -class owner_auth { +class ownerAuth { constructor (context) { const bot = context.bot; const config = context.config; @@ -74,4 +74,4 @@ class owner_auth { } } -module.exports = owner_auth \ No newline at end of file +module.exports = ownerAuth \ No newline at end of file diff --git a/src/modules/player_list.js b/src/modules/playerList.js similarity index 96% rename from src/modules/player_list.js rename to src/modules/playerList.js index f78f89f..6378c2f 100644 --- a/src/modules/player_list.js +++ b/src/modules/playerList.js @@ -1,6 +1,6 @@ -const convertNbtComponentToJson = require("../util/nbt_parser"); +const convertNbtComponentToJson = require("../util/convertNbtComponentToJson"); -class player_list { +class playerList { constructor(context) { const bot = context.bot; const config = context.config; @@ -105,4 +105,4 @@ class player_list { } } -module.exports = player_list; +module.exports = playerList; diff --git a/src/modules/selfcare.js b/src/modules/selfcare.js index e49c329..f13337e 100644 --- a/src/modules/selfcare.js +++ b/src/modules/selfcare.js @@ -24,7 +24,7 @@ class selfcare { }; const messageSelfcare = [ - require('../selfcare/extras/command_spy'), + require('../selfcare/extras/commandSpy'), require('../selfcare/essentials/god'), require('../selfcare/essentials/mute'), require('../selfcare/auth/login'), diff --git a/src/modules/tab_complete.js b/src/modules/tabComplete.js similarity index 91% rename from src/modules/tab_complete.js rename to src/modules/tabComplete.js index 7bb534d..c9f7376 100644 --- a/src/modules/tab_complete.js +++ b/src/modules/tabComplete.js @@ -1,4 +1,4 @@ -class tab_complete { +class tabComplete { constructor(context) { const bot = context.bot; // let aaa cook @@ -18,4 +18,4 @@ class tab_complete { }; } } -module.exports = tab_complete; +module.exports = tabComplete; diff --git a/src/selfcare/auth/login.js b/src/selfcare/auth/login.js index 84fd05b..6e85a01 100644 --- a/src/selfcare/auth/login.js +++ b/src/selfcare/auth/login.js @@ -1,4 +1,4 @@ -class loginSelfcare { +class login { constructor (context) { const bot = context.bot const options = context.options @@ -13,4 +13,4 @@ class loginSelfcare { } } -module.exports = loginSelfcare \ No newline at end of file +module.exports = login; \ No newline at end of file diff --git a/src/selfcare/auth/register.js b/src/selfcare/auth/register.js index 01c8ce0..db91b44 100644 --- a/src/selfcare/auth/register.js +++ b/src/selfcare/auth/register.js @@ -1,4 +1,4 @@ -class registerSelfcare { +class register { constructor (context) { const bot = context.bot const options = context.options @@ -14,4 +14,4 @@ class registerSelfcare { } } -module.exports = registerSelfcare \ No newline at end of file +module.exports = register; \ No newline at end of file diff --git a/src/selfcare/entity/death.js b/src/selfcare/entity/death.js index fd69dc2..1fb29a5 100644 --- a/src/selfcare/entity/death.js +++ b/src/selfcare/entity/death.js @@ -1,4 +1,4 @@ -class deathSelfcare { +class death { constructor(context) { const bot = context.bot; const config = context.config; @@ -9,4 +9,4 @@ class deathSelfcare { }) } } -module.exports = deathSelfcare \ No newline at end of file +module.exports = death \ No newline at end of file diff --git a/src/selfcare/entity/gamemode.js b/src/selfcare/entity/gamemode.js index eb1ec5f..9b62eb1 100644 --- a/src/selfcare/entity/gamemode.js +++ b/src/selfcare/entity/gamemode.js @@ -1,4 +1,4 @@ -class gamemodeSelfcare { +class gamemode { constructor(context) { const bot = context.bot; const config = context.config; @@ -15,4 +15,4 @@ class gamemodeSelfcare { } } -module.exports = gamemodeSelfcare; +module.exports = gamemode; diff --git a/src/selfcare/entity/icu.js b/src/selfcare/entity/icu.js index 435e27e..4b39c5e 100644 --- a/src/selfcare/entity/icu.js +++ b/src/selfcare/entity/icu.js @@ -1,4 +1,4 @@ -class icuSelfcare { +class icu { constructor(context) { const bot = context.bot; const config = context.config; @@ -18,4 +18,4 @@ class icuSelfcare { } } -module.exports = icuSelfcare; +module.exports = icu; diff --git a/src/selfcare/entity/op.js b/src/selfcare/entity/op.js index 79436b1..6ef7451 100644 --- a/src/selfcare/entity/op.js +++ b/src/selfcare/entity/op.js @@ -1,4 +1,4 @@ -class opSelfcare { +class op { constructor(context) { const bot = context.bot; const config = context.config; @@ -16,4 +16,4 @@ class opSelfcare { } } -module.exports = opSelfcare; +module.exports = op; \ No newline at end of file diff --git a/src/selfcare/essentials/god.js b/src/selfcare/essentials/god.js index 8e68174..307cf8d 100644 --- a/src/selfcare/essentials/god.js +++ b/src/selfcare/essentials/god.js @@ -1,4 +1,4 @@ -class godSelfcare { +class god { constructor(context) { const bot = context.bot; const options = context.options; @@ -9,4 +9,4 @@ class godSelfcare { } } -module.exports = godSelfcare; +module.exports = god; diff --git a/src/selfcare/essentials/mute.js b/src/selfcare/essentials/mute.js index 4270087..628f456 100644 --- a/src/selfcare/essentials/mute.js +++ b/src/selfcare/essentials/mute.js @@ -1,4 +1,4 @@ -class muteSelfcare { +class mute { constructor(context) { const bot = context.bot; const options = context.options; @@ -13,4 +13,4 @@ class muteSelfcare { } } -module.exports = muteSelfcare; +module.exports = mute; diff --git a/src/selfcare/essentials/nickname.js b/src/selfcare/essentials/nickname.js index f8e3626..e43dcc8 100644 --- a/src/selfcare/essentials/nickname.js +++ b/src/selfcare/essentials/nickname.js @@ -1,4 +1,4 @@ -class nicknameSelfcare { +class nickname { constructor(context) { const bot = context.bot; const options = context.options; @@ -11,4 +11,4 @@ class nicknameSelfcare { } } -module.exports = nicknameSelfcare; +module.exports = nickname; diff --git a/src/selfcare/essentials/vanish.js b/src/selfcare/essentials/vanish.js index 18f7e30..cafc315 100644 --- a/src/selfcare/essentials/vanish.js +++ b/src/selfcare/essentials/vanish.js @@ -1,4 +1,4 @@ -class vanishSelfcare { +class vanish { constructor(context) { const bot = context.bot; const options = context.options; @@ -11,4 +11,4 @@ class vanishSelfcare { } } -module.exports = vanishSelfcare; +module.exports = vanish; diff --git a/src/selfcare/extras/command_spy.js b/src/selfcare/extras/commandSpy.js similarity index 89% rename from src/selfcare/extras/command_spy.js rename to src/selfcare/extras/commandSpy.js index 314d4f1..a3d5f1e 100644 --- a/src/selfcare/extras/command_spy.js +++ b/src/selfcare/extras/commandSpy.js @@ -1,4 +1,4 @@ -class commandSpySelfcare { +class commandSpy { constructor(context) { const bot = context.bot; const stringMessage = context.stringMessage; @@ -14,4 +14,4 @@ class commandSpySelfcare { } } -module.exports = commandSpySelfcare; +module.exports = commandSpy; diff --git a/src/selfcare/extras/prefix.js b/src/selfcare/extras/prefix.js index 2455583..0bd0073 100644 --- a/src/selfcare/extras/prefix.js +++ b/src/selfcare/extras/prefix.js @@ -1,6 +1,4 @@ -const player_list = require("../../modules/player_list"); - -class prefixSelfcare { +class prefix { constructor(context) { const bot = context.bot; const options = context.options; @@ -20,4 +18,4 @@ class prefixSelfcare { } } -module.exports = prefixSelfcare; +module.exports = prefix; diff --git a/src/selfcare/extras/username.js b/src/selfcare/extras/username.js index ed2d7bd..52bd908 100644 --- a/src/selfcare/extras/username.js +++ b/src/selfcare/extras/username.js @@ -1,4 +1,4 @@ -class usernameSelfcare { +class username { constructor(context) { const bot = context.bot; const options = context.options; @@ -13,4 +13,4 @@ class usernameSelfcare { } } -module.exports = usernameSelfcare; +module.exports = username; diff --git a/src/util/37dnvz77.png b/src/util/37dnvz77.png deleted file mode 100644 index fe20a3a..0000000 Binary files a/src/util/37dnvz77.png and /dev/null differ diff --git a/src/util/nbt_parser.js b/src/util/convertNbtComponentToJson.js similarity index 100% rename from src/util/nbt_parser.js rename to src/util/convertNbtComponentToJson.js diff --git a/src/util/jsuotgpq.png b/src/util/jsuotgpq.png deleted file mode 100644 index 5b2a0b3..0000000 Binary files a/src/util/jsuotgpq.png and /dev/null differ