mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
bot.end() exists so use it
This commit is contained in:
parent
0f4a14bce2
commit
0f335cd480
2 changed files with 6 additions and 6 deletions
10
bot.js
10
bot.js
|
@ -42,8 +42,8 @@ async function createBot(server, config, getBots, dcclient, rl) {
|
|||
bot._client = mc.createClient(bot.options);
|
||||
bot.version = bot._client.version;
|
||||
bot.write = (name, data) => bot._client.write(name, data);
|
||||
bot.end = (reason = 'end') => {
|
||||
bot.emit('end', reason);
|
||||
bot.end = (reason = 'end', event) => {
|
||||
bot.emit('end', reason, event);
|
||||
bot.removeAllListeners();
|
||||
bot._client.end();
|
||||
bot._client.removeAllListeners();
|
||||
|
@ -134,7 +134,7 @@ async function createBot(server, config, getBots, dcclient, rl) {
|
|||
});
|
||||
|
||||
bot._client.on('end', function(reason) {
|
||||
bot.emit('end', reason, 'end');
|
||||
bot.end(reason, 'end');
|
||||
});
|
||||
|
||||
bot.once('end', (reason, event) => {
|
||||
|
@ -173,12 +173,12 @@ async function createBot(server, config, getBots, dcclient, rl) {
|
|||
|
||||
bot._client.on('kick_disconnect', function(data) {
|
||||
const parsed = JSON.parse(data.reason);
|
||||
bot.emit('end', parsed, 'kick_disconnect');
|
||||
bot.end(parsed, 'kick_disconnect');
|
||||
});
|
||||
|
||||
bot._client.on('disconnect', function(data) {
|
||||
const parsed = JSON.parse(data.reason);
|
||||
bot.emit('end', parsed, 'disconnect');
|
||||
bot.end(parsed, 'disconnect');
|
||||
});
|
||||
|
||||
bot._client.on('error', function() {});
|
||||
|
|
|
@ -71,7 +71,7 @@ function oneTimeInject(bot, _dcclient, config, rl) {
|
|||
|
||||
if (bot.options.host !== bot.console.host && bot.console.host !== 'all') return;
|
||||
if (line.toLowerCase() === '.exit' || line.toLowerCase() === '.end') {
|
||||
bot.emit('end', 'end command');
|
||||
bot.end('end command');
|
||||
return;
|
||||
}
|
||||
if (line.toLowerCase().startsWith('.servereval ')) {
|
||||
|
|
Loading…
Reference in a new issue