eternnoir / pyTelegramBotAPI

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

Infinity polling exception: ChatBoost.__init__() missing 3 required positional arguments #2175

Closed BrandonTay2001 closed 8 months ago

BrandonTay2001 commented 8 months ago

Discussed in https://github.com/eternnoir/pyTelegramBotAPI/discussions/2174

Originally posted by **BrandonTay2001** February 17, 2024 Receiving this exception on a bot I was running on a server and I'm not quite sure what to make of it. I run multiple bots but only one of them was affected by this bug. A simple restart seemed to have eliminated the issue, but I'm wondering if this is an issue with the `.infinity_polling()` method in the library. The issue doesn't seem to be originating from my bot file main.py. Attaching the full exception below: `2024-02-17 12:11:42,006 (__init__.py:1021 MainThread) ERROR - TeleBot: "Infinity polling exception: ChatBoost.__init__() missing 3 required positional arguments: 'boost_id', 'add_date', and 'expiration_date'" 2024-02-17 12:11:42,006 (__init__.py:1023 MainThread) ERROR - TeleBot: "Exception traceback: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1016, in infinity_polling self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1104, in polling self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1179, in __threaded_polling raise e File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1140, in __threaded_polling polling_thread.raise_exceptions() File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 110, in raise_exceptions raise self.exception_info File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 92, in run task(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 661, in __retrieve_updates updates = self.get_updates(offset=(self.last_update_id + 1), File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 636, in get_updates return [types.Update.de_json(ju) for ju in json_updates] File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 636, in return [types.Update.de_json(ju) for ju in json_updates] File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 207, in de_json chat_boost = ChatBoost.de_json(obj.get('chat_boost')) File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 9160, in de_json return cls(**obj) TypeError: ChatBoost.__init__() missing 3 required positional arguments: 'boost_id', 'add_date', and 'expiration_date'` Thanks :)
coder2020official commented 8 months ago

Install github version, maybe it will fix it

Badiboy commented 8 months ago

What pyTelegramBotAPI version? Looks like not the most recent: update first.

BrandonTay2001 commented 8 months ago

This is version 4.15.4. Updated pyTelegramBotAPI to the latest version though I don't know how the bug arose in the first place so I can't really try to recreate the issue. The exception was from my server logs and the bot was running without issue for multiple weeks.

So far so good on the latest version.

More information if needed: OS: Ubuntu 22.04 Python version: 3.10.12