botv12/plugins/rejoin.js
2024-10-23 22:59:54 -04:00

13 lines
No EOL
333 B
JavaScript

import { createBot } from "../index.js"
export default function 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}`)
createBot(b.host, b.id)
}, 5000)
})
}