1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/giftpack/commands/getgiftsrc.py

19 lines
540 B
Python
Raw Normal View History

2019-12-25 01:41:52 +00:00
from typing import *
from royalnet.commands import *
from .getgift import GetgiftCommand
from ..tables import XmasGift
from sqlalchemy.sql.expression import func
class GetgiftsrcCommand(GetgiftCommand):
name: str = "getgiftsrc"
aliases = ["drawgiftsrc"]
description: str = "Estrai un regalo con un certo mittente."
syntax: str = "{mittente}"
async def _get_gift(self, args, data):
return data.session.query(self.alchemy.get(XmasGift)).filter_by(drawn=False, source=args[0]).order_by(func.random()).first()