(self, event: Event, state: T_State)
| 163 | return hash((frozenset(self.msg), self.ignorecase)) |
| 164 | |
| 165 | async def __call__(self, event: Event, state: T_State) -> bool: |
| 166 | try: |
| 167 | text = event.get_plaintext() |
| 168 | except Exception: |
| 169 | return False |
| 170 | if match := re.match( |
| 171 | f"^(?:{'|'.join(re.escape(prefix) for prefix in self.msg)})", |
| 172 | text, |
| 173 | re.IGNORECASE if self.ignorecase else 0, |
| 174 | ): |
| 175 | state[STARTSWITH_KEY] = match.group() |
| 176 | return True |
| 177 | return False |
| 178 | |
| 179 | |
| 180 | def startswith(msg: str | tuple[str, ...], ignorecase: bool = False) -> Rule: |
nothing calls this directly
no test coverage detected