|
| 1 | +# Pyrogram - Telegram MTProto API Client Library for Python |
| 2 | +# Copyright (C) 2017-present Dan <https://github.com/delivrance> |
| 3 | +# |
| 4 | +# This file is part of Pyrogram. |
| 5 | +# |
| 6 | +# Pyrogram is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Lesser General Public License as published |
| 8 | +# by the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# Pyrogram is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +import pyrogram |
| 20 | +from pyrogram import raw |
| 21 | +from ..object import Object |
| 22 | + |
| 23 | + |
| 24 | +class Giveaway(Object): |
| 25 | + """A Giveaway. |
| 26 | +
|
| 27 | + Parameters: |
| 28 | + client (pyrogram.Client): Pyrogram client |
| 29 | + channels (List of ``int`` ``64-bit``): |
| 30 | + quantity (``int`` ``32-bit``): |
| 31 | + months (``int`` ``32-bit``): |
| 32 | + until_date (``int`` ``32-bit``): |
| 33 | + only_new_subscribers (``bool``, *optional*): |
| 34 | + countries_iso2 (List of ``str``, *optional*): |
| 35 | +
|
| 36 | + """ |
| 37 | + |
| 38 | + def __init__( |
| 39 | + self, |
| 40 | + *, |
| 41 | + client: "pyrogram.Client" = None, |
| 42 | + channels, |
| 43 | + quantity, |
| 44 | + months, |
| 45 | + until_date, |
| 46 | + only_new_subscribers, |
| 47 | + countries_iso2, |
| 48 | + ): |
| 49 | + super().__init__(client) |
| 50 | + |
| 51 | + self.channels = channels |
| 52 | + self.quantity = quantity |
| 53 | + self.months = months |
| 54 | + self.until_date = until_date |
| 55 | + self.only_new_subscribers = only_new_subscribers |
| 56 | + self.countries_iso2 = countries_iso2 |
| 57 | + |
| 58 | + @staticmethod |
| 59 | + def _parse(client, giveaway: "raw.types.MessageMediaGiveaway"): |
| 60 | + return Giveaway( |
| 61 | + client=client, |
| 62 | + channels=giveaway.channels, |
| 63 | + quantity=giveaway.quantity, |
| 64 | + months=giveaway.months, |
| 65 | + until_date=giveaway.until_date, |
| 66 | + only_new_subscribers=giveaway.only_new_subscribers, |
| 67 | + countries_iso2=giveaway.countries_iso2 |
| 68 | + ) |
0 commit comments