From 5b299d536a4ab397a4c0f5dca5d61a3cbe7586ff Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Mon, 5 Dec 2022 15:16:48 +0700 Subject: [PATCH] move useChat in tellraw plugin + remove unused eslint comment thingy --- bot.js | 1 - commands/ayunsudo.js | 1 - commands/botuser.js | 1 - commands/botvisibility.js | 1 - commands/bruhify.js | 1 - commands/cb.js | 1 - commands/changelog.js | 1 - commands/clearchat.js | 1 - commands/clearchatqueue.js | 1 - commands/cloop.js | 3 +-- commands/cowsay.js | 1 - commands/crashserver.js | 1 - commands/creator.js | 1 - commands/discord.js | 1 - commands/draw.js | 1 - commands/eaglercrash.js | 1 - commands/echo.js | 1 - commands/end.js | 1 - commands/entity.js | 1 - commands/eval.js | 1 - commands/executebypass.js | 1 - commands/gamemodeall.js | 1 - commands/help.js | 3 +-- commands/list.js | 1 - commands/music.js | 3 +-- commands/netmsg.js | 1 - commands/rtp.js | 1 - commands/servereval.js | 1 - commands/test.js | 1 - commands/time.js | 1 - commands/tpall.js | 1 - commands/translate.js | 1 - commands/uptime.js | 1 - commands/urban.js | 1 - commands/uuid.js | 1 - commands/validate.js | 1 - commands/wikipedia.js | 1 - config.js | 1 - index.js | 1 - plugins/chat.js | 3 +-- plugins/commands.js | 3 +-- plugins/console.js | 3 +-- plugins/core.js | 13 +------------ plugins/discord.js | 3 +-- plugins/draw.js | 1 - plugins/hash.js | 1 - plugins/music.js | 3 +-- plugins/players.js | 3 +-- plugins/position.js | 2 +- plugins/proxy.js | 2 +- plugins/proxy/chat.js | 2 +- plugins/proxy/custom_chat.js | 2 +- plugins/proxy/self_care.js | 2 +- plugins/self_care.js | 3 +-- plugins/tellraw.js | 9 ++++++--- util/chat.js | 1 - util/colors/minecraft.js | 2 +- util/containsIllegalCharacters.js | 1 - util/generateEaglerUsername.js | 1 - util/loadPlugins.js | 1 - util/midi_converter/main.js | 3 +-- 61 files changed, 24 insertions(+), 85 deletions(-) diff --git a/bot.js b/bot.js index bb2e7a3..c2301f6 100644 --- a/bot.js +++ b/bot.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const mc = require('minecraft-protocol') const crypto = require('crypto') diff --git a/commands/ayunsudo.js b/commands/ayunsudo.js index 34edc77..1db0f57 100644 --- a/commands/ayunsudo.js +++ b/commands/ayunsudo.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'ayunsudo', alias: [], diff --git a/commands/botuser.js b/commands/botuser.js index d4e2092..a0ce4b9 100644 --- a/commands/botuser.js +++ b/commands/botuser.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'botuser', diff --git a/commands/botvisibility.js b/commands/botvisibility.js index dab76f5..1a8700a 100644 --- a/commands/botvisibility.js +++ b/commands/botvisibility.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'botvisibility', diff --git a/commands/bruhify.js b/commands/bruhify.js index a380752..6c8dd51 100644 --- a/commands/bruhify.js +++ b/commands/bruhify.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'bruhify', diff --git a/commands/cb.js b/commands/cb.js index 59a527c..069dacf 100644 --- a/commands/cb.js +++ b/commands/cb.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'cb', alias: ['cmd', 'commandblock', 'run'], diff --git a/commands/changelog.js b/commands/changelog.js index 3e8001f..798a7e1 100644 --- a/commands/changelog.js +++ b/commands/changelog.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const changelog = require('../changelog.json') const { MessageEmbed } = require('discord.js') module.exports = { diff --git a/commands/clearchat.js b/commands/clearchat.js index 2a866cb..b0ad714 100644 --- a/commands/clearchat.js +++ b/commands/clearchat.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'clearchat', diff --git a/commands/clearchatqueue.js b/commands/clearchatqueue.js index 3d9d101..e6a1ea2 100644 --- a/commands/clearchatqueue.js +++ b/commands/clearchatqueue.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'clearchatqueue', description: 'Clears the bot\'s chat queue', diff --git a/commands/cloop.js b/commands/cloop.js index f4f1f43..165c267 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -1,5 +1,4 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const { MessageEmbed } = require('discord.js') function add (command, interval, bot) { const id = setInterval(() => bot.core.run(command), interval) diff --git a/commands/cowsay.js b/commands/cowsay.js index 5caa32b..86365a0 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const cowsay = require('cowsay2') const cows = require('cowsay2/cows') const { MessageEmbed } = require('discord.js') diff --git a/commands/crashserver.js b/commands/crashserver.js index 8995b34..55d57cd 100644 --- a/commands/crashserver.js +++ b/commands/crashserver.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const sleep = require('sleep-promise') /** diff --git a/commands/creator.js b/commands/creator.js index 9877293..f2229de 100644 --- a/commands/creator.js +++ b/commands/creator.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'creator', diff --git a/commands/discord.js b/commands/discord.js index c60123e..ef151aa 100644 --- a/commands/discord.js +++ b/commands/discord.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'discord', alias: [], diff --git a/commands/draw.js b/commands/draw.js index 3502153..e1c3565 100644 --- a/commands/draw.js +++ b/commands/draw.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { resize } = require('../util/image') const axios = require('axios') const sharp = require('sharp') diff --git a/commands/eaglercrash.js b/commands/eaglercrash.js index 9aacb1e..16f9a15 100644 --- a/commands/eaglercrash.js +++ b/commands/eaglercrash.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'eaglercrash', alias: [], diff --git a/commands/echo.js b/commands/echo.js index b77231e..2d939ee 100644 --- a/commands/echo.js +++ b/commands/echo.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'echo', alias: [], diff --git a/commands/end.js b/commands/end.js index d1825a7..86ae40a 100644 --- a/commands/end.js +++ b/commands/end.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'end', alias: [], diff --git a/commands/entity.js b/commands/entity.js index cbec8e6..5eecd7a 100644 --- a/commands/entity.js +++ b/commands/entity.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'entity', alias: [], diff --git a/commands/eval.js b/commands/eval.js index 276af1c..afefc87 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') const { VM } = require('vm2') const axios = require('axios') diff --git a/commands/executebypass.js b/commands/executebypass.js index d939909..01e8b1d 100644 --- a/commands/executebypass.js +++ b/commands/executebypass.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'executebypass', alias: [], diff --git a/commands/gamemodeall.js b/commands/gamemodeall.js index 80e7001..75cbe6a 100644 --- a/commands/gamemodeall.js +++ b/commands/gamemodeall.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'gamemodeall', alias: [], diff --git a/commands/help.js b/commands/help.js index 8cb07d7..02fada4 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,6 +1,5 @@ -/* eslint-disable require-jsdoc */ + /* eslint-disable no-var */ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'help', diff --git a/commands/list.js b/commands/list.js index f64e12d..cbcecbe 100644 --- a/commands/list.js +++ b/commands/list.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'list', diff --git a/commands/music.js b/commands/music.js index cdb52e3..be6c2ef 100644 --- a/commands/music.js +++ b/commands/music.js @@ -1,6 +1,5 @@ /* eslint-disable no-case-declarations */ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const fs = require('fs/promises') const { MessageEmbed } = require('discord.js') const path = require('path') diff --git a/commands/netmsg.js b/commands/netmsg.js index 20d8815..c238624 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'netmsg', alias: ['networkmessage', 'irc'], diff --git a/commands/rtp.js b/commands/rtp.js index c16b150..6e01331 100644 --- a/commands/rtp.js +++ b/commands/rtp.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { between } = require('../util/between') module.exports = { name: 'rtp', diff --git a/commands/servereval.js b/commands/servereval.js index 404e72b..399123c 100644 --- a/commands/servereval.js +++ b/commands/servereval.js @@ -1,5 +1,4 @@ /* eslint-disable no-eval */ -/* eslint-disable max-len */ const util = require('util') const { stylize } = require('../util/colors/minecraft') const { MessageEmbed } = require('discord.js') diff --git a/commands/test.js b/commands/test.js index 93aa790..618ae66 100644 --- a/commands/test.js +++ b/commands/test.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'test', diff --git a/commands/time.js b/commands/time.js index 346a3a3..a6ccd52 100644 --- a/commands/time.js +++ b/commands/time.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') const moment = require('moment-timezone') module.exports = { diff --git a/commands/tpall.js b/commands/tpall.js index 48cdef3..bbcd580 100644 --- a/commands/tpall.js +++ b/commands/tpall.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'tpall', alias: [], diff --git a/commands/translate.js b/commands/translate.js index b73fcc7..c086645 100644 --- a/commands/translate.js +++ b/commands/translate.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') const translate = require('@vitalets/google-translate-api') module.exports = { diff --git a/commands/uptime.js b/commands/uptime.js index 9d660b3..0f01c0e 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') const { secondsToHms } = require('../util/secondToHms') module.exports = { diff --git a/commands/urban.js b/commands/urban.js index 4f58672..7af18ea 100644 --- a/commands/urban.js +++ b/commands/urban.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const urban = require('urban-dictionary') module.exports = { name: 'urban', diff --git a/commands/uuid.js b/commands/uuid.js index 9db586e..b99a269 100644 --- a/commands/uuid.js +++ b/commands/uuid.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const { MessageEmbed } = require('discord.js') module.exports = { name: 'uuid', diff --git a/commands/validate.js b/commands/validate.js index ac9ddf8..068fb25 100644 --- a/commands/validate.js +++ b/commands/validate.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { name: 'validate', description: 'Validates hash', diff --git a/commands/wikipedia.js b/commands/wikipedia.js index 012c0b1..e4e45b4 100644 --- a/commands/wikipedia.js +++ b/commands/wikipedia.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const wiki = require('wikipedia') const util = require('util') const { MessageEmbed } = require('discord.js') diff --git a/config.js b/config.js index 25aaff3..3e0a5ed 100644 --- a/config.js +++ b/config.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ module.exports = { version: '1.18.2', prefixes: [ diff --git a/index.js b/index.js index 93ce200..4810dba 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const readline = require('node:readline') const { stdin: input, stdout: output } = require('node:process') const rl = readline.createInterface({ input, output }) diff --git a/plugins/chat.js b/plugins/chat.js index 18c4006..7d0b9d1 100644 --- a/plugins/chat.js +++ b/plugins/chat.js @@ -1,5 +1,4 @@ -/* eslint-disable max-len */ -/* eslint-disable require-jsdoc */ + // eslint-disable-next-line no-undef // const parse = require('../util/text_parser'); const { containsIllegalCharacters } = require('../util/containsIllegalCharacters') diff --git a/plugins/commands.js b/plugins/commands.js index 2b2e891..bdaef14 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -1,5 +1,4 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const path = require('path') const { MessageEmbed } = require('discord.js') function inject (bot, dcclient, config) { diff --git a/plugins/console.js b/plugins/console.js index 5527a4c..5c139f2 100644 --- a/plugins/console.js +++ b/plugins/console.js @@ -1,6 +1,5 @@ /* eslint-disable no-eval */ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const moment = require('moment-timezone') const util = require('util') diff --git a/plugins/core.js b/plugins/core.js index c3d0d62..1bab867 100644 --- a/plugins/core.js +++ b/plugins/core.js @@ -1,5 +1,4 @@ -/* eslint-disable max-len */ -/* eslint-disable require-jsdoc */ + const nbt = require('prismarine-nbt') const Vec3 = require('vec3') @@ -7,22 +6,12 @@ const relativePosition = new Vec3(0, 0, 0) function inject (bot, dcclient, config) { const mcData = require('minecraft-data')(bot.version) - const chatMessage = require('prismarine-chat')(bot.version) const core = { isCore (position) { return position.x >= core.start.x && position.x <= core.end.x && position.y >= core.start.y && position.y <= core.end.y && position.z >= core.start.z && position.z <= core.end.z }, run (command) { try { - if (config.chat.useChat && - command.startsWith('minecraft:tellraw @a ') && - !command.includes('Console') && - !command.includes('Discord') - ) { - bot.chat(chatMessage.fromNotch(command.replace('minecraft:tellraw @a ', '')).toMotd().replaceAll('\xa7', '&')) - return - } - relativePosition.x++ if (relativePosition.x >= 16) { diff --git a/plugins/discord.js b/plugins/discord.js index 3145502..a800351 100644 --- a/plugins/discord.js +++ b/plugins/discord.js @@ -1,5 +1,4 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const { escapeMarkdown } = require('../util/escapeMarkdown') async function inject (bot, dcclient, config) { const chatMessage = require('prismarine-chat')(bot.version) diff --git a/plugins/draw.js b/plugins/draw.js index 9747d4c..ceb6692 100644 --- a/plugins/draw.js +++ b/plugins/draw.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const convert = require('color-convert') // eslint-disable-next-line require-jsdoc diff --git a/plugins/hash.js b/plugins/hash.js index ed89610..b863e98 100644 --- a/plugins/hash.js +++ b/plugins/hash.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const crypto = require('crypto') module.exports = { inject: function (bot, dcclient, config) { diff --git a/plugins/music.js b/plugins/music.js index 24cba02..3c9e3e6 100644 --- a/plugins/music.js +++ b/plugins/music.js @@ -1,5 +1,4 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + const { Midi } = require('@tonejs/midi') const { convertMidi } = require('../util/midi_converter') diff --git a/plugins/players.js b/plugins/players.js index 8092578..d5ed871 100644 --- a/plugins/players.js +++ b/plugins/players.js @@ -1,5 +1,4 @@ -/* eslint-disable max-len */ -/* eslint-disable require-jsdoc */ + class PlayerList { list = [] diff --git a/plugins/position.js b/plugins/position.js index 5f90e1b..7d81341 100644 --- a/plugins/position.js +++ b/plugins/position.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + function inject (bot) { bot.position = { x: 0, y: 0, z: 0 } bot._client.on('position', (position) => { diff --git a/plugins/proxy.js b/plugins/proxy.js index 3d40561..5ac824b 100644 --- a/plugins/proxy.js +++ b/plugins/proxy.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + const util = require('util') const mc = require('minecraft-protocol') const { loadPlugins } = require('../util/loadPlugins') diff --git a/plugins/proxy/chat.js b/plugins/proxy/chat.js index 3de990a..1fc4a5a 100644 --- a/plugins/proxy/chat.js +++ b/plugins/proxy/chat.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + const { chatPacketListener, parsePlayerMessages } = require('../../util/chat') function inject (bot, client, target) { const ChatMessage = require('prismarine-chat')(bot.version) diff --git a/plugins/proxy/custom_chat.js b/plugins/proxy/custom_chat.js index 7920295..c3079c5 100644 --- a/plugins/proxy/custom_chat.js +++ b/plugins/proxy/custom_chat.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + function inject (bot, client, target) { const { MessageBuilder } = require('prismarine-chat')(bot.version) client.on('packet', (data, meta) => { diff --git a/plugins/proxy/self_care.js b/plugins/proxy/self_care.js index 16f6a68..64258f6 100644 --- a/plugins/proxy/self_care.js +++ b/plugins/proxy/self_care.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + function inject (bot, client, target, config) { let cspy = false let op = true diff --git a/plugins/self_care.js b/plugins/self_care.js index c7f92fc..650de55 100644 --- a/plugins/self_care.js +++ b/plugins/self_care.js @@ -1,5 +1,4 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ + function inject (bot, dcclient, config) { let vanish = false let cspy = false diff --git a/plugins/tellraw.js b/plugins/tellraw.js index b3b4d42..e51e634 100644 --- a/plugins/tellraw.js +++ b/plugins/tellraw.js @@ -1,7 +1,10 @@ -/* eslint-disable require-jsdoc */ -/* eslint-disable max-len */ -function inject (bot) { +function inject (bot, dcclient, config) { + const ChatMessage = require('prismarine-chat')(bot.version) bot.tellraw = function (selector, message) { + if (config.chat.useChat && selector === '@a') { + bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&')) + return + } bot.core.run(`minecraft:tellraw ${selector} ${typeof message === 'string' ? message : JSON.stringify(message)}`) } }; diff --git a/util/chat.js b/util/chat.js index 5dfbd2a..c451439 100644 --- a/util/chat.js +++ b/util/chat.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ /** * for the chat packet listener (in util cuz proxy + bot) * @param {object} packet chat packet diff --git a/util/colors/minecraft.js b/util/colors/minecraft.js index 54f6180..57ecfd4 100644 --- a/util/colors/minecraft.js +++ b/util/colors/minecraft.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ + const styles = { bigint: '\xa76', boolean: '\xa76', diff --git a/util/containsIllegalCharacters.js b/util/containsIllegalCharacters.js index 75be149..379e595 100644 --- a/util/containsIllegalCharacters.js +++ b/util/containsIllegalCharacters.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ /** * character allowed in mc chat * @param {String} character the character diff --git a/util/generateEaglerUsername.js b/util/generateEaglerUsername.js index a8a4b74..01b3a7d 100644 --- a/util/generateEaglerUsername.js +++ b/util/generateEaglerUsername.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const profanityNames = ['Eagler', 'Eagler', 'Bitch', 'Cock', 'Milf', 'Milf', 'Yeer', 'Groon', 'Eag', 'Deevis', 'Chode', 'Deev', 'Deev', 'Fucker', 'Fucking', 'Dumpster', 'Dumpster', 'Cum', 'Chad', 'Egg', 'Fudgler', 'Fudgli', diff --git a/util/loadPlugins.js b/util/loadPlugins.js index 78ede11..fe1340c 100644 --- a/util/loadPlugins.js +++ b/util/loadPlugins.js @@ -1,4 +1,3 @@ -/* eslint-disable max-len */ const fs = require('fs/promises') const util = require('util') const path = require('path') diff --git a/util/midi_converter/main.js b/util/midi_converter/main.js index b939e77..fe0000a 100644 --- a/util/midi_converter/main.js +++ b/util/midi_converter/main.js @@ -1,5 +1,4 @@ -/* eslint-disable max-len */ -/* eslint-disable require-jsdoc */ + const { Midi } = require('@tonejs/midi') const { convertNote, convertPercussionNote } = require('./convert_note.js')