conogram/entities/giveaway.rs
1use serde::{Deserialize, Serialize};
2
3use crate::{entities::chat::Chat, utils::deserialize_utils::is_false};
4
5/// This object represents a message about a scheduled giveaway.
6///
7/// API Reference: [link](https://core.telegram.org/bots/api/#giveaway)
8#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
9pub struct Giveaway {
10 /// The list of chats which the user must join to participate in the giveaway
11 pub chats: Vec<Chat>,
12
13 /// Point in time (Unix timestamp) when winners of the giveaway will be selected
14 pub winners_selection_date: i64,
15
16 /// The number of users which are supposed to be selected as winners of the giveaway
17 pub winner_count: i64,
18
19 /// *Optional*. *True*, if only users who join the chats after the giveaway started should be eligible to win
20 #[serde(default, skip_serializing_if = "is_false")]
21 pub only_new_members: bool,
22
23 /// *Optional*. *True*, if the list of giveaway winners will be visible to everyone
24 #[serde(default, skip_serializing_if = "is_false")]
25 pub has_public_winners: bool,
26
27 /// *Optional*. Description of additional giveaway prize
28 #[serde(default, skip_serializing_if = "Option::is_none")]
29 pub prize_description: Option<String>,
30
31 /// *Optional*. A list of two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/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.
32 #[serde(default, skip_serializing_if = "Vec::is_empty")]
33 pub country_codes: Vec<String>,
34
35 /// *Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
36 #[serde(default, skip_serializing_if = "Option::is_none")]
37 pub prize_star_count: Option<i64>,
38
39 /// *Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only
40 #[serde(default, skip_serializing_if = "Option::is_none")]
41 pub premium_subscription_month_count: Option<i64>,
42}
43
44// Divider: all content below this line will be preserved after code regen