FridayNightFunkinBoyfriendBot/modules/reconnect.js

19 lines
471 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
2023-12-24 12:11:42 -05:00
2023-12-17 14:55:27 -05:00
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-24 12:11:42 -05:00
2023-12-17 14:55:27 -05:00
}, bot.reconnectDelay)
})
}
module.exports = reconnect