1234567891011 |
- import re
- from typing import List
- from million.model.message import Message
-
-
- def _wordFilter(msg: Message, words: List[str]) -> bool:
- rgx = r"(\b"+ r"\b|\b".join(words) + r"\b)"
- return msg.content and re.search(rgx, msg.content, re.I)
-
- def findWords(messages: List[Message], words: List[str]) -> List[Message]:
- return filter(lambda m: _wordFilter(m, words), messages)
|