Beispiel #1
0
 async def __call__(
     self, type_: str = EventType(), text: str = EventPlainText()
 ) -> bool:
     return (
         type_ == "message"
         and (text.casefold() if self.ignorecase else text) in self.msg
     )
Beispiel #2
0
 async def __call__(
     self, type: str = EventType(), text: str = EventPlainText()) -> Any:
     if type != "message":
         return False
     return bool(
         re.search(
             f"(?:{'|'.join(re.escape(prefix) for prefix in self.msg)})$",
             text,
             re.IGNORECASE if self.ignorecase else 0,
         ))
Beispiel #3
0
 async def __call__(
         self,
         state: T_State,
         type: str = EventType(),
         msg: Message = EventMessage(),
 ) -> bool:
     if type != "message":
         return False
     matched = re.search(self.regex, str(msg), self.flags)
     if matched:
         state[REGEX_MATCHED] = matched.group()
         state[REGEX_GROUP] = matched.groups()
         state[REGEX_DICT] = matched.groupdict()
         return True
     else:
         return False
Beispiel #4
0
 async def __call__(
     self, type: str = EventType(), text: str = EventPlainText()) -> bool:
     if type != "message":
         return False
     return bool(text and any(keyword in text for keyword in self.keywords))
Beispiel #5
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "meta_event"
Beispiel #6
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "request"
Beispiel #7
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "notice"
Beispiel #8
0
async def event_type(t: str = EventType()) -> str:
    return t