From d788057e15d3c6415290f86e205f9a9d3473f8f7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 25 Oct 2019 13:33:40 +0200 Subject: [PATCH] Display the currently active character in dndactive if it receives no parameters --- royalnet/packs/rpg/commands/dndactive.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/royalnet/packs/rpg/commands/dndactive.py b/royalnet/packs/rpg/commands/dndactive.py index 667474f5..cd9cb71a 100644 --- a/royalnet/packs/rpg/commands/dndactive.py +++ b/royalnet/packs/rpg/commands/dndactive.py @@ -16,9 +16,14 @@ class DndactiveCommand(Command): async def run(self, args: CommandArgs, data: CommandData) -> None: identifier = args.optional(0) + author = await data.get_author(error_if_none=True) if identifier is None: - # Display the active character identifiers - ... + # Display the active character + if author.dnd_active_character is None: + await data.reply("ℹ️ You have no active characters.") + else: + await data.reply(f"ℹ️ You currently have [b]{author.dnd_active_character}[/b] as active character.") + return try: identifier = int(identifier) except ValueError: @@ -40,7 +45,6 @@ class DndactiveCommand(Command): if char is None: raise CommandError("No character found.") # Check if the player already has an active character - author = await data.get_author(error_if_none=True) if author.dnd_active_character is None: # Create a new active character achar = self.alchemy.DndActiveCharacter(character=char, user=author)