1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/rpgpack/commands/dndinfo.py
2020-02-18 14:48:21 +01:00

23 lines
744 B
Python

from royalnet.commands import *
from ..tables import DndCharacter, DndActiveCharacter
from ..utils import get_active_character
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:
author = await data.get_author(error_if_none=True)
active_character = await get_active_character(data)
char = active_character.character
if char is None:
raise CommandError("You don't have an active character.")
await data.reply(char.character_sheet())