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
use serde::{Deserialize, Serialize};
/// The price of a suggested post.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostPrice {
/// Currency in which the post will be paid.
///
/// Currently `"XTR"` for Telegram Stars or `"TON"` for toncoins.
pub currency: String,
/// Amount in the smallest units of the currency.
///
/// Stars must be between 5–100,000; nanotoncoins between 10,000,000–10,000,000,000,000.
pub amount: i64,
}
/// Information about a suggested post pending review.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostInfo {
/// State of the suggested post.
///
/// One of `"pending"`, `"approved"`, or `"declined"`.
pub state: String,
/// Proposed price of the post; absent if the post is unpaid.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
/// Proposed Unix timestamp when the post will be sent; absent if no date was specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
}
/// Parameters for a post being suggested by the bot.
///
/// Pass this in `suggested_post_parameters` on outgoing send methods.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostParameters {
/// Proposed price for the post; absent if the post is unpaid.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
/// Proposed Unix send date; must be 300–2,678,400 seconds in the future if set.
#[serde(skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
}
/// Service message: a suggested post was approved.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostApproved {
/// Message containing the suggested post.
///
/// Boxed to break the `Message → SuggestedPostApproved → Message` cycle.
/// Will not contain `reply_to_message` even if the message itself is a reply.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<crate::message::Message>>,
/// Amount paid for the post.
#[serde(skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
/// Unix timestamp when the post will be published.
pub send_date: i64,
}
/// Service message: approval of a suggested post failed.
///
/// Currently only caused by insufficient user funds at the time of approval.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostApprovalFailed {
/// Message containing the suggested post whose approval failed.
///
/// Boxed to break the recursive cycle. Will not contain `reply_to_message`.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<crate::message::Message>>,
/// Expected price of the post.
pub price: SuggestedPostPrice,
}
/// Service message: a suggested post was declined.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostDeclined {
/// Message containing the suggested post.
///
/// Boxed to break the recursive cycle. Will not contain `reply_to_message`.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<crate::message::Message>>,
/// Comment with which the post was declined.
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
}
/// Service message: payment for a suggested post was received.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostPaid {
/// Message containing the suggested post.
///
/// Boxed to break the recursive cycle. Will not contain `reply_to_message`.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<crate::message::Message>>,
/// Currency in which the payment was made (`"XTR"` or `"TON"`).
pub currency: String,
/// Amount received in nanotoncoins; present only for TON payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// Amount of Telegram Stars received; present only for Star payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub star_amount: Option<crate::payments::StarAmount>,
}
/// Service message: payment for a suggested post was refunded.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPostRefunded {
/// Message containing the suggested post.
///
/// Boxed to break the recursive cycle. Will not contain `reply_to_message`.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<crate::message::Message>>,
/// Reason for the refund.
///
/// One of `"post_deleted"` or `"payment_refunded"`.
pub reason: String,
}