owobot/plugins/rejoin.js

16 lines
362 B
JavaScript
Raw Normal View History

2024-08-12 04:33:43 -04:00
const index = require('../index.js')
module.exports = {
load: (b) => {
b._client.on('end', () => {
b.info(`Bot ${b.id} disconnected`)
for (const i in b.interval) {
clearInterval(b.interval[i])
}
setTimeout(() => {
b.info(`Re-connecting bot ${b.id}`)
index.createBot(b.host, b.id)
}, 5000)
})
}
}