Skip to content
Back to top
View this page

# Giveaway

class telegram.Giveaway(chats, winners_selection_date, winner_count, only_new_members=None, has_public_winners=None, prize_description=None, country_codes=None, premium_subscription_month_count=None, prize_star_count=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object represents a message about a scheduled giveaway.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `chats`, `winners_selection_date` and `winner_count` are equal.

  Available In

  - `telegram.ExternalReplyInfo.giveaway`

  - `telegram.Message.giveaway`

  Added in version 20.8.

  Parameters:

    - chats (tuple[`telegram.Chat`]) – The list of chats which the user must join to participate in the giveaway.

    - winners_selection_date (`datetime.datetime`) – The date when the giveaway winner will be selected. The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    - winner_count (`int`) – The number of users which are supposed to be selected as winners of the giveaway.

    - only_new_members (`True`, optional) – If `True`, only users who join the chats after the giveaway started should be eligible to win.

    - has_public_winners (`True`, optional) – `True`, if the list of giveaway winners will be visible to everyone

    - prize_description (`str`, optional) – Description of additional giveaway prize

    - country_codes (Sequence[`str`]) – A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.

    - prize_star_count (`int`, optional) –

      The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only.

      Added in version 21.6.

    - premium_subscription_month_count (`int`, optional) – The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only.

  chats

    The list of chats which the user must join to participate in the giveaway.

    Type:

      Sequence[`telegram.Chat`]

  winners_selection_date

    The date when the giveaway winner will be selected. The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Type:

      `datetime.datetime`

  winner_count

    The number of users which are supposed to be selected as winners of the giveaway.

    Type:

      `int`

  only_new_members

    Optional. If `True`, only users who join the chats after the giveaway started should be eligible to win.

    Type:

      `True`

  has_public_winners

    Optional. `True`, if the list of giveaway winners will be visible to everyone

    Type:

      `True`

  prize_description

    Optional. Description of additional giveaway prize

    Type:

      `str`

  country_codes

    Optional. A tuple of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.

    Type:

      tuple[`str`]

  prize_star_count

    Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only.

    Added in version 21.6.

    Type:

      `int`

  premium_subscription_month_count

    Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only.

    Type:

      `int`

  classmethod de_json(data, bot=None)

    See `telegram.TelegramObject.de_json()`.