-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Environment
- OS: Windows 11 (64-bit)
- Python: 3.11.x (installation path: C:\Users\JC\AppData\Roaming\Python\Python314)
- pyTelegramBotAPI: 4.31.0
- Bot: long-polling worker running main1.py
Steps to Reproduce
- Register a handler that calls bot.get_chat(call.from_user.id) inside a callback query worker.
- Run the bot and trigger the handler from a user/chat that exposes the new Telegram field unique_gift_colors.
- Observe the worker thread.
Actual Result
bot.get_chat raises NotImplementedError inside telebot.types.UniqueGiftColors.de_json because the library tries to parse unique_gift_colors but the dataclass has not been implemented yet. The worker thread crashes with the following stack trace:
Traceback (most recent call last):
File "e:\my\starmarket bot\main1.py", line 5219, in worker
chat = bot.get_chat(call.from_user.id)
File "C:\Users\JC\AppData\Roaming\Python\Python314\site-packages\telebot\__init__.py", line 1572, in get_chat
return types.ChatFullInfo.de_json(
apihelper.get_chat(self.token, chat_id)
)
File "C:\Users\JC\AppData\Roaming\Python\Python314\site-packages\telebot\types.py", line 804, in de_json
obj['unique_gift_colors'] = UniqueGiftColors.de_json(obj['unique_gift_colors'])
File "C:\Users\JC\AppData\Roaming\Python\Python314\site-packages\telebot\types.py", line 89, in de_json
raise NotImplementedError
NotImplementedError
Expected Result
bot.get_chat should deserialize ChatFullInfo even when the Telegram Bot API includes unique_gift_colors, or ignore that field until support ships, instead of raising NotImplementedError.
Additional Notes
- The error started appearing after Telegram added unique_gift_colors to ChatFullInfo. No local code touches that field.
- Temporary workaround is to avoid calling get_chat for chats that include unique_gift_colors, but an official fix is required in telebot.types.UniqueGiftColors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels