From 314cfc9f85f38c8eeba8195d6de59b46110f6455 Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 Date: Sun, 25 Aug 2024 22:26:03 -0400 Subject: [PATCH] Lint --- commands/about.js | 16 ++++++++-------- commands/cloop.js | 2 +- commands/netmsg.js | 12 ++++++------ commands/settings.js | 2 +- commands/test.js | 2 +- index.js | 10 +++++----- plugins/command.js | 2 +- util/chatparse_console.js | 2 +- util/lang.js | 4 ++-- util/usergen.js | 8 ++++---- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/commands/about.js b/commands/about.js index c4f5610..34e2e68 100644 --- a/commands/about.js +++ b/commands/about.js @@ -112,7 +112,7 @@ const aboutServer = function (c) { text: thisItem, color: c.colors.primary, clickEvent: { - action: "copy_to_clipboard", + action: 'copy_to_clipboard', value: thisItem }, hoverEvent: { @@ -201,10 +201,10 @@ const aboutServer = function (c) { } const displayServerList = function (c) { - index.bot.forEach((item, i)=>{ + index.bot.forEach((item, i) => { if (item.host.options && item.host.options.hidden && c.verify !== 3 && c.bot.id !== i) return - let message = 'command.about.serverListItem'; - if(c.bot.id == i) message = 'command.about.serverListItem.thisServer' + let message = 'command.about.serverListItem' + if (c.bot.id == i) message = 'command.about.serverListItem.thisServer' c.reply({ translate: getMessage(c.lang, message), color: c.colors.secondary, @@ -217,7 +217,7 @@ const displayServerList = function (c) { text: `${item.host.host}:${item.host.port}`, color: c.colors.primary, clickEvent: { - action: "copy_to_clipboard", + action: 'copy_to_clipboard', value: `${item.host.host}:${item.host.port}` }, hoverEvent: { @@ -240,9 +240,9 @@ const displayServerList = function (c) { module.exports = { execute: function (c) { let subcmd = c.args[0] - if(subcmd === "servers") subcmd = "serverlist" - if(c.cmdName === "serverinfo") subcmd = "server" - if(c.cmdName === "serverlist" || c.cmdName === "servers") subcmd = "serverlist" + if (subcmd === 'servers') subcmd = 'serverlist' + if (c.cmdName === 'serverinfo') subcmd = 'server' + if (c.cmdName === 'serverlist' || c.cmdName === 'servers') subcmd = 'serverlist' if (subcmd === 'server') { aboutServer(c) } else if (subcmd === 'serverlist') { diff --git a/commands/cloop.js b/commands/cloop.js index b09254e..ef35b0c 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -44,7 +44,7 @@ module.exports = { break } case 'list': - c.bot.cloops.forEach((item, i)=>{ + c.bot.cloops.forEach((item, i) => { c.reply({ translate: getMessage(c.lang, 'command.cloop.list'), color: c.colors.secondary, diff --git a/commands/netmsg.js b/commands/netmsg.js index 7045f2c..8f40157 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -4,9 +4,9 @@ module.exports = { execute: (c) => { let host = c.host let port = c.port - if(c.bot.host.options && c.bot.host.options.hidden){ - host = "localhost" // Makes hidden servers appear as localhost - port = "25565" + if (c.bot.host.options && c.bot.host.options.hidden) { + host = 'localhost' // Makes hidden servers appear as localhost + port = '25565' } const json = { translate: '[%s] %s: %s', @@ -14,12 +14,12 @@ module.exports = { { text: c.serverName, hoverEvent: { - action: "show_text", + action: 'show_text', value: { translate: '%s: %s:%s', with: [ { - text: getMessage(c.lang, "command.netmsg.serverAddress"), + text: getMessage(c.lang, 'command.netmsg.serverAddress'), color: c.colors.primary }, { @@ -47,7 +47,7 @@ module.exports = { color: 'white' } bot.forEach(item => { - if(item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== "console") return + if (item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== 'console') return item.tellraw('@a', json) }) } diff --git a/commands/settings.js b/commands/settings.js index 550a3ab..ddbf335 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -2,7 +2,7 @@ const { languages, getMessage } = require('../util/lang.js') const fs = require('fs') module.exports = { execute: (c) => { - if(c.type == "console"){ + if (c.type == 'console') { c.reply({ text: getMessage(c.lang, 'command.settings.disabled.console'), color: c.colors.secondary diff --git a/commands/test.js b/commands/test.js index 28d6d6c..4b716b6 100644 --- a/commands/test.js +++ b/commands/test.js @@ -14,7 +14,7 @@ module.exports = { text: item, color: c.colors.primary, clickEvent: { - action: "copy_to_clipboard", + action: 'copy_to_clipboard', value: item }, hoverEvent: { diff --git a/index.js b/index.js index d6d9005..ce936a3 100755 --- a/index.js +++ b/index.js @@ -1,14 +1,14 @@ const fs = require('fs') if (!fs.readdirSync('.').includes('settings.json')) { - console.log("Settings file is missing, using defaults.") - fs.copyFileSync("settings_example.json", "settings.json") + console.log('Settings file is missing, using defaults.') + fs.copyFileSync('settings_example.json', 'settings.json') } if (!fs.readdirSync('.').includes('secret.json')) { - console.log("Secrets file is missing, using defaults.") - fs.copyFileSync("secret_example.json", "secret.json") - console.log("Please change the hashing keys in the secrets file.") + console.log('Secrets file is missing, using defaults.') + fs.copyFileSync('secret_example.json', 'secret.json') + console.log('Please change the hashing keys in the secrets file.') } const m = require('minecraft-protocol') diff --git a/plugins/command.js b/plugins/command.js index c94ed67..54a7bbf 100755 --- a/plugins/command.js +++ b/plugins/command.js @@ -18,7 +18,7 @@ module.exports = { load: (b) => { b.prefix = settings.prefix b.lastCmd = 0 - b.on("chat",(data)=>{ + b.on('chat', (data) => { const fullCommand = data.message for (const prefix of b.prefix) { if (fullCommand.startsWith(prefix)) { diff --git a/util/chatparse_console.js b/util/chatparse_console.js index cc21fd4..4cbc6dc 100644 --- a/util/chatparse_console.js +++ b/util/chatparse_console.js @@ -75,7 +75,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) { if (lang[trans] !== undefined) { trans = lang[trans].replace(/%%/g, '\ue123') } - if(data.with){ + if (data.with) { data.with.forEach((item, i) => { const j2 = parse(item, l + 1, data.color ? processColor(data.color, resetColor) : resetColor) trans = trans.replace(/%s/, j2.replaceAll('%s', '\ud900\ud804').replaceAll('$s', '\ud900\ud805')) diff --git a/util/lang.js b/util/lang.js index c212973..44ce2f3 100644 --- a/util/lang.js +++ b/util/lang.js @@ -21,8 +21,8 @@ const getMessage = function (l, msg, with2) { } else if (languages['en-US'] && languages['en-US'][message] !== undefined) { message = languages['en-US'][message].replace(/%%/g, '\ue123') } - if (with2){ - with2.forEach((withItem, i)=>{ + if (with2) { + with2.forEach((withItem, i) => { message = message.replace(/%s/, withItem.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) message = message.replaceAll(`%${+i + 1}$s`, withItem.replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) }) diff --git a/util/usergen.js b/util/usergen.js index cf2f9e9..394c8e3 100644 --- a/util/usergen.js +++ b/util/usergen.js @@ -32,12 +32,12 @@ const rsg = function (count) { } const rsgLegal = function (count) { let output = '' - if(Math.random()>0.5){ - output += "uwu_" + if (Math.random() > 0.5) { + output += 'uwu_' } else { - output += "owo_" + output += 'owo_' } - output += crypto.randomBytes(count).toString("hex") + output += crypto.randomBytes(count).toString('hex') return output } module.exports = function (legal) {