eternnoir / pyTelegramBotAPI

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

KeyError: type #2150

Closed thefoxcc closed 9 months ago

thefoxcc commented 9 months ago

Please answer these questions before submitting your issue. Thanks!

`Jan 30 13:42:09 2451826-ro30935.twc1.net python3[103154]: KeyError: 'type' Jan 30 13:42:09 2451826-ro30935.twc1.net python3[103154]: " Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: 2024-01-30 13:42:13,221 (init.py:1021 MainThread) ERROR - TeleBot: "Infinity polling exception: 'type'" Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: 2024-01-30 13:42:13,222 (init.py:1023 MainThread) ERROR - TeleBot: "Exception traceback: Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: Traceback (most recent call last): Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 1016, in infinity_polling Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout, Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 1104, in polling Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: self.threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 1179, in __threaded_polling Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: raise e Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 1140, in threaded_polling Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: polling_thread.raise_exceptions() Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 110, in raise_exceptions Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: raise self.exception_info Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 92, in run Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: task(*args, **kwargs) Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 661, in retrieve_updates Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: updates = self.get_updates(offset=(self.last_update_id + 1), Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init__.py", line 636, in get_updates Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: return [types.Update.de_json(ju) for ju in json_updates] Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/init.py", line 636, in Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: return [types.Update.de_json(ju) for ju in json_updates] Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 206, in de_json Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: removed_chat_boost = ChatBoostRemoved.de_json(obj.get('removed_chat_boost')) Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 8993, in de_json Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: obj['source'] = ChatBoostSource.de_json(obj['source']) Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 9024, in de_json Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: if obj["type"] == "premium": Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: KeyError: 'type' Jan 30 13:42:13 2451826-ro30935.twc1.net python3[103154]: " lines 1162-1218/1218 (END)

  1. What version of pyTelegramBotAPI are you using? Name: pyTelegramBotAPI Version: 4.15.3 Summary: Python Telegram bot api. Home-page: https://github.com/eternnoir/pyTelegramBotAPI Author: eternnoir Author-email: eternnoir@gmail.com License: GPL2 Location: /usr/local/lib/python3.10/dist-packages Requires: requests Required-by: telebot

  2. What OS are you using? Ubuntu 22

  3. What version of python are you using? 3.10.12

Badiboy commented 9 months ago

https://github.com/eternnoir/pyTelegramBotAPI/pull/2152 Fixed, sorry.