Files
neonsr/game_server/game/chat/decorators.py
Naruse ec8972d5d6 init
2025-04-15 19:36:05 +08:00

22 lines
470 B
Python

from typing import Dict, Type
command_registry: Dict[str, Type] = {}
def Command(prefix: str, usage: str, aliases: list = list()):
def decorator(func):
func.usage = usage
func.prefix = prefix
func.is_alias = False
command_registry[prefix] = func
# Register alias if exist
for alias in aliases:
func.is_alias = True
command_registry[alias] = func
return func
return decorator