From e6455a25fc9a194a9fce37da319211221ed88817 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Mon, 7 Nov 2022 19:26:38 +0700 Subject: [PATCH] " === " not "===" --- commands/ayunsudo.js | 4 ++-- commands/botvisibility.js | 12 ++++++------ commands/clearchat.js | 4 ++-- commands/cloop.js | 24 ++++++++++++------------ commands/cowsay.js | 4 ++-- commands/crashserver.js | 4 ++-- commands/eaglercrash.js | 10 +++++----- commands/end.js | 4 ++-- commands/entity.js | 2 +- commands/eval.js | 14 +++++++------- commands/executebypass.js | 2 +- commands/gamemodeall.js | 2 +- commands/help.js | 14 +++++++------- commands/music.js | 34 +++++++++++++++++----------------- commands/servereval.js | 2 +- commands/time.js | 8 ++++---- commands/tpall.js | 2 +- commands/validate.js | 4 ++-- index.js | 36 ++++++++++++++++++------------------ plugins/bruhify.js | 2 +- plugins/chat.js | 10 +++++----- plugins/core.js | 6 +++--- plugins/players.js | 2 +- plugins/self_care.js | 10 +++++----- util/text_parser.js | 6 +++--- 25 files changed, 111 insertions(+), 111 deletions(-) diff --git a/commands/ayunsudo.js b/commands/ayunsudo.js index 3361e80..8d7874c 100644 --- a/commands/ayunsudo.js +++ b/commands/ayunsudo.js @@ -6,14 +6,14 @@ module.exports = { trusted: 1, usage: ' ', execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`); } else { throw new Error('Invalid hash'); } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { + if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { bot.core.run(`essentials:sudo * ${args.join(' ')}`); } else { throw new Error('You\'re not in the trusted role!'); diff --git a/commands/botvisibility.js b/commands/botvisibility.js index 5f14ea3..63e21d5 100644 --- a/commands/botvisibility.js +++ b/commands/botvisibility.js @@ -7,12 +7,12 @@ module.exports = { usage: ' ', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { - if (args[1]==='true') { + if (args[0] === bot.hash) { + if (args[1] === 'true') { bot.visibility = true; bot.chat('/essentials:vanish disable'); bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]); - } else if (args[1]==='false') { + } else if (args[1] === 'false') { bot.visibility = false; bot.chat('/essentials:vanish enable'); bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]); @@ -24,8 +24,8 @@ module.exports = { } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { - if (args[0]==='true') { + if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { + if (args[0] === 'true') { bot.visibility = true; bot.chat('/essentials:vanish disable'); const Embed = new MessageEmbed() @@ -33,7 +33,7 @@ module.exports = { .setTitle('Bot\'s Visibility') .setDescription('The bot\'s visibility is now visible'); channeldc.send({embeds: [Embed]}); - } else if (args[0]==='false') { + } else if (args[0] === 'false') { bot.visibility = false; bot.chat('/essentials:vanish enable'); const Embed = new MessageEmbed() diff --git a/commands/clearchat.js b/commands/clearchat.js index 565d21f..de0e4e3 100644 --- a/commands/clearchat.js +++ b/commands/clearchat.js @@ -7,7 +7,7 @@ module.exports = { usage: '[specific] ', trusted: 0, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]==='specific') { + if (args[0] === 'specific') { bot.tellraw(args[1], [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: `Your chat has been cleared by ${username}.`, color: 'dark_green'}]); return; } else { @@ -15,7 +15,7 @@ module.exports = { } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (args[0]==='specific') { + if (args[0] === 'specific') { bot.tellraw(args[1], [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green'}]); return; } else { diff --git a/commands/cloop.js b/commands/cloop.js index 509564c..6a8b561 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -63,8 +63,8 @@ module.exports = { execute: function(bot, username, usernameraw, sender, prefix, args) { if (!bot.cloops) bot.cloops = []; - if (args[1]==='add') { - if (args[0]===bot.hash) { + if (args[1] === 'add') { + if (args[0] === bot.hash) { if (args[3]) { if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval'); add(args.slice(3).join(' '), args[2], bot); @@ -75,16 +75,16 @@ module.exports = { } return; } - if (args[1]==='list') { - if (args[0]===bot.hash) { + if (args[1] === 'list') { + if (args[0] === bot.hash) { list(bot); } else { throw new Error('Invalid hash'); } return; } - if (args[1]==='remove') { - if (args[0]===bot.hash) { + if (args[1] === 'remove') { + if (args[0] === bot.hash) { remove(args[2]); bot.tellraw('@a', ['', {text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]); } else { @@ -92,8 +92,8 @@ module.exports = { } return; } - if (args[1]==='removeall') { - if (args[0]===bot.hash) { + if (args[1] === 'removeall') { + if (args[0] === bot.hash) { clear(); bot.tellraw('@a', ['', {text: 'Removed all looped commands', color: 'white'}]); } else { @@ -105,7 +105,7 @@ module.exports = { discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { if (!bot.cloops) bot.cloops = []; - if (args[0]==='add') { + if (args[0] === 'add') { if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { if (args[2]) { if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval'); @@ -121,7 +121,7 @@ module.exports = { } return; } - if (args[0]==='list') { + if (args[0] === 'list') { if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { list(bot, true, channeldc); } else { @@ -129,7 +129,7 @@ module.exports = { } return; } - if (args[0]==='remove') { + if (args[0] === 'remove') { if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { remove(args[1]); const Embed = new MessageEmbed() @@ -142,7 +142,7 @@ module.exports = { } return; } - if (args[0]==='removeall') { + if (args[0] === 'removeall') { if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { clear(); const Embed = new MessageEmbed() diff --git a/commands/cowsay.js b/commands/cowsay.js index dcecfe7..a2a3926 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -15,9 +15,9 @@ module.exports = { let message = ''; Object.keys(cows).forEach((value) => { - if (color==='§6') { + if (color === '§6') { color = '§e'; - } else if (color==='§e') { + } else if (color === '§e') { color = '§6'; }; message += color + value + ' '; diff --git a/commands/crashserver.js b/commands/crashserver.js index 415a40a..a60ac57 100644 --- a/commands/crashserver.js +++ b/commands/crashserver.js @@ -16,14 +16,14 @@ module.exports = { usage: '', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + if (args[0] === bot.hash) { crash(bot); } else { throw new Error('Invalid hash'); } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { + if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { crash(bot); } else { throw new Error('You\'re not in the trusted role!'); diff --git a/commands/eaglercrash.js b/commands/eaglercrash.js index 95706bd..bf890e6 100644 --- a/commands/eaglercrash.js +++ b/commands/eaglercrash.js @@ -6,19 +6,19 @@ module.exports = { usage: ' ', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[1]==='on') { - if (args[0]===bot.hash) { + if (args[1] === 'on') { + if (args[0] === bot.hash) { bot.eaglercrashstarted = true; bot.eaglercrash = setInterval(async function() { - if (bot.eaglercrashstarted===true) return bot.core.run('minecraft:playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0'); + if (bot.eaglercrashstarted === true) return bot.core.run('minecraft:playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0'); }, 0); bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash started","color":"white"}]'); } else { throw new Error('Invalid hash'); } } - if (args[1]==='off') { - if (args[0]===bot.hash) { + if (args[1] === 'off') { + if (args[0] === bot.hash) { clearInterval(bot.eaglercrash); bot.eaglercrashstarted = false; bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash stopped","color":"white"}]'); diff --git a/commands/end.js b/commands/end.js index e9e0bfa..865d474 100644 --- a/commands/end.js +++ b/commands/end.js @@ -6,14 +6,14 @@ module.exports = { usage: '', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.end('end command'); } else { throw new Error('Invalid hash'); } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { + if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { bot.end('end command'); } else { throw new Error('You\'re not in the trusted role!'); diff --git a/commands/entity.js b/commands/entity.js index 73f917c..3f7e804 100644 --- a/commands/entity.js +++ b/commands/entity.js @@ -16,7 +16,7 @@ module.exports = { // if (!args[1]) { // bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon minecraft:' + entity.name); // bot.tellraw('@a', ['', {text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]); - // } else if (args[1]==='specific' && args[2]) { + // } else if (args[1] === 'specific' && args[2]) { // bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon minecraft:' + entity.name); // bot.tellraw('@a', ['', {text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]); // } diff --git a/commands/eval.js b/commands/eval.js index 3b81c08..214436d 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -12,17 +12,17 @@ module.exports = { trusted: 0, usage: ' ', execute: function(bot, username, usernameraw, sender, prefix, args, config) { - if (args[0]==='run') { + if (args[0] === 'run') { try { bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}); } catch (err) { bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'}); } } - if (args[0]==='reset') { + if (args[0] === 'reset') { bot.vm = new VM(bot.vmoptions); } - if (args[0]==='server') { + if (args[0] === 'server') { axios .post(config.eval.serverUrl, querystring.stringify({ html: false, @@ -35,7 +35,7 @@ module.exports = { bot.tellraw('@a', {text: `${err}`, color: 'red'}); }); } - // if (args[0]==='dineval') { + // if (args[0] === 'dineval') { // axios // .get('https://eval.dinhero21.repl.co', { // headers: { @@ -50,7 +50,7 @@ module.exports = { // } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message, config) { - if (args[0]==='run') { + if (args[0] === 'run') { try { const Embed = new MessageEmbed() .setColor('#FFFF00') @@ -61,10 +61,10 @@ module.exports = { throw err; } } - if (args[0]==='reset') { + if (args[0] === 'reset') { bot.vm = new VM(bot.vmoptions); } - if (args[0]==='server') { + if (args[0] === 'server') { axios .post(config.eval.serverUrl, querystring.stringify({ html: false, diff --git a/commands/executebypass.js b/commands/executebypass.js index e348480..5d432f6 100644 --- a/commands/executebypass.js +++ b/commands/executebypass.js @@ -6,7 +6,7 @@ module.exports = { usage: ' ', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' ')); } else { throw new Error('Invalid hash'); diff --git a/commands/gamemodeall.js b/commands/gamemodeall.js index 483d203..0037214 100644 --- a/commands/gamemodeall.js +++ b/commands/gamemodeall.js @@ -6,7 +6,7 @@ module.exports = { usage: ' ', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`); } else { throw new Error('Invalid hash'); diff --git a/commands/help.js b/commands/help.js index b87c2a9..eaa932a 100644 --- a/commands/help.js +++ b/commands/help.js @@ -28,7 +28,7 @@ module.exports = { function m() { let discordSupported; let alias = command.name; - if (typeof command.discordExecute==='undefined') { + if (typeof command.discordExecute === 'undefined') { discordSupported = 'false'; } else { discordSupported = 'true'; @@ -42,9 +42,9 @@ module.exports = { bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ' ' + command.usage, color: 'aqua'}]); } - if (command.name === args[0]) m(); + if (command.name === args[0]) m(); for (const alias of command.alias) { - if (alias === args[0]) m(); + if (alias === args[0]) m(); } }; } else { @@ -58,7 +58,7 @@ module.exports = { function m() { let discordSupported; let alias = command.name; - if (typeof command.discordExecute==='undefined') { + if (typeof command.discordExecute === 'undefined') { discordSupported = 'false'; } else { discordSupported = 'true'; @@ -76,16 +76,16 @@ module.exports = { channeldc.send({embeds: [Embed]}); } - if (command.name === args[0]) m(); + if (command.name === args[0]) m(); for (const alias of command.alias) { - if (alias === args[0]) m(); + if (alias === args[0]) m(); } }; } else { let supportedCommands = ''; let unsupportedCommands = ''; for (const command of bot.command_handler.commands) { - if (typeof command.discordExecute==='undefined') continue; + if (typeof command.discordExecute === 'undefined') continue; supportedCommands += command.name + ' '; } for (const command of bot.command_handler.commands) { diff --git a/commands/music.js b/commands/music.js index 7ef0609..1e76cfe 100644 --- a/commands/music.js +++ b/commands/music.js @@ -9,7 +9,7 @@ const os = require('os'); let SONGS_PATH; -if (os.hostname()==='chomens-kubuntu') { +if (os.hostname() === 'chomens-kubuntu') { SONGS_PATH = path.join(__dirname, '..', '..', 'nginx-html', 'midis'); } else { SONGS_PATH = path.join(__dirname, '..', 'midis'); @@ -102,9 +102,9 @@ async function list(bot, discord, channeldc) { const message = []; listed.forEach((value) => { - if (color==='gold') { + if (color === 'gold') { color = 'yellow'; - } else if (color==='yellow') { + } else if (color === 'yellow') { color = 'gold'; }; message.push({text: value + ' ', @@ -134,13 +134,13 @@ module.exports = { trusted: 0, usage: ' ', execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]==='play') { + if (args[0] === 'play') { play(bot, args.slice(1)); } - if (args[0]==='playurl') { + if (args[0] === 'playurl') { playUrl(bot, args.slice(1)); } - if (args[0]==='stop') { + if (args[0] === 'stop') { try { bot.tellraw('@a', {text: 'Cleared the song queue'}); } catch (e) { @@ -148,7 +148,7 @@ module.exports = { } bot.music.stop(); } - if (args[0]==='skip') { + if (args[0] === 'skip') { try { bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]); bot.music.skip(); @@ -156,7 +156,7 @@ module.exports = { throw new Error('No music is currently playing!'); } } - if (args[0]==='loop') { + if (args[0] === 'loop') { if (args[1] === 'off') { bot.music.loop = 0; bot.tellraw('@a', [{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]); @@ -170,21 +170,21 @@ module.exports = { bot.tellraw('@a', {text: 'Now looping every song in the queue'}); } } - if (args[0]==='list') { + if (args[0] === 'list') { list(bot); } - if (args[0]==='nowplaying') { + if (args[0] === 'nowplaying') { bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]); } }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { - if (args[0]==='play') { + if (args[0] === 'play') { play(bot, args.slice(1), true, channeldc); } - if (args[0]==='playurl') { + if (args[0] === 'playurl') { playUrl(bot, args.slice(1), true, channeldc); } - if (args[0]==='stop') { + if (args[0] === 'stop') { try { const Embed = new MessageEmbed() .setColor('#FFFF00') @@ -196,7 +196,7 @@ module.exports = { } bot.music.stop(); } - if (args[0]==='skip') { + if (args[0] === 'skip') { try { const Embed = new MessageEmbed() .setColor('#FFFF00') @@ -208,7 +208,7 @@ module.exports = { throw new Error('No music is currently playing!'); } } - if (args[0]==='loop') { + if (args[0] === 'loop') { if (args[1] === 'off') { bot.music.loop = 0; const Embed = new MessageEmbed() @@ -234,10 +234,10 @@ module.exports = { channeldc.send({embeds: [Embed]}); } } - if (args[0]==='list') { + if (args[0] === 'list') { list(bot, true, channeldc); } - if (args[0]==='nowplaying') { + if (args[0] === 'nowplaying') { const Embed = new MessageEmbed() .setColor('#FFFF00') .setTitle('Now playing') diff --git a/commands/servereval.js b/commands/servereval.js index 2eb56ff..c1d6b67 100644 --- a/commands/servereval.js +++ b/commands/servereval.js @@ -8,7 +8,7 @@ module.exports = { trusted: 2, usage: ' ', execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.ownerHash) { + if (args[0] === bot.ownerHash) { try { bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}); } catch (err) { diff --git a/commands/time.js b/commands/time.js index 4ad0dc1..ea5e56a 100644 --- a/commands/time.js +++ b/commands/time.js @@ -11,10 +11,10 @@ module.exports = { const timezone = args.join(' '); const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A'); const command = 'minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The current date and time for the timezone ', color: 'white'}, {text: timezone, color: 'aqua'}, {text: ' is: ', color: 'white'}, {text: `${momented}`, color: 'green'}]); - if (timezone.toLowerCase()==='asia/bangkok' || timezone.toLowerCase()==='utc') { + if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') { bot.core.run(command); return; - } else if (momented===moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { + } else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { throw new SyntaxError('Invalid timezone'); } else { bot.core.run(command); @@ -24,14 +24,14 @@ module.exports = { const timezone = args.join(' '); const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A'); const description = `The current date and time for the timezone ${timezone} is: ${momented}`; - if (timezone.toLowerCase()==='asia/bangkok' || timezone.toLowerCase()==='utc') { + if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') { const Embed = new MessageEmbed() .setColor('#FFFF00') .setTitle('Time') .setDescription(description); channeldc.send({embeds: [Embed]}); return; - } else if (momented===moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { + } else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { throw new SyntaxError('Invalid timezone'); } else { const Embed = new MessageEmbed() diff --git a/commands/tpall.js b/commands/tpall.js index fcc4909..4f334cb 100644 --- a/commands/tpall.js +++ b/commands/tpall.js @@ -6,7 +6,7 @@ module.exports = { usage: ' ', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`); } else { throw new Error('Invalid hash'); diff --git a/commands/validate.js b/commands/validate.js index 5d04a89..5324635 100644 --- a/commands/validate.js +++ b/commands/validate.js @@ -6,9 +6,9 @@ module.exports = { usage: '', trusted: 1, execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0]===bot.hash) { + if (args[0] === bot.hash) { bot.tellraw('@a', {text: 'Valid hash', color: 'green'}); - } else if (args[0]===bot.ownerHash) { + } else if (args[0] === bot.ownerHash) { bot.tellraw('@a', {text: 'Valid OwnerHash', color: 'green'}); } else { bot.tellraw('@a', {text: 'Invalid hash', color: 'red'}); diff --git a/index.js b/index.js index 572b7f8..8046dc8 100644 --- a/index.js +++ b/index.js @@ -122,7 +122,7 @@ function main() { // allink's chat queue chatQueue = setInterval(function() { try { - if (bot.queue[0] || bot.queue[0]==='') { + if (bot.queue[0] || bot.queue[0] === '') { try { if (containsIllegalCharacters(bot.queue[0])) { bot.queue.shift(); @@ -165,7 +165,7 @@ function main() { consoleQueueInterval = setInterval(function() { if (!messageloggingEnabled) return; if (consoleQueue.length > 50) consoleQueue = []; - if (consoleQueue[0] || consoleQueue[0]==='') { + if (consoleQueue[0] || consoleQueue[0] === '') { console.log('\u001b[48:5:208m' + bot.options.host + '\u001b[0m' + ': ' + consoleQueue[0].substring(0, 10000)/* message.toAnsi() + '\u001b[0m'*/); consoleQueue.shift(); } @@ -252,15 +252,15 @@ function main() { bot.on('parsed_chat', async function(message, data) { // try catch prevents hi % exploit (it uses prismarine-chat) and json parse error try { - if (previusMessage===message.toString()) return; + if (previusMessage === message.toString()) return; previusMessage = message.toString(); const parsedMessage = JSON.parse(data.message); - if (parsedMessage.translate==='translation.test.invalid') return; + if (parsedMessage.translate === 'translation.test.invalid') return; // down here it prevents command set message - if (parsedMessage.translate==='advMode.setCommand.success') return; + if (parsedMessage.translate === 'advMode.setCommand.success') return; if (parsedMessage.extra!==undefined) { - if (parsedMessage.extra[0].text==='Command set: ') return; + if (parsedMessage.extra[0].text === 'Command set: ') return; } // prevent braille cuz it CRASHES THE ENTIRE LAPTOP if (message.toString().includes('⣿')) return; @@ -311,27 +311,27 @@ function main() { dcclient.on('ready', async () => { botThings(); // Find the Discord channel messages will be sent to - if (process.argv[2]==='sus.shhnowisnottheti.me') { + if (process.argv[2] === 'sus.shhnowisnottheti.me') { channel = dcclient.channels.cache.get(ayunboomchannel); bot.channel = dcclient.channels.cache.get(ayunboomchannel); } - if (process.argv[2]==='129.159.58.114') { + if (process.argv[2] === '129.159.58.114') { channel = dcclient.channels.cache.get(dinboomchannel); bot.channel = dcclient.channels.cache.get(dinboomchannel); } - if (process.argv[2]==='kaboom.pw') { + if (process.argv[2] === 'kaboom.pw') { channel = dcclient.channels.cache.get(kaboomchannel); bot.channel = dcclient.channels.cache.get(kaboomchannel); } - if (process.argv[2]==='192.168.1.103') { + if (process.argv[2] === '192.168.1.103') { channel = dcclient.channels.cache.get(localclonechannel); bot.channel = dcclient.channels.cache.get(localclonechannel); } - if (process.argv[2]==='kitsune.icu') { + if (process.argv[2] === 'kitsune.icu') { channel = dcclient.channels.cache.get(kitsunechannel); bot.channel = dcclient.channels.cache.get(kitsunechannel); } - if (process.argv[2]==='mc.chomens41793.ga') { + if (process.argv[2] === 'mc.chomens41793.ga') { channel = dcclient.channels.cache.get(chomensserverchannel); bot.channel = dcclient.channels.cache.get(chomensserverchannel); } @@ -346,8 +346,8 @@ dcclient.on('ready', async () => { // Console COMMANDS rl.on('line', function(line) { try { - if (line.toLowerCase()==='' || line.toLowerCase().startsWith(' ')) return; - if (line.toLowerCase()==='.exit' || line.toLowerCase()==='.end') { + if (line.toLowerCase() === '' || line.toLowerCase().startsWith(' ')) return; + if (line.toLowerCase() === '.exit' || line.toLowerCase() === '.end') { bot.emit('end', 'end command'); return; } @@ -360,19 +360,19 @@ dcclient.on('ready', async () => { return; } } - if (line==='.clearconsolequeue') { + if (line === '.clearconsolequeue') { consoleQueue = []; return; } - if (line==='.messagelogging on') { + if (line === '.messagelogging on') { messageloggingEnabled = true; return; } - if (line==='.messagelogging off') { + if (line === '.messagelogging off') { messageloggingEnabled = false; return; } - if (line==='.kill') process.exit(); + if (line === '.kill') process.exit(); if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid'); bot.tellraw('@a', ['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]); } catch (e) { diff --git a/plugins/bruhify.js b/plugins/bruhify.js index 190a212..eb31cdb 100644 --- a/plugins/bruhify.js +++ b/plugins/bruhify.js @@ -4,7 +4,7 @@ module.exports = { bot.bruhifyText = ''; let startHue = 0; timer = setInterval(() => { - if (bot.bruhifyText==='') return; + if (bot.bruhifyText === '') return; let hue = startHue; const displayName = bot.bruhifyText; diff --git a/plugins/chat.js b/plugins/chat.js index e29d867..684bebf 100644 --- a/plugins/chat.js +++ b/plugins/chat.js @@ -21,29 +21,29 @@ function inject(bot) { try { const raw = message.toMotd().substring(0, 32767); if (raw.match(/.* .*: .*/g)) { - // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; + // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, ''); const message = raw.split(': ')[1]; bot.emit('message', username, message, packet.sender); } else if (raw.match(/.* .*\u203a .*/g)) { - // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; + // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]; const message = raw.split('\u203a ')[1].substring(2); bot.emit('message', username, message, packet.sender); } else if (raw.match(/.* .*\u00BB .*/g)) { - // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; + // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]; const message = raw.split('\u00BB ')[1].substring(2); bot.emit('message', username, message, packet.sender); } else if (raw.match(/<.*§r> .*/g)) { - // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; + // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.substring(3).split('§r>')[0]; const message = raw.split('§r> ')[1]; bot.emit('message', username, message, packet.sender); } else if (raw.match(/<.*> .*/g)) { - // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; + // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.substring(3).split('>')[0]; const message = raw.split('> ')[1]; diff --git a/plugins/core.js b/plugins/core.js index 755b355..9e0463f 100644 --- a/plugins/core.js +++ b/plugins/core.js @@ -37,7 +37,7 @@ function inject(bot, dcclient, config) { relativePosition.z = 0; } - const impulseMode = bot.options.host === '0.tcp.ap.ngrok.io'; + const impulseMode = bot.options.host === '0.tcp.ap.ngrok.io'; const location = { x: core.start.x + relativePosition.x, @@ -108,11 +108,11 @@ function inject(bot, dcclient, config) { }); // bot._client.on('block_change', (packet) => { - // if (core.isCore(packet.location) && packet.type===0) fillCore(); + // if (core.isCore(packet.location) && packet.type === 0) fillCore(); // }); // bot._client.on('multi_block_change', (packet) => { - // if (core.start===packet.chunkCoordinates || core.end===packet.chunkCoordinates) fillCore(); + // if (core.start === packet.chunkCoordinates || core.end === packet.chunkCoordinates) fillCore(); // }); bot.on('end', () => { diff --git a/plugins/players.js b/plugins/players.js index 6f7ac6a..2bab480 100644 --- a/plugins/players.js +++ b/plugins/players.js @@ -148,7 +148,7 @@ function inject(bot) { const players = await bot.requester.getPlayerList(); - if (fullPlayer && players.some((name) => name === fullPlayer.name)) { + if (fullPlayer && players.some((name) => name === fullPlayer.name)) { bot.emit('player_vanished', player); return; diff --git a/plugins/self_care.js b/plugins/self_care.js index e1af166..4ea7762 100644 --- a/plugins/self_care.js +++ b/plugins/self_care.js @@ -8,20 +8,20 @@ function inject(bot, dcclient, config) { let muted = false; bot.on('parsed_chat', (data) => { - if (data.toString()==='You are now completely invisible to normal users, and hidden from in-game commands.') vanish = true; + if (data.toString() === 'You are now completely invisible to normal users, and hidden from in-game commands.') vanish = true; if (!bot.visibility) { if (data.toString().startsWith('Vanish for ') && data.toString().endsWith('disabled')) vanish = false; } - if (data.toString()==='Successfully enabled CommandSpy' || data.toString()===' Enabled your command spy.' || data.toString()===' Your command spy is already enabled.') cspy = true; - if (data.toString()==='Successfully disabled CommandSpy' || data.toString()===' Disabled your command spy.') cspy = false; - if (data.toString()==='You now have the tag: [ChomeNS Bot]') { + if (data.toString() === 'Successfully enabled CommandSpy' || data.toString() === ' Enabled your command spy.' || data.toString() === ' Your command spy is already enabled.') cspy = true; + if (data.toString() === 'Successfully disabled CommandSpy' || data.toString() === ' Disabled your command spy.') cspy = false; + if (data.toString() === 'You now have the tag: [ChomeNS Bot]') { prefix = true; return; } if (data.toString().startsWith('You no longer have a tag')) prefix = false; if (data.toString().startsWith('You now have the tag: ')) prefix = false; if (data.toString().startsWith('You have been muted')) muted = true; - if (data.toString()==='You have been unmuted.') muted = false; + if (data.toString() === 'You have been unmuted.') muted = false; }); bot._client.on('entity_status', (data) => { diff --git a/util/text_parser.js b/util/text_parser.js index 5a98235..ea5dc37 100644 --- a/util/text_parser.js +++ b/util/text_parser.js @@ -71,7 +71,7 @@ function parseText(string) { * @return {string} The parsed raw string. */ function parseJson(json, parent) { - if (typeof json === 'string') json = {text: json}; + if (typeof json === 'string') json = {text: json}; json.color ??= parent.color; json.bold ??= parent.bold; @@ -110,7 +110,7 @@ function parseJson(json, parent) { let i = 0; raw += language[json.translate].replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => { - if (g0 === '%%') { + if (g0 === '%%') { return '%'; } else { const idx = g1 ? parseInt(g1) : i++; @@ -132,7 +132,7 @@ function parseJson(json, parent) { // Remove trailing section signs let end = raw.length; - while (raw[end - 1] === '§') end--; + while (raw[end - 1] === '§') end--; raw = raw.substring(0, end); if (json.extra) {