ddbot.js-0374 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/bot/bot.js +11 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"neiky-ddracebot.js": "^2.4.0"
|
|
5
5
|
},
|
|
6
6
|
"name": "ddbot.js-0374",
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.6",
|
|
8
8
|
"description": "ddbot.js — это Node.js проект для автоматизации и управления ботами, а также работы с картами и логами.",
|
|
9
9
|
"main": "./index.js",
|
|
10
10
|
"scripts": {
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"ddbot",
|
|
24
24
|
"bot",
|
|
25
25
|
"automation",
|
|
26
|
-
"maps"
|
|
26
|
+
"maps",
|
|
27
|
+
"ddracenetwork"
|
|
27
28
|
],
|
|
28
29
|
"author": "0374flop",
|
|
29
30
|
"license": "MIT",
|
package/src/bot/bot.js
CHANGED
|
@@ -145,6 +145,8 @@ class BotManager extends EventEmitter {
|
|
|
145
145
|
botInfo.client.Disconnect(); // отключаемся
|
|
146
146
|
botInfo.isConnected = false; // обновляем статус
|
|
147
147
|
logDebug('disconnectedBot', botName)
|
|
148
|
+
this.emit(`${botName}:disconnect`, null);
|
|
149
|
+
this.emit(`${botName}:disconnected`, null);
|
|
148
150
|
return true; // да
|
|
149
151
|
} catch (error) { // фак
|
|
150
152
|
logDebug(error)
|
|
@@ -293,6 +295,14 @@ class BotManager extends EventEmitter {
|
|
|
293
295
|
logDebug('_setupBotEvents called for botName:', botName); // логируем вызов функции
|
|
294
296
|
let chatinterval = null; // интервал для чата
|
|
295
297
|
|
|
298
|
+
this.on(`${botName}:disconnected`, (reason) => {
|
|
299
|
+
clearInterval(chatinterval);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
this.on(`${botName}:disconnect`, (reason) => {
|
|
303
|
+
clearInterval(chatinterval);
|
|
304
|
+
});
|
|
305
|
+
|
|
296
306
|
client.on('connection_au_serveur_ddrace', () => { // Шок контент бот зашел на сервер
|
|
297
307
|
const botInfo = this.activeBots.get(botName); // получаем инфу о боте
|
|
298
308
|
if (!botInfo) {
|
|
@@ -306,6 +316,7 @@ class BotManager extends EventEmitter {
|
|
|
306
316
|
});
|
|
307
317
|
|
|
308
318
|
client.on('disconnect', (reason) => { // бот отключился от сервера
|
|
319
|
+
if (!reason) return; // На всякий случай, потому что если специально отключаеться то может не быть
|
|
309
320
|
let botInfo = this.activeBots.get(botName); // получаем инфу о боте
|
|
310
321
|
if (!botInfo) {
|
|
311
322
|
return; // бот не найден фак
|