Answer the question
In order to leave comments, you need to log in
Python-telegram-bot how to solve process_update errors?
Good afternoon, I'm trying to launch a bot, with a simple task - to filter images in a chat and forward them to a neighboring chat / channel. I can not solve the errors, please tell me, while I am just studying this industry.
Tried running both on local machine and in cloud (Oracle Cloud, Ubuntu VM)
Errors:
2022-02-16 08:01:50,481 [telegram.ext] [ERROR] No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
handler.handle_update(update, self, check, context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/telegram/ext/handler.py", line 198, in handle_update
return self.callback(update, context)
File "/home/ubuntu/bot/functionalities/forwarder.py", line 22, in call
if Filters.photo.filter(update.message):
AttributeError: 'CallbackContext' object has no attribute 'message'
Images in buffer: 0
check = handler.check_update(update)
if check is not None and check is not False:
if not context and self.use_context:
context = self.context_types.context.from_update(update, self)
context.refresh_data()
handled = True
sync_modes.append(handler.run_async)
-> handler.handle_update(update, self, check, context)
break
if context:
self.collect_additional_context(context, update, dispatcher, check_result)
if run_async:
return dispatcher.run_async(self.callback, update, context, update=update)
-> return self.callback(update, context)
optional_args = self.collect_optional_args(dispatcher, update, check_result)
if run_async:
return dispatcher.run_async(
self.callback, dispatcher.bot, update, update=update, **optional_args
)
return self.callback(dispatcher.bot, update, **optional_args)
def call(self, bot, update: telegram.Update):
if Filters.photo.filter(update.message):
self.share_photo(bot, update)
elif Filters.document.filter(update.message):
self.share_document(bot, update)
elif Filters.entity(telegram.MessageEntity.URL).filter(update.message):
self.share_url(bot, update)
Answer the question
In order to leave comments, you need to log in
As it turned out, everything is simple, the bot is written for some old version of telegram-bot, which was not indicated in the requirements ..
I managed to solve the problem of downgrading to version 11 in pycharm. It remains to figure out how to put the old version on the VM with ubuntu.
In search of a solution, I came across similar problems that remained unresolved - you can try to update the code for 12, an example on github
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question