python电报发送程序筛选器
我想创建一个处理程序,当一个concret用户(@exampleuser)发布一条包含单词列表中的单词的消息时触发它 这就是我所做的:python电报发送程序筛选器,python,python-3.x,telegram-bot,python-3.8,python-telegram-bot,Python,Python 3.x,Telegram Bot,Python 3.8,Python Telegram Bot,我想创建一个处理程序,当一个concret用户(@exampleuser)发布一条包含单词列表中的单词的消息时触发它 这就是我所做的: dispatcher.add_handler(MessageHandler(Filters.regex(re.compile(r'*example word from the wordlist*',re.IGNORECASE))和Filters.sender_chat(390077500)),wordBan) 但是如果我只使用:dispatcher.add\u
dispatcher.add_handler(MessageHandler(Filters.regex(re.compile(r'*example word from the wordlist*',re.IGNORECASE))和Filters.sender_chat(390077500)),wordBan)
但是如果我只使用:dispatcher.add\u handler(MessageHandler(Filters.sender\u chat(*example user id*)),wordBan),它就不起作用了。
它可以工作,但不会在具体用户发送消息时触发,而是在任何用户发送消息时触发
如何添加具体的用户筛选器使用
dispatcher.add_handler(MessageHandler(Filters.regex(re.compile(r'*example word from the wordlist*',re.IGNORECASE))&Filters.sender_chat(390077500)),wordBan)
您希望使用&
和|
组合PTB筛选器