mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
new models, a model is passed to the command handler instead of a dictionary, removal of checks for intersection of processed triggers in handlers and much, much more
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
from typing import Callable
|
||||
from argenta.command import Command
|
||||
from argenta.command.flag.models import InputFlags
|
||||
|
||||
|
||||
class CommandHandler:
|
||||
def __init__(self, handler: Callable[[], None] | Callable[[dict], None], handled_command: Command):
|
||||
def __init__(self, handler: Callable[[], None] | Callable[[InputFlags], None], handled_command: Command):
|
||||
self.handler = handler
|
||||
self.handled_command = handled_command
|
||||
|
||||
def handling(self, input_flags: dict = None):
|
||||
if input_flags is not None:
|
||||
def handling(self, input_flags: InputFlags):
|
||||
if input_flags.get_flags():
|
||||
self.handler(input_flags)
|
||||
else:
|
||||
self.handler()
|
||||
|
||||
Reference in New Issue
Block a user