Deperately trying to figure out angular

This commit is contained in:
Cynopolis
2025-04-04 20:11:23 -04:00
parent 185182b92f
commit 9465a3915c
25 changed files with 14892 additions and 0 deletions

18
backend/CommandHandler.py Normal file
View File

@@ -0,0 +1,18 @@
class CommandHandler:
def __init__(self, print_method):
self.commands: dict = {}
self.print = print_method
def register_callback(self, key: str, callback):
self.commands[key.lower()] = callback
def parse_command(self, command : str):
args :list[str] = command.split(" ")
if args[0].lower() in self.commands:
return_message = self.commands[args[0].lower()](args[1:])
if not (return_message is None):
self.print(return_message)
else:
self.print("Command not recognized. Type 'help' for a list of commands.")