1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/giftpack/commands/listgifts.py

19 lines
536 B
Python

from typing import *
from royalnet.commands import *
from ..tables import XmasGift
class ListgiftsCommand(Command):
name: str = "listgifts"
aliases = ["listgift"]
description: str = "Elenca tutti i regali registrati."
syntax: str = ""
async def run(self, args: CommandArgs, data: CommandData) -> None:
gifts = data.session.query(self.alchemy.get(XmasGift)).all()
msg = "🎁 Elenco regali:\n"
gift_msg = "\n".join([str(gift) for gift in gifts])
await data.reply(msg + gift_msg)