Commit d94bc60ef57eabf628166e07bf664c9b0aa56e10
1 parent
c9fecc1795
Exists in
master
debug chat id
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
index.js
... | ... | @@ -27,6 +27,11 @@ function deleteChatId(from) { |
27 | 27 | delete chat_ids[from]; |
28 | 28 | } |
29 | 29 | |
30 | +function updateChatId(from, chat_id) { | |
31 | + chat_ids[from] = chat_id; | |
32 | + logger.verbose('Chat id ' + chat_id + ' ' + from); | |
33 | +} | |
34 | + | |
30 | 35 | function sendMessage(destination, message) { |
31 | 36 | var chat_id = chat_ids[destination]; |
32 | 37 | |
... | ... | @@ -59,7 +64,7 @@ bot.on('text', function (msg) { |
59 | 64 | return; |
60 | 65 | } |
61 | 66 | |
62 | - chat_ids[from] = msg.chat.id; | |
67 | + updateChatId(from, msg.chat.id); | |
63 | 68 | |
64 | 69 | var greeting_prefix = "Pesan anda telah diterima:"; |
65 | 70 | if (config.greeting_prefix) { |