mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
use on
This commit is contained in:
parent
fbec2003be
commit
a4e99f8c52
9 changed files with 10 additions and 10 deletions
2
bot.js
2
bot.js
|
@ -137,7 +137,7 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
|
||||||
bot.end(reason, 'end')
|
bot.end(reason, 'end')
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.once('end', (reason, event) => {
|
bot.on('end', (reason, event) => {
|
||||||
bot.console.info(
|
bot.console.info(
|
||||||
`Disconnected from ${bot.options.host} (${event} event): ${util.inspect(reason)}`
|
`Disconnected from ${bot.options.host} (${event} event): ${util.inspect(reason)}`
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ function inject (bot) {
|
||||||
bot.chatQueue.push(String(message))
|
bot.chatQueue.push(String(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(chatQueue)
|
clearInterval(chatQueue)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ function inject (bot, dcclient, config) {
|
||||||
return
|
return
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
dcclient.off('messageCreate', handleDiscordMessages)
|
dcclient.off('messageCreate', handleDiscordMessages)
|
||||||
})
|
})
|
||||||
dcclient.on('messageCreate', handleDiscordMessages)
|
dcclient.on('messageCreate', handleDiscordMessages)
|
||||||
|
|
|
@ -110,7 +110,7 @@ function inject (bot, _dcclient, config, rl) {
|
||||||
|
|
||||||
rl.on('line', handleLine)
|
rl.on('line', handleLine)
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
rl.off('line', handleLine)
|
rl.off('line', handleLine)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ function inject (bot, dcclient, config) {
|
||||||
|
|
||||||
const interval = setInterval(bot.core.fillCore, config.core.refillInterval)
|
const interval = setInterval(bot.core.fillCore, config.core.refillInterval)
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ async function inject (bot, dcclient, config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(queueInterval)
|
clearInterval(queueInterval)
|
||||||
dcclient.off('messageCreate', handleDiscordMessages)
|
dcclient.off('messageCreate', handleDiscordMessages)
|
||||||
})
|
})
|
||||||
|
|
|
@ -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.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)
|
bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16)
|
||||||
}, 2000)
|
}, 2000)
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ function inject (bot) {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}, 50)
|
}, 50)
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ function inject (bot, dcclient, config) {
|
||||||
gameMode = data.gameMode
|
gameMode = data.gameMode
|
||||||
})
|
})
|
||||||
|
|
||||||
bot._client.once('login', (data) => {
|
bot._client.on('login', (data) => {
|
||||||
gameMode = data.gameMode
|
gameMode = data.gameMode
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ function inject (bot, dcclient, config) {
|
||||||
if (endCredits && config.self_care.endCredits) bot.write('client_command', { payload: 0 })
|
if (endCredits && config.self_care.endCredits) bot.write('client_command', { payload: 0 })
|
||||||
}, config.self_care_check_interval)
|
}, config.self_care_check_interval)
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.on('end', () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue