Exemplo n.º 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
     )
Exemplo n.º 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,
         ))
Exemplo n.º 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
Exemplo n.º 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))
Exemplo n.º 5
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "meta_event"
Exemplo n.º 6
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "request"
Exemplo n.º 7
0
 async def __call__(self, type: str = EventType()) -> bool:
     return type == "notice"
Exemplo n.º 8
0
async def event_type(t: str = EventType()) -> str:
    return t