FridayNightFunkinBoyfriendBot/modules/reconnect.js

18 lines
459 B
JavaScript
Raw Normal View History

2023-12-17 14:55:27 -05:00
const mc = require('minecraft-protocol')
function reconnect (bot, options) {
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
2023-12-20 11:54:03 -05:00
2023-12-17 14:55:27 -05:00
bot.on('end', () => {
if (bot.reconnectDelay < 0) return
setTimeout(() => {
2023-12-20 11:54:03 -05:00
const client = options.client ?? mc.createClient(options)
bot._client = client
bot.emit('init_client', client)
2023-12-17 14:55:27 -05:00
}, bot.reconnectDelay)
})
}
module.exports = reconnect