From d94bc60ef57eabf628166e07bf664c9b0aa56e10 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Thu, 21 Jul 2016 14:26:48 +0700 Subject: [PATCH] debug chat id --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1bded71..afa716d 100644 --- a/index.js +++ b/index.js @@ -27,6 +27,11 @@ function deleteChatId(from) { delete chat_ids[from]; } +function updateChatId(from, chat_id) { + chat_ids[from] = chat_id; + logger.verbose('Chat id ' + chat_id + ' ' + from); +} + function sendMessage(destination, message) { var chat_id = chat_ids[destination]; @@ -59,7 +64,7 @@ bot.on('text', function (msg) { return; } - chat_ids[from] = msg.chat.id; + updateChatId(from, msg.chat.id); var greeting_prefix = "Pesan anda telah diterima:"; if (config.greeting_prefix) { -- 1.9.0