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