diff --git a/rpgpack/commands/dndaddunit.py b/rpgpack/commands/dndaddunit.py index 56f6d720..b7637968 100644 --- a/rpgpack/commands/dndaddunit.py +++ b/rpgpack/commands/dndaddunit.py @@ -5,6 +5,7 @@ import royalnet.utils as ru from ..types import Faction from ..tables import DndBattleUnit from ..utils import get_active_battle +from ..types import Health class DndaddunitCommand(rc.Command): @@ -37,6 +38,11 @@ class DndaddunitCommand(rc.Command): if len(units_with_same_name) != 0: raise rc.InvalidInputError("A unit with the same name already exists.") + try: + health = Health.from_text(health) + except ValueError: + raise rc.InvalidInputError("Invalid health string.") + dbu = DndBattleUnitT( linked_character_id=None, initiative=initiative, @@ -54,4 +60,4 @@ class DndaddunitCommand(rc.Command): f"joins the battle!") if dbu.health.hidden: - await data.delete_invoking() \ No newline at end of file + await data.delete_invoking()