2019-11-11 09:34:05 +00:00
|
|
|
from royalnet.commands import *
|
|
|
|
from ..tables import DndCharacter, DndActiveCharacter
|
2020-02-18 13:48:21 +00:00
|
|
|
from ..utils import get_active_character
|
2019-11-11 09:34:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DndinfoCommand(Command):
|
|
|
|
name: str = "dndinfo"
|
|
|
|
|
|
|
|
description: str = "Display the character sheet of the active DnD character."
|
|
|
|
|
|
|
|
aliases = ["di", "dndi", "info", "dinfo"]
|
|
|
|
|
|
|
|
tables = {DndCharacter, DndActiveCharacter}
|
|
|
|
|
|
|
|
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
2020-02-18 13:48:21 +00:00
|
|
|
active_character = await get_active_character(data)
|
|
|
|
char = active_character.character
|
|
|
|
|
|
|
|
if char is None:
|
2019-11-11 09:34:05 +00:00
|
|
|
raise CommandError("You don't have an active character.")
|
2020-02-18 13:48:21 +00:00
|
|
|
await data.reply(char.character_sheet())
|