mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 20:55:09 +00:00
* Attempts at getting macro aliases to work * Store instances of macros as well as just the classes * Add ?unresolve and ?open aliases for ?reopen * Add an error message for invalid macros * Add ?close as an alias for ?resolve * Add error message for running a macro on a closed ticket * Allow ?thread to be run on closed tickets * Add type annotation to macro list
20 lines
547 B
Python
20 lines
547 B
Python
from prisma.models import Ticket
|
|
from prisma.models import User
|
|
|
|
|
|
class Macro:
|
|
name: str
|
|
aliases: list[str] = []
|
|
can_run_on_closed: bool = False
|
|
|
|
async def run(self, ticket: Ticket, helper: User, **kwargs) -> None:
|
|
"""
|
|
Run the macro with the given arguments.
|
|
"""
|
|
raise NotImplementedError("Subclasses must implement this method.")
|
|
|
|
def all_aliases(self) -> set[str]:
|
|
"""
|
|
Get all names for this macro, including aliases.
|
|
"""
|
|
return set([self.name] + self.aliases)
|