1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
use serde::{Deserialize, Serialize};
use super::chat::Chat;
use super::message::Message;
use super::user::User;
// ---------------------------------------------------------------------------
// Giveaway
// ---------------------------------------------------------------------------
/// A scheduled giveaway.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Giveaway {
/// Chats the user must join to participate.
pub chats: Vec<Chat>,
/// Unix timestamp when the winner will be selected.
pub winners_selection_date: i64,
/// Number of users to be selected as winners.
pub winner_count: i64,
/// True if only users who join the chats after the giveaway started are eligible.
#[serde(skip_serializing_if = "Option::is_none")]
pub only_new_members: Option<bool>,
/// True if the list of winners will be visible to everyone.
#[serde(skip_serializing_if = "Option::is_none")]
pub has_public_winners: Option<bool>,
/// Description of an additional giveaway prize.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_description: Option<String>,
/// Two-letter ISO 3166-1 alpha-2 country codes for eligible users.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub country_codes: Vec<String>,
/// Stars split between giveaway winners; Star giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
/// Months the Telegram Premium subscription will be active; Premium giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub premium_subscription_month_count: Option<i64>,
}
// ---------------------------------------------------------------------------
// GiveawayCreated
// ---------------------------------------------------------------------------
/// Service message about the creation of a scheduled giveaway.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct GiveawayCreated {
/// Stars split between giveaway winners; Star giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
}
// ---------------------------------------------------------------------------
// GiveawayWinners
// ---------------------------------------------------------------------------
/// Message about the completion of a giveaway with public winners.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct GiveawayWinners {
/// Chat that created the giveaway.
pub chat: Chat,
/// Identifier of the message with the giveaway.
pub giveaway_message_id: i64,
/// Unix timestamp when winners were selected.
pub winners_selection_date: i64,
/// Total number of winners in the giveaway.
pub winner_count: i64,
/// List of giveaway winners.
pub winners: Vec<User>,
/// Number of other chats the user had to join.
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_chat_count: Option<i64>,
/// Months the Telegram Premium subscription will be active.
#[serde(skip_serializing_if = "Option::is_none")]
pub premium_subscription_month_count: Option<i64>,
/// Number of undistributed prizes.
#[serde(skip_serializing_if = "Option::is_none")]
pub unclaimed_prize_count: Option<i64>,
/// True if only users who joined after the giveaway started were eligible.
#[serde(skip_serializing_if = "Option::is_none")]
pub only_new_members: Option<bool>,
/// True if the giveaway was cancelled because the payment was refunded.
#[serde(skip_serializing_if = "Option::is_none")]
pub was_refunded: Option<bool>,
/// Description of an additional giveaway prize.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_description: Option<String>,
/// Stars split between giveaway winners; Star giveaways only.
#[serde(skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
}
// ---------------------------------------------------------------------------
// GiveawayCompleted
// ---------------------------------------------------------------------------
/// Service message about the completion of a giveaway without public winners.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct GiveawayCompleted {
/// Number of winners in the giveaway.
pub winner_count: i64,
/// Number of undistributed prizes.
#[serde(skip_serializing_if = "Option::is_none")]
pub unclaimed_prize_count: Option<i64>,
/// Message with the completed giveaway, if it was not deleted.
#[serde(skip_serializing_if = "Option::is_none")]
pub giveaway_message: Option<Box<Message>>,
/// True if this is a Telegram Star giveaway rather than a Premium giveaway.
#[serde(skip_serializing_if = "Option::is_none")]
pub is_star_giveaway: Option<bool>,
}