A single slash-command definition.
| 36 | |
| 37 | @dataclass(frozen=True, slots=True, kw_only=True) |
| 38 | class SlashCommand: |
| 39 | """A single slash-command definition.""" |
| 40 | |
| 41 | name: str |
| 42 | """Canonical command name (e.g. `/quit`).""" |
| 43 | |
| 44 | description: str |
| 45 | """Short user-facing description.""" |
| 46 | |
| 47 | bypass_tier: BypassTier |
| 48 | """Queue-bypass classification.""" |
| 49 | |
| 50 | hidden_keywords: str = "" |
| 51 | """Space-separated terms for fuzzy matching (never displayed).""" |
| 52 | |
| 53 | argument_hint: str = "" |
| 54 | """Placeholder text for autocomplete when the command accepts args.""" |
| 55 | |
| 56 | aliases: tuple[str, ...] = () |
| 57 | """Alternative names (e.g. `("/q",)` for `/quit`).""" |
| 58 | |
| 59 | def to_entry(self) -> CommandEntry: |
| 60 | """Project this command into a `CommandEntry` for autocomplete. |
| 61 | |
| 62 | Returns: |
| 63 | A `CommandEntry` carrying only the fields the autocomplete |
| 64 | layer needs. |
| 65 | """ |
| 66 | return CommandEntry( |
| 67 | name=self.name, |
| 68 | description=self.description, |
| 69 | hidden_keywords=self.hidden_keywords, |
| 70 | argument_hint=self.argument_hint, |
| 71 | ) |
| 72 | |
| 73 | |
| 74 | COMMANDS: tuple[SlashCommand, ...] = ( |