Ich habe eine CallBack-Funktion in Python-Telegram-Bot Wrapper erstellt.
def add2(update: Updater, context: CallbackContext):
query = update.callback_query
# add()
query2 = link1
_mirror(bot, update, query2)
query.answer()
Aber ich bekomme AttributeError: 'NoneType' objcet Has No Attribute 'Message_id'
2022-04-12 06:37:46,195 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/telegram/ext/dispatcher.py", line 343, in process_update
handler.handle_update(update, self, check, context)
File "/usr/local/lib/python3.8/dist-packages/telegram/ext/handler.py", line 117, in handle_update
return self.callback(update, context)
File "/usr/src/app/bot/modules/mirror.py", line 266, in add2
_mirror(bot, update, query2)
File "/usr/src/app/bot/modules/mirror.py", line 228, in _mirror
listener = MirrorListener(bot, update,isTar, tag, extract)
File "/usr/src/app/bot/modules/mirror.py", line 39, in __init__
super().__init__(bot, update)
File "/usr/src/app/bot/helper/mirror_utils/status_utils/listeners.py", line 6, in __init__
self.uid = self.message.message_id
AttributeError: 'NoneType' object has no attribute 'message_id'
Unten ist der Link der _mirror-Funktion:
https://github.com/lzzy12/python-aria-mirror-bot/blob/master/bot/modules/mirror.py
Lösung des Problems
die _mirror
funktion übergibt die update
an MirrorListener
die anscheinend update.message
nicht None
. aber der add2
callback wird anscheinend als callback für einen verwendet CallbackQueryHandler
, da man darauf zugreift update.callback_query
.
Keine Kommentare:
Kommentar veröffentlichen