TexLiLy/router.py
LoaD Accumulator 5ed3e6743c
[ADD] Add a router and a way for a user to delete styles.
I should work soon on the Lilypond part of things.
2023-06-14 07:40:15 +02:00

16 lines
438 B
Python

from nio import RoomMessageText
import typing
routes = {}
helptxt = {}
def add_route(cmd: str, hlp: str, func: typing.Callable) -> None:
if cmd not in routes.keys():
routes[cmd] = func
helptxt[cmd] = hlp
async def handle_command(command: str, room: str, event: RoomMessageText, args: list):
import utils
if command in routes.keys():
await routes[command](utils.get_client(), room, event, args)