This commit is contained in:
ChomeNS 2022-11-30 16:45:20 +07:00
parent fbec2003be
commit a4e99f8c52
9 changed files with 10 additions and 10 deletions

2
bot.js
View file

@ -137,7 +137,7 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
bot.end(reason, 'end')
})
bot.once('end', (reason, event) => {
bot.on('end', (reason, event) => {
bot.console.info(
`Disconnected from ${bot.options.host} (${event} event): ${util.inspect(reason)}`
)

View file

@ -27,7 +27,7 @@ function inject (bot) {
bot.chatQueue.push(String(message))
}
bot.once('end', () => {
bot.on('end', () => {
clearInterval(chatQueue)
})

View file

@ -94,7 +94,7 @@ function inject (bot, dcclient, config) {
return
};
}
bot.once('end', () => {
bot.on('end', () => {
dcclient.off('messageCreate', handleDiscordMessages)
})
dcclient.on('messageCreate', handleDiscordMessages)

View file

@ -110,7 +110,7 @@ function inject (bot, _dcclient, config, rl) {
rl.on('line', handleLine)
bot.once('end', () => {
bot.on('end', () => {
rl.off('line', handleLine)
})
}

View file

@ -112,7 +112,7 @@ function inject (bot, dcclient, config) {
const interval = setInterval(bot.core.fillCore, config.core.refillInterval)
bot.once('end', () => {
bot.on('end', () => {
clearInterval(interval)
})
}

View file

@ -110,7 +110,7 @@ async function inject (bot, dcclient, config) {
}
}
bot.once('end', () => {
bot.on('end', () => {
clearInterval(queueInterval)
dcclient.off('messageCreate', handleDiscordMessages)
})

View file

@ -8,7 +8,7 @@ module.exports = {
bot.hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.normalKey).digest('hex').substring(0, 16)
bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16)
}, 2000)
bot.once('end', () => {
bot.on('end', () => {
clearInterval(interval)
})
}

View file

@ -78,7 +78,7 @@ function inject (bot) {
} catch (e) {}
}, 50)
bot.once('end', () => {
bot.on('end', () => {
clearInterval(interval)
})

View file

@ -54,7 +54,7 @@ function inject (bot, dcclient, config) {
gameMode = data.gameMode
})
bot._client.once('login', (data) => {
bot._client.on('login', (data) => {
gameMode = data.gameMode
})
@ -70,7 +70,7 @@ function inject (bot, dcclient, config) {
if (endCredits && config.self_care.endCredits) bot.write('client_command', { payload: 0 })
}, config.self_care_check_interval)
bot.once('end', () => {
bot.on('end', () => {
clearInterval(interval)
})
};