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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
use serde::{Deserialize, Serialize};
/// Describes reply parameters for the message that is being sent.
/// # Documentation
/// <https://core.telegram.org/bots/api#replyparameters>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ReplyParameters {
/// Identifier of the message that will be replied to in the current chat, or in the chat `chat_id` if it is specified
pub message_id: i64,
/// If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats.
#[serde(skip_serializing_if = "Option::is_none")]
pub chat_id: Option<crate::types::ChatIdKind>,
/// Pass `true` if the message should be sent even if the specified message to be replied to is not found. Always `false` for replies in another chat or forum topic. Always `true` for messages sent on behalf of a business account.
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_sending_without_reply: Option<bool>,
/// Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, `custom_emoji`, and `date_time` entities. The message will fail to send if the quote isn't found in the original message.
#[serde(skip_serializing_if = "Option::is_none")]
pub quote: Option<Box<str>>,
/// Mode for parsing entities in the quote. See formatting options for more details.
#[serde(skip_serializing_if = "Option::is_none")]
pub quote_parse_mode: Option<Box<str>>,
/// A JSON-serialized list of special entities that appear in the quote. It can be specified instead of `quote_parse_mode`.
#[serde(skip_serializing_if = "Option::is_none")]
pub quote_entities: Option<Box<[crate::types::MessageEntity]>>,
/// Position of the quote in the original message in UTF-16 code units
#[serde(skip_serializing_if = "Option::is_none")]
pub quote_position: Option<i64>,
/// Identifier of the specific checklist task to be replied to
#[serde(skip_serializing_if = "Option::is_none")]
pub checklist_task_id: Option<i64>,
/// Persistent identifier of the specific poll option to be replied to
#[serde(skip_serializing_if = "Option::is_none")]
pub poll_option_id: Option<Box<str>>,
}
impl ReplyParameters {
/// Creates a new `ReplyParameters`.
///
/// # Arguments
/// * `message_id` - Identifier of the message that will be replied to in the current chat, or in the chat `chat_id` if it is specified
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<i64>>(message_id: T0) -> Self {
Self {
message_id: message_id.into(),
chat_id: None,
allow_sending_without_reply: None,
quote: None,
quote_parse_mode: None,
quote_entities: None,
quote_position: None,
checklist_task_id: None,
poll_option_id: None,
}
}
/// Identifier of the message that will be replied to in the current chat, or in the chat `chat_id` if it is specified
#[must_use]
pub fn message_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.message_id = val.into();
this
}
/// If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats.
#[must_use]
pub fn chat_id<T: Into<crate::types::ChatIdKind>>(self, val: T) -> Self {
let mut this = self;
this.chat_id = Some(val.into());
this
}
/// If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats.
#[must_use]
pub fn chat_id_option<T: Into<crate::types::ChatIdKind>>(self, val: Option<T>) -> Self {
let mut this = self;
this.chat_id = val.map(Into::into);
this
}
/// Pass `true` if the message should be sent even if the specified message to be replied to is not found. Always `false` for replies in another chat or forum topic. Always `true` for messages sent on behalf of a business account.
#[must_use]
pub fn allow_sending_without_reply<T: Into<bool>>(self, val: T) -> Self {
let mut this = self;
this.allow_sending_without_reply = Some(val.into());
this
}
/// Pass `true` if the message should be sent even if the specified message to be replied to is not found. Always `false` for replies in another chat or forum topic. Always `true` for messages sent on behalf of a business account.
#[must_use]
pub fn allow_sending_without_reply_option<T: Into<bool>>(self, val: Option<T>) -> Self {
let mut this = self;
this.allow_sending_without_reply = val.map(Into::into);
this
}
/// Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, `custom_emoji`, and `date_time` entities. The message will fail to send if the quote isn't found in the original message.
#[must_use]
pub fn quote<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.quote = Some(val.into());
this
}
/// Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, `custom_emoji`, and `date_time` entities. The message will fail to send if the quote isn't found in the original message.
#[must_use]
pub fn quote_option<T: Into<Box<str>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.quote = val.map(Into::into);
this
}
/// Mode for parsing entities in the quote. See formatting options for more details.
#[must_use]
pub fn quote_parse_mode<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.quote_parse_mode = Some(val.into());
this
}
/// Mode for parsing entities in the quote. See formatting options for more details.
#[must_use]
pub fn quote_parse_mode_option<T: Into<Box<str>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.quote_parse_mode = val.map(Into::into);
this
}
/// A JSON-serialized list of special entities that appear in the quote. It can be specified instead of `quote_parse_mode`.
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn quote_entities<T: Into<Box<[crate::types::MessageEntity]>>>(self, val: T) -> Self {
let mut this = self;
this.quote_entities = Some(
this.quote_entities
.unwrap_or_default()
.into_vec()
.into_iter()
.chain(val.into())
.collect(),
);
this
}
/// A JSON-serialized list of special entities that appear in the quote. It can be specified instead of `quote_parse_mode`.
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn quote_entity<T: Into<crate::types::MessageEntity>>(self, val: T) -> Self {
let mut this = self;
this.quote_entities = Some(
this.quote_entities
.unwrap_or_default()
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect(),
);
this
}
/// A JSON-serialized list of special entities that appear in the quote. It can be specified instead of `quote_parse_mode`.
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn quote_entities_option<T: Into<Box<[crate::types::MessageEntity]>>>(
self,
val: Option<T>,
) -> Self {
let mut this = self;
this.quote_entities = val.map(Into::into);
this
}
/// Position of the quote in the original message in UTF-16 code units
#[must_use]
pub fn quote_position<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.quote_position = Some(val.into());
this
}
/// Position of the quote in the original message in UTF-16 code units
#[must_use]
pub fn quote_position_option<T: Into<i64>>(self, val: Option<T>) -> Self {
let mut this = self;
this.quote_position = val.map(Into::into);
this
}
/// Identifier of the specific checklist task to be replied to
#[must_use]
pub fn checklist_task_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.checklist_task_id = Some(val.into());
this
}
/// Identifier of the specific checklist task to be replied to
#[must_use]
pub fn checklist_task_id_option<T: Into<i64>>(self, val: Option<T>) -> Self {
let mut this = self;
this.checklist_task_id = val.map(Into::into);
this
}
/// Persistent identifier of the specific poll option to be replied to
#[must_use]
pub fn poll_option_id<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.poll_option_id = Some(val.into());
this
}
/// Persistent identifier of the specific poll option to be replied to
#[must_use]
pub fn poll_option_id_option<T: Into<Box<str>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.poll_option_id = val.map(Into::into);
this
}
}