Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# 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, *, 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`

  New 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.

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

  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`]

  premium_subscription_month_count

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

    Type:

      `int`

  classmethod de_json(data, bot)

    See `telegram.TelegramObject.de_json`.