eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.11k stars 2.03k forks source link

MessageEntity.user is optional, need to check if field is not None before serialization #2289

Closed miniusercoder closed 5 months ago

miniusercoder commented 5 months ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? GitHub version commit #139d35f

  2. What OS are you using? Windows

  3. What version of python are you using? 3.12

If MessageEntity type is not text_mention, so "user" field would be None, so calling to_dict() method on it will raise AttributeError: 'NoneType' object has no attribute 'to_dict'

Badiboy commented 5 months ago

My bad, sorry.

https://github.com/eternnoir/pyTelegramBotAPI/pull/2290