首页 > 解决方案 > python-telegram-bot:&=不支持的操作数类型:'function'和'_UpdateType'

问题描述

当机器人启动时,python-telegram-bot 库中会弹出一个错误。

  File "/usr/local/lib/python3.5/dist-packages/telegram/ext/messagehandler.py", line 131, in __init__
    self.filters &= Filters.update
TypeError: unsupported operand type(s) for &=: 'function' and '_UpdateType'
 unsupported operand type(s) for &=: 'function' and '_UpdateType'

在 messagehandler.py 中

    if message_updates is False and channel_post_updates is False and edited_updates is False:
        raise ValueError(
            'message_updates, channel_post_updates and edited_updates are all False')
    self.filters = filters
    if self.filters is not None:
        self.filters &= Filters.update
    else:
        self.filters = Filters.update

标签: pythontelegramtracebackoperands

解决方案


推荐阅读