mdibaiee / node-telegram-api

A simple API to create and control Telegram bots
MIT License
121 stars 21 forks source link

Fix edge case when message object is undefined #37

Closed laurynas-karvelis closed 6 years ago

laurynas-karvelis commented 6 years ago

It appears when communicating with telegram bot rapidly, entire message object sometimes becomes undefined, hence forcing node.js to throw an underfined 'chat' property error.

This is a quick fix, although it fixes the symptom, I'm not entirely sure it fixes the cause of this error. Looking forward to your feedback.

Thank you for this awesome lib, BTW! :)

mdibaiee commented 6 years ago

@laurynas-karvelis Thanks for the pull-request! I see, that makes sense, not all updates have a message property, it is an optional property. Sometimes there are edited_message, etc. instead. (https://core.telegram.org/bots/api#getting-updates)

anyways, I think your solution works! will publish a new version :+1:

mdibaiee commented 6 years ago

Published telegram-api@0.9.1

laurynas-karvelis commented 6 years ago

Wow, that was a quick merge and publish! Once again, thanks a lot!