Commit e43301286bafc28ac37cda8d7156dd1d08f67cb6
1 parent
046c42cdc5
Exists in
master
ping enhanced
Showing 2 changed files with 7 additions and 4 deletions Side-by-side Diff
config.sample.json
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | "warming_up_ms": 60000, |
6 | 6 | "core_url": "http://localhost:32972/apikey/PLEASE-CHANGE-WITH-VALID-APIKEY", |
7 | 7 | "listen_port": 14232, |
8 | + "ping_interval_ms": 60000, | |
8 | 9 | "commands": { |
9 | 10 | "balance": ["S", "SAL", "SALDO", "BAL", "BALANCE", "CEKSALDO"], |
10 | 11 | "price": ["H", "HP", "CH", "HARGA", "CEKHARGA", "PRICE"] |
transport-xmpp.js
... | ... | @@ -90,11 +90,13 @@ function send(partner, msg) { |
90 | 90 | bot.send(partner, msg); |
91 | 91 | } |
92 | 92 | |
93 | +function ping() { | |
94 | + bot.send(config.username, 'PING!'); | |
95 | +} | |
96 | + | |
93 | 97 | setInterval( |
94 | - function() { | |
95 | - bot.send(config.username, 'PING!'); | |
96 | - }, | |
97 | - 60 * 1000 | |
98 | + ping, | |
99 | + config.ping_interval_ms || 60000 | |
98 | 100 | ) |
99 | 101 | |
100 | 102 | exports.init = init; |