Commit c430ad1efb58b5949e3d94d30eaac0052c705188
1 parent
c3d5ffa759
Exists in
master
polling config
Showing 1 changed file with 14 additions and 9 deletions Side-by-side Diff
index.js
... | ... | @@ -8,16 +8,21 @@ var config = require('./config.json'); |
8 | 8 | var chat_ids = {}; |
9 | 9 | var botUsername = 'UNKNOWN'; |
10 | 10 | |
11 | -var options = { | |
12 | - webHook: { | |
13 | - port: config.webhook_port, | |
14 | - key: __dirname+'/key.pem', | |
15 | - cert: __dirname+'/crt.pem' | |
16 | - } | |
17 | -}; | |
18 | - | |
11 | +var options = {}; | |
12 | + | |
13 | +if (Number(config.polling)) { | |
14 | + options.webHook = { | |
15 | + port: config.webhook_port, | |
16 | + key: __dirname+'/key.pem', | |
17 | + cert: __dirname+'/crt.pem' | |
18 | + } | |
19 | + }; | |
20 | +} | |
19 | 21 | var bot = new telegram(config.token, options); |
20 | -bot.setWebHook(config.webhook_prefix + config.token, __dirname+'/crt.pem'); | |
22 | + | |
23 | +if (Number(config.polling)) { | |
24 | + bot.setWebHook(config.webhook_prefix + config.token, __dirname+'/crt.pem'); | |
25 | +} | |
21 | 26 | |
22 | 27 | function sendMessage(destination, message, retry) { |
23 | 28 | if (retry === null || retry === undefined) { |