mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Display the currently active character in dndactive if it receives no parameters
This commit is contained in:
parent
beb670eb89
commit
d788057e15
1 changed files with 7 additions and 3 deletions
|
@ -16,9 +16,14 @@ class DndactiveCommand(Command):
|
||||||
|
|
||||||
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
||||||
identifier = args.optional(0)
|
identifier = args.optional(0)
|
||||||
|
author = await data.get_author(error_if_none=True)
|
||||||
if identifier is None:
|
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:
|
try:
|
||||||
identifier = int(identifier)
|
identifier = int(identifier)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -40,7 +45,6 @@ class DndactiveCommand(Command):
|
||||||
if char is None:
|
if char is None:
|
||||||
raise CommandError("No character found.")
|
raise CommandError("No character found.")
|
||||||
# Check if the player already has an active character
|
# 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:
|
if author.dnd_active_character is None:
|
||||||
# Create a new active character
|
# Create a new active character
|
||||||
achar = self.alchemy.DndActiveCharacter(character=char, user=author)
|
achar = self.alchemy.DndActiveCharacter(character=char, user=author)
|
||||||
|
|
Loading…
Reference in a new issue