Taosky/telegram-search-bot

当群内有人使用以频道身份发言或者是 anonymous admin 发言的时候会报错

X1A0CA1 opened this issue · 1 comments

上报错代码

2022-10-30 06:23:47,825 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/telegram/ext/dispatcher.py", line 555, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.7/site-packages/telegram/ext/handler.py", line 198, in handle_update
    return self.callback(update, context)
  File "/app/user_handlers/msg_store.py", line 41, in store_message
    or update.message.from_user.is_bot \
AttributeError: 'NoneType' object has no attribute 'from_user'

简单的看了下使用模块的文档,貌似是以频道发言的时候没有 from_user 这个字段,只有sender_chat 这个字段

image

https://docs.python-telegram-bot.org/en/v20.0a4/telegram.message.html