diff --git a/bot.js b/bot.js index 1981921..3e12690 100644 --- a/bot.js +++ b/bot.js @@ -29,7 +29,15 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) { checkTimeoutInterval: config.timeoutInterval, hideErrors: true } + + // among us fix for bot.options.host and bot.options.port + bot.server = { + host: server.host, + port: server.port + } + bot._client = mc.createClient(bot.options) + bot.setMaxListeners(Infinity) // is this bad code? bot._client.setMaxListeners(Infinity) // this too bot.version = bot._client.version @@ -45,12 +53,12 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) { await sleep(200) - setNewBot(bot.options.host, bot) + setNewBot(bot.server.host, bot) - const channel = dcclient.channels.cache.get(config.discord.servers[bot.options.host]) + const channel = dcclient.channels.cache.get(config.discord.servers[bot.server.host]) channel.send( - `Connecting to: \`${bot.options.host}:${bot.options.port}\`` + `Connecting to: \`${bot.server.host}:${bot.server.port}\`` ) bot._client.on('login', async function (data) { bot.entityId = data.entityId @@ -58,7 +66,7 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) { bot.username = bot._client.username channel.send( - `Successfully logged in to: \`${bot.options.host}:${bot.options.port}\`` + `Successfully logged in to: \`${bot.server.host}:${bot.server.port}\`` ) }) @@ -70,7 +78,7 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) { bot.on('end', (reason, event) => { bot.console.info( - `Disconnected from ${bot.options.host} (${event} event): ${util.inspect(reason)}` + `Disconnected from ${bot.server.host} (${event} event): ${util.inspect(reason)}` ) channel.send(`Disconnected: \`${util.inspect(reason)}\``) diff --git a/commands/netmsg.js b/commands/netmsg.js index da980a0..e105022 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -11,10 +11,10 @@ module.exports = { color: 'dark_gray' }, { - text: bot.options.host === 'kitsune.icu' ? 'kit' : bot.options.host, + text: bot.server.host === 'kitsune.icu' ? 'kit' : bot.server.host, color: 'gray' }, - bot.options.host === 'kitsune.icu' + bot.server.host === 'kitsune.icu' ? { text: 'sune.icu', color: 'gray' diff --git a/config.js b/config.js index 28d6c34..56a3e0b 100644 --- a/config.js +++ b/config.js @@ -61,9 +61,9 @@ module.exports = { '192.168.1.103': '1002806756885413978', 'kitsune.icu': '1004006678460637315', 'fallback.kitsune.icu': '1050764247518412850', - '2.tcp.ngrok.io': '1010734897796763758', + 'mc.chomens41793.ga': '1010734897796763758', 'chipmunk.land': '1042590315464364032', - '_dc-srv.e3b3b6ffe77c._minecraft._tcp.mcslot.eu': '1057090538404323338' + 'mcslot.eu': '1057090538404323338' }, embedsColors: { normal: '#FFFF00', @@ -73,41 +73,41 @@ module.exports = { }, servers: [ // logging means log to console + // { + // host: 'play.kaboom.pw', + // port: 25565, + // kaboom: true, + // logging: false + // }, + // { + // host: 'sus.shhnowisnottheti.me', + // port: 25565, + // kaboom: true, + // logging: false + // }, + // { + // host: 'kitsune.icu', + // port: 25565, + // kaboom: true, + // logging: true + // }, + // { + // host: 'chipmunk.land', + // port: 25565, + // kaboom: true, + // logging: true + // }, { - host: 'play.kaboom.pw', - port: 25565, - kaboom: true, - logging: false - }, - { - host: 'sus.shhnowisnottheti.me', - port: 25565, - kaboom: true, - logging: false - }, - { - host: 'kitsune.icu', + host: 'mcslot.eu', port: 25565, kaboom: true, logging: true }, { - host: 'chipmunk.land', + host: 'mc.chomens41793.ga', port: 25565, kaboom: true, logging: true - }, - { - host: '_dc-srv.e3b3b6ffe77c._minecraft._tcp.mcslot.eu', - port: 25565, - kaboom: true, - logging: true - }, - { - host: '2.tcp.ngrok.io', - port: 13950, - kaboom: true, - logging: true } ] } diff --git a/index.js b/index.js index 12c4926..303d887 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,7 @@ dcclient.on('ready', () => { config.servers.forEach(async (server) => { const getBots = () => bots const setNewBot = (server, bot) => { - bots = bots.filter((eachBot) => eachBot.options.host !== server) + bots = bots.filter((eachBot) => eachBot.server.host !== server) bots.push(bot) } createBot(server, config, getBots, setNewBot, dcclient, rl) diff --git a/plugins/commands.js b/plugins/commands.js index 34c183d..6c11660 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -3,7 +3,7 @@ const path = require('path') const { EmbedBuilder } = require('discord.js') function inject (bot, dcclient, config) { const loadFiles = require('../util/load_files') - const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.options.host]) + const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.server.host]) bot.command_handler = {} bot.command_handler.commands = {} bot.command_handler.reload = async function () { diff --git a/plugins/console.js b/plugins/console.js index fc6d686..1ef13cf 100644 --- a/plugins/console.js +++ b/plugins/console.js @@ -11,7 +11,7 @@ function inject (bot, _dcclient, config, rl) { const chatMessage = require('prismarine-chat')(bot.version) function prefix (prefix, _message) { - const message = `[${moment().format('HH:mm:ss')} ${prefix}§r] [${bot.options.host}] ` + const message = `[${moment().format('HH:mm:ss')} ${prefix}§r] [${bot.server.host}] ` const component = chatMessage.MessageBuilder.fromString(message).toJSON() return chatMessage.fromNotch(component).toAnsi() + _message } @@ -51,7 +51,7 @@ function inject (bot, _dcclient, config, rl) { return } - if (bot.options.host !== bot.console.host && bot.console.host !== 'all') return + if (bot.server.host !== bot.console.host && bot.console.host !== 'all') return if (line === '.kill') process.exit() if (line.startsWith('.')) { diff --git a/plugins/discord.js b/plugins/discord.js index 7c318b7..438495d 100644 --- a/plugins/discord.js +++ b/plugins/discord.js @@ -2,7 +2,7 @@ const { escapeMarkdown } = require('../util/escapeMarkdown') async function inject (bot, dcclient, config) { const chatMessage = require('prismarine-chat')(bot.version) - const channel = dcclient.channels.cache.get(config.discord.servers[bot.options.host]) + const channel = dcclient.channels.cache.get(config.discord.servers[bot.server.host]) let queue = '' const queueInterval = setInterval(() => { diff --git a/plugins/proxy.js b/plugins/proxy.js index dd04423..789c3a1 100644 --- a/plugins/proxy.js +++ b/plugins/proxy.js @@ -9,7 +9,7 @@ function inject (bot, dcclient, config) { let index config.servers.forEach((server, _index) => { - if (bot.options.host !== server.host) return + if (bot.server.host !== server.host) return index = _index }) @@ -31,8 +31,8 @@ function inject (bot, dcclient, config) { const target = mc.createClient({ username: client.username, - host: bot.options.host, - port: bot.options.port, + host: bot.server.host, + port: bot.server.port, version })