Taosky / telegram-search-bot

A telegram group record search bot that solves the problem of direct search inability in languages such as CJK / Telegram 群聊天记录搜索Bot,解决CJK等语言无法直接搜索问题
MIT License
356 stars 47 forks source link

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

Closed X1A0CA1 closed 1 year ago

X1A0CA1 commented 1 year ago

上报错代码

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'
X1A0CA1 commented 1 year ago

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

image

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