Commit 3f8c0307613ce61d23358be3215976965d2f4801

Authored by Adhidarma Hadiwinoto
1 parent f5973c0028
Exists in master

botUsername

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -6,6 +6,7 @@ var evo = require('./evo-im.js');
6 6 var config = require('./config.json');
7 7  
8 8 var chat_ids = {};
  9 +var botUsername = 'UNKNOWN';
9 10  
10 11 var options = {
11 12 webHook: {
... ... @@ -30,7 +31,7 @@ function sendMessage(destination, message, retry) {
30 31 return;
31 32 }
32 33  
33   - logger.info('Sending reply to ' + destination + '(' + chat_id + '): ' + message);
  34 + logger.info('Sending reply from ' + botUsername + ' to ' + destination + '(' + chat_id + '): ' + message);
34 35  
35 36 try {
36 37 bot.sendMessage(chat_id, message);
... ... @@ -72,10 +73,11 @@ function getChatId(partner) {
72 73  
73 74 bot.getMe().then(function (me) {
74 75 logger.info('Hi my name is %s!', me.username);
  76 + botUsername = me.username;
75 77 });
76 78  
77 79 bot.on('text', function (msg) {
78   - logger.info('Incoming message (' + msg.chat.id + '): ' + msg.text, {message: msg});
  80 + logger.info('Incoming message for ' + botUsername + ' (' + msg.chat.id + '): ' + msg.text, {message: msg});
79 81  
80 82 var from = msg.from.username.toUpperCase() + config.msisdn_suffix;
81 83 updateChatId(from, msg.chat.id);