1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-30 15:04:18 +00:00
royalnet/giftpack/commands/listgifts.py

20 lines
536 B
Python
Raw Normal View History

2019-12-25 01:41:52 +00:00
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)