node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

how to Distinguish Between chosen_inline_result and message

Open shankar96 opened this issue 10 years ago • 3 comments

Here is code snippet,

bot.on('chosen_inline_result', function(msg){ console.log("chosen_inline_result\n"+JSON.stringify(msg)+"\n result chosed\n"); });

bot.on('message', function (msg) { console.log("message \n"+JSON.stringify(msg)+"\n result chosed\n"); }

I have enabled inline mode The problem is when user is querying inline by typing @bot in the same chat window of the bot then its coming in both function i try to figure out this problem but seems not possible.

how could query part get into message part is it kind of bug or there is some solution for the same. If so Please Let me Know Thanking you in Advance

shankar96 avatar Jun 09 '16 07:06 shankar96

You can distinguish them by the event name, chosen_inline_result or message

yagop avatar Jun 09 '16 08:06 yagop

thats my doubt as we can get it in the both event, i am using message event to get only text message and inline_result to get message from inline_clicks. so i want to distinguish it

shankar96 avatar Jun 09 '16 10:06 shankar96

You should be using text, instead of message to receive text messages! message event is fired for ALL types of updates!

gochomugo avatar Jan 06 '17 07:01 gochomugo