feat: add a basic feature to rejoin on server restart
This commit is contained in:
@@ -46,7 +46,17 @@ const events = {
|
||||
}
|
||||
}
|
||||
, chat: command
|
||||
, kicked: (reason, loggedIn) => console.warn(reason, loggedIn)
|
||||
, kicked: function rejoin(reason, loggedIn) {
|
||||
console.warn(reason, loggedIn && "logged_in")
|
||||
if (reason.extra && reason.extra[0].text === "Server closed") {
|
||||
bot.quit()
|
||||
bot.end()
|
||||
// TODO implement all startup features (maybe refactor all into a single function / module?)
|
||||
setTimeout((bot, cfg) => {
|
||||
bot = mineflayer.createBot(cfg.botOptions)
|
||||
}, 15 * 60 * 1000, bot, cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const events_registered = []
|
||||
|
Reference in New Issue
Block a user