FridayNightFunkinBoyfriendBot/modules/reconnect.js

18 lines
429 B
JavaScript
Raw Normal View History

2024-02-13 12:11:00 -05:00
const mc = require('minecraft-protocol')
function reconnect (bot, options) {
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
bot.username = ''
bot.on('end', () => {
if (bot.reconnectDelay < 0) return
setTimeout(() => {
bot._client = mc.createClient(options)
bot.emit('init_client', bot._client)
}, bot.reconnectDelay)
})
}
module.exports = reconnect