mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
bot.options.host & bot.options.port fix
it is a ploblem for a very long time now also chip why yesterday chipmunk.land is completely down and why is chipmunk clone down!?1/?!! ip change?!? router ploblem?!?!
This commit is contained in:
parent
2f52062f29
commit
d417c9f6bb
8 changed files with 51 additions and 43 deletions
18
bot.js
18
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)}\``)
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
56
config.js
56
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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2
index.js
2
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)
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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('.')) {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue