feat: rebuild AI commands and migrate config to TOML
This commit is contained in:
@@ -106,18 +106,6 @@ def require_args_check() -> CommandCheck:
|
||||
return CommandCheck("require_args", _check, "Require non-empty arguments")
|
||||
|
||||
|
||||
def combine_checks(*checks: CommandCheck) -> CommandCheck:
|
||||
async def _check(ctx: "CommandContext") -> CheckResult:
|
||||
for check in checks:
|
||||
result = await check.run(ctx)
|
||||
if not result.allowed:
|
||||
return result
|
||||
return CheckResult.allow()
|
||||
|
||||
names = "+".join(check.name for check in checks) or "combined"
|
||||
return CommandCheck(names, _check, "Combined checks")
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class CommandContext:
|
||||
client: "Client"
|
||||
@@ -208,9 +196,6 @@ class CommandDefinition:
|
||||
return self.owner_prefix
|
||||
return self.owner_prefix if is_owner else self.guest_prefix
|
||||
|
||||
def accepts_prefix(self, prefix: str, *, is_owner: bool) -> bool:
|
||||
return prefix == self.expected_prefix(is_owner)
|
||||
|
||||
def help_line(self, ctx: CommandContext | None = None) -> str:
|
||||
usage = self.usage or self.display_name
|
||||
details: list[str] = []
|
||||
@@ -342,9 +327,6 @@ class CommandRegistry:
|
||||
canonical = self._aliases.get(normalized, normalized)
|
||||
return self._commands.get(canonical)
|
||||
|
||||
def has_name(self, token: str) -> bool:
|
||||
return self.resolve(token) is not None
|
||||
|
||||
def iter_commands(self) -> list[CommandDefinition]:
|
||||
return [self._commands[name] for name in self._order]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user