You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
InputRichBlock*.to_dict() fails when RichText is a string or RichText object #2609
InputRichBlock serialization assumes that every RichText value implements .to_dict(), but RichText fields can contain plain strings as well as RichText* objects (RichTextBold, etc). send_rich_message() fails during serialization for both cases. This is on the latest TeleBot version.
File ".../telebot/types.py", line 16726, in to_dict
data['text'] = self.text.to_dict()
^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'to_dict'
File ".../telebot/types.py", line 16696, in to_dict
data['text'] = self.text.to_dict()
^^^^^^^^^^^^^^^^^
AttributeError: 'RichTextBold' object has no attribute 'to_dict'
This also affects relaying received rich messages and trying to send them exactly as they were received, which I was attempting to do to test my bot's implementation, since received blocks contain nested RichText values that can be passed into the corresponding InputRichBlock objects. InputRichBlock*.to_dict() assumes "data['text'] = self.text.to_dict()" but RichText can recursively contain strings, lists, and other RichText* objects.
telebot/types.py", line 17380, in to_dict
data['caption'] = self.caption.to_dict()
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'RichBlockCaption' object has no attribute 'to_dict'
Activity
Badiboy commentedon Aug 9, 2026
"Currently, it can be either a String for plain text, an Array of RichText"
Confirm, we missed that. Will fix.
Badiboy commentedon Aug 9, 2026
Could you please try this PR?
#2610
All-The-Foxes commentedon Aug 9, 2026
The PR is working. I can send rich messages now.
All-The-Foxes commentedon Aug 9, 2026
Hold on, RichBlockCaption has the same issue.