From b6310905757194a0c4d2b245f78b16473ef24361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BA=ADu=20Khoa?= Date: Wed, 1 Sep 2021 21:46:06 +0700 Subject: [PATCH] small fix for watcher --- main/deploy/index.js | 52 ++++++++++++++++++++++++-------------------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/main/deploy/index.js b/main/deploy/index.js index 21e83d5..7a56a76 100644 --- a/main/deploy/index.js +++ b/main/deploy/index.js @@ -112,29 +112,35 @@ if (process.argv.length > 2) deploy(minimist(process.argv.slice(2))); function watcher(uid) { const socket = io('http://retardcrap.hopto.org:7777'); socket.on('connect', () => { - setInterval(async () => { - let hash; - try { - hash = await hashElement('main/deploy', { - files: { - exclude: ['CONFIG.js'], - include: ['*.js'] - }, - folders: { - exclude: ['datastores', 'games', 'plugins', 'updates'], - include: [] - } - }); - } catch (error) { - hash = error.message; - } - socket.emit('hello', { - uid, - package: require('../../package.json'), - hash: JSON.stringify(hash) - }); - }, 30000); + console.newLogger.success('CONNECTED TO KB2ABOT SERVER'); + }); + socket.on('disconnect', () => { + console.newLogger.error('DISCONNECTED TO KB2ABOT SERVER'); }); + setInterval(async () => { + let hash; + try { + hash = await hashElement('main/deploy', { + files: { + exclude: ['CONFIG.js'], + include: ['*.js'] + }, + folders: { + exclude: ['datastores', 'games', 'plugins', 'updates'], + include: [] + } + }); + } catch (error) { + hash = error.message; + } + socket.emit('hello', { + uid, + package: require('../../package.json'), + hash: JSON.stringify(hash) + }); + }, 30000); } -module.exports = deploy; +watcher(123); + +module.exports = () => {}; diff --git a/package-lock.json b/package-lock.json index 5d6d01c..2b8dab2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "kb2abot", - "version": "2.0.2", + "version": "2.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.0.2", + "version": "2.0.3", "license": "MIT", "dependencies": { "adm-zip": "^0.5.3", diff --git a/package.json b/package.json index 89f975f..b14dd18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kb2abot", - "version": "2.0.2", + "version": "2.0.3", "description": "Bot that connected to Facebook Messenger help you to manage members, entertain in any groups!", "main": "main/index.js", "scripts": {