MCPcopy
hub / github.com/nonebot/nonebot2 / __call__

Method __call__

nonebot/rule.py:377–389  ·  view source on GitHub ↗
(
        self,
        cmd: tuple[str, ...] | None = Command(),
        cmd_arg: Message | None = CommandArg(),
        cmd_whitespace: str | None = CommandWhitespace(),
    )

Source from the content-addressed store, hash-verified

375 return hash((frozenset(self.cmds),))
376
377 async def __call__(
378 self,
379 cmd: tuple[str, ...] | None = Command(),
380 cmd_arg: Message | None = CommandArg(),
381 cmd_whitespace: str | None = CommandWhitespace(),
382 ) -> bool:
383 if cmd not in self.cmds:
384 return False
385 if self.force_whitespace is None or not cmd_arg:
386 return True
387 if isinstance(self.force_whitespace, str):
388 return self.force_whitespace == cmd_whitespace
389 return self.force_whitespace == (cmd_whitespace is not None)
390
391
392def command(

Callers

nothing calls this directly

Calls 3

CommandFunction · 0.90
CommandArgFunction · 0.90
CommandWhitespaceFunction · 0.90

Tested by

no test coverage detected