1use crate::bot::Part;
2use crate::{
3 bot::{ApiError, Bot, BotResult, Response},
4 gen_types::*,
5};
6use anyhow::Result;
7use reqwest::multipart::Form;
8use serde::{Deserialize, Serialize};
9#[derive(Serialize, Debug)]
10struct EditMessageReplyMarkupOpts<'a, V: Into<ChatHandle> + Serialize> {
11 #[serde(skip_serializing_if = "Option::is_none")]
12 business_connection_id: Option<&'a str>,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 chat_id: Option<V>,
15 #[serde(skip_serializing_if = "Option::is_none")]
16 message_id: Option<i64>,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 inline_message_id: Option<&'a str>,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 reply_markup: Option<String>,
21}
22#[derive(Serialize, Debug)]
23struct PostStoryOpts<'a> {
24 business_connection_id: &'a str,
25 content: String,
26 active_period: i64,
27 #[serde(skip_serializing_if = "Option::is_none")]
28 caption: Option<&'a str>,
29 #[serde(skip_serializing_if = "Option::is_none")]
30 parse_mode: Option<&'a str>,
31 #[serde(skip_serializing_if = "Option::is_none")]
32 caption_entities: Option<String>,
33 #[serde(skip_serializing_if = "Option::is_none")]
34 areas: Option<String>,
35 #[serde(skip_serializing_if = "Option::is_none")]
36 post_to_chat_page: Option<bool>,
37 #[serde(skip_serializing_if = "Option::is_none")]
38 protect_content: Option<bool>,
39}
40#[derive(Serialize, Debug)]
41struct UnbanChatSenderChatOpts<V: Into<ChatHandle> + Serialize> {
42 chat_id: V,
43 sender_chat_id: i64,
44}
45#[derive(Serialize, Debug)]
46struct GetMeOpts();
47#[derive(Serialize, Debug)]
48struct ExportChatInviteLinkOpts<V: Into<ChatHandle> + Serialize> {
49 chat_id: V,
50}
51#[derive(Serialize, Debug)]
52struct GetChatMemberOpts<V: Into<ChatHandle> + Serialize> {
53 chat_id: V,
54 user_id: i64,
55}
56#[derive(Serialize, Debug)]
57struct SetCustomEmojiStickerSetThumbnailOpts<'a> {
58 name: &'a str,
59 #[serde(skip_serializing_if = "Option::is_none")]
60 custom_emoji_id: Option<&'a str>,
61}
62#[derive(Serialize, Debug)]
63struct SetUserEmojiStatusOpts<'a> {
64 user_id: i64,
65 #[serde(skip_serializing_if = "Option::is_none")]
66 emoji_status_custom_emoji_id: Option<&'a str>,
67 #[serde(skip_serializing_if = "Option::is_none")]
68 emoji_status_expiration_date: Option<i64>,
69}
70#[derive(Serialize, Debug)]
71struct SendContactOpts<'a, V: Into<ChatHandle> + Serialize> {
72 #[serde(skip_serializing_if = "Option::is_none")]
73 business_connection_id: Option<&'a str>,
74 chat_id: V,
75 #[serde(skip_serializing_if = "Option::is_none")]
76 message_thread_id: Option<i64>,
77 #[serde(skip_serializing_if = "Option::is_none")]
78 direct_messages_topic_id: Option<i64>,
79 phone_number: &'a str,
80 first_name: &'a str,
81 #[serde(skip_serializing_if = "Option::is_none")]
82 last_name: Option<&'a str>,
83 #[serde(skip_serializing_if = "Option::is_none")]
84 vcard: Option<&'a str>,
85 #[serde(skip_serializing_if = "Option::is_none")]
86 disable_notification: Option<bool>,
87 #[serde(skip_serializing_if = "Option::is_none")]
88 protect_content: Option<bool>,
89 #[serde(skip_serializing_if = "Option::is_none")]
90 allow_paid_broadcast: Option<bool>,
91 #[serde(skip_serializing_if = "Option::is_none")]
92 message_effect_id: Option<&'a str>,
93 #[serde(skip_serializing_if = "Option::is_none")]
94 suggested_post_parameters: Option<String>,
95 #[serde(skip_serializing_if = "Option::is_none")]
96 reply_parameters: Option<String>,
97 #[serde(skip_serializing_if = "Option::is_none")]
98 reply_markup: Option<String>,
99}
100#[derive(Serialize, Debug)]
101struct SendMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
102 #[serde(skip_serializing_if = "Option::is_none")]
103 business_connection_id: Option<&'a str>,
104 chat_id: V,
105 #[serde(skip_serializing_if = "Option::is_none")]
106 message_thread_id: Option<i64>,
107 #[serde(skip_serializing_if = "Option::is_none")]
108 direct_messages_topic_id: Option<i64>,
109 text: &'a str,
110 #[serde(skip_serializing_if = "Option::is_none")]
111 parse_mode: Option<&'a str>,
112 #[serde(skip_serializing_if = "Option::is_none")]
113 entities: Option<String>,
114 #[serde(skip_serializing_if = "Option::is_none")]
115 link_preview_options: Option<String>,
116 #[serde(skip_serializing_if = "Option::is_none")]
117 disable_notification: Option<bool>,
118 #[serde(skip_serializing_if = "Option::is_none")]
119 protect_content: Option<bool>,
120 #[serde(skip_serializing_if = "Option::is_none")]
121 allow_paid_broadcast: Option<bool>,
122 #[serde(skip_serializing_if = "Option::is_none")]
123 message_effect_id: Option<&'a str>,
124 #[serde(skip_serializing_if = "Option::is_none")]
125 suggested_post_parameters: Option<String>,
126 #[serde(skip_serializing_if = "Option::is_none")]
127 reply_parameters: Option<String>,
128 #[serde(skip_serializing_if = "Option::is_none")]
129 reply_markup: Option<String>,
130}
131#[derive(Serialize, Debug)]
132struct BanChatMemberOpts<V: Into<ChatHandle> + Serialize> {
133 chat_id: V,
134 user_id: i64,
135 #[serde(skip_serializing_if = "Option::is_none")]
136 until_date: Option<i64>,
137 #[serde(skip_serializing_if = "Option::is_none")]
138 revoke_messages: Option<bool>,
139}
140#[derive(Serialize, Debug)]
141struct EditChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
142 chat_id: V,
143 invite_link: &'a str,
144 #[serde(skip_serializing_if = "Option::is_none")]
145 name: Option<&'a str>,
146 #[serde(skip_serializing_if = "Option::is_none")]
147 expire_date: Option<i64>,
148 #[serde(skip_serializing_if = "Option::is_none")]
149 member_limit: Option<i64>,
150 #[serde(skip_serializing_if = "Option::is_none")]
151 creates_join_request: Option<bool>,
152}
153#[derive(Serialize, Debug)]
154struct UnpinChatMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
155 #[serde(skip_serializing_if = "Option::is_none")]
156 business_connection_id: Option<&'a str>,
157 chat_id: V,
158 #[serde(skip_serializing_if = "Option::is_none")]
159 message_id: Option<i64>,
160}
161#[derive(Serialize, Debug)]
162struct AnswerInlineQueryOpts<'a> {
163 inline_query_id: &'a str,
164 results: String,
165 #[serde(skip_serializing_if = "Option::is_none")]
166 cache_time: Option<i64>,
167 #[serde(skip_serializing_if = "Option::is_none")]
168 is_personal: Option<bool>,
169 #[serde(skip_serializing_if = "Option::is_none")]
170 next_offset: Option<&'a str>,
171 #[serde(skip_serializing_if = "Option::is_none")]
172 button: Option<String>,
173}
174#[derive(Serialize, Debug)]
175struct GetFileOpts<'a> {
176 file_id: &'a str,
177}
178#[derive(Serialize, Debug)]
179struct GetStarTransactionsOpts {
180 #[serde(skip_serializing_if = "Option::is_none")]
181 offset: Option<i64>,
182 #[serde(skip_serializing_if = "Option::is_none")]
183 limit: Option<i64>,
184}
185#[derive(Serialize, Debug)]
186struct ForwardMessagesOpts<V: Into<ChatHandle> + Serialize> {
187 chat_id: V,
188 #[serde(skip_serializing_if = "Option::is_none")]
189 message_thread_id: Option<i64>,
190 #[serde(skip_serializing_if = "Option::is_none")]
191 direct_messages_topic_id: Option<i64>,
192 from_chat_id: V,
193 message_ids: String,
194 #[serde(skip_serializing_if = "Option::is_none")]
195 disable_notification: Option<bool>,
196 #[serde(skip_serializing_if = "Option::is_none")]
197 protect_content: Option<bool>,
198}
199#[derive(Serialize, Debug)]
200struct GetStickerSetOpts<'a> {
201 name: &'a str,
202}
203#[derive(Serialize, Debug)]
204struct GetForumTopicIconStickersOpts();
205#[derive(Serialize, Debug)]
206struct TransferGiftOpts<'a> {
207 business_connection_id: &'a str,
208 owned_gift_id: &'a str,
209 new_owner_chat_id: i64,
210 #[serde(skip_serializing_if = "Option::is_none")]
211 star_count: Option<i64>,
212}
213#[derive(Serialize, Debug)]
214struct DeleteMessagesOpts<V: Into<ChatHandle> + Serialize> {
215 chat_id: V,
216 message_ids: String,
217}
218#[derive(Serialize, Debug)]
219struct ReopenGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
220 chat_id: V,
221}
222#[derive(Serialize, Debug)]
223struct SendChecklistOpts<'a> {
224 business_connection_id: &'a str,
225 chat_id: i64,
226 checklist: String,
227 #[serde(skip_serializing_if = "Option::is_none")]
228 disable_notification: Option<bool>,
229 #[serde(skip_serializing_if = "Option::is_none")]
230 protect_content: Option<bool>,
231 #[serde(skip_serializing_if = "Option::is_none")]
232 message_effect_id: Option<&'a str>,
233 #[serde(skip_serializing_if = "Option::is_none")]
234 reply_parameters: Option<String>,
235 #[serde(skip_serializing_if = "Option::is_none")]
236 reply_markup: Option<String>,
237}
238#[derive(Serialize, Debug)]
239struct DeleteChatPhotoOpts<V: Into<ChatHandle> + Serialize> {
240 chat_id: V,
241}
242#[derive(Serialize, Debug)]
243struct VerifyUserOpts<'a> {
244 user_id: i64,
245 #[serde(skip_serializing_if = "Option::is_none")]
246 custom_description: Option<&'a str>,
247}
248#[derive(Serialize, Debug)]
249struct ApproveChatJoinRequestOpts<V: Into<ChatHandle> + Serialize> {
250 chat_id: V,
251 user_id: i64,
252}
253#[derive(Serialize, Debug)]
254struct SendInvoiceOpts<'a, V: Into<ChatHandle> + Serialize> {
255 chat_id: V,
256 #[serde(skip_serializing_if = "Option::is_none")]
257 message_thread_id: Option<i64>,
258 #[serde(skip_serializing_if = "Option::is_none")]
259 direct_messages_topic_id: Option<i64>,
260 title: &'a str,
261 description: &'a str,
262 payload: &'a str,
263 #[serde(skip_serializing_if = "Option::is_none")]
264 provider_token: Option<&'a str>,
265 currency: &'a str,
266 prices: String,
267 #[serde(skip_serializing_if = "Option::is_none")]
268 max_tip_amount: Option<i64>,
269 #[serde(skip_serializing_if = "Option::is_none")]
270 suggested_tip_amounts: Option<String>,
271 #[serde(skip_serializing_if = "Option::is_none")]
272 start_parameter: Option<&'a str>,
273 #[serde(skip_serializing_if = "Option::is_none")]
274 provider_data: Option<&'a str>,
275 #[serde(skip_serializing_if = "Option::is_none")]
276 photo_url: Option<&'a str>,
277 #[serde(skip_serializing_if = "Option::is_none")]
278 photo_size: Option<i64>,
279 #[serde(skip_serializing_if = "Option::is_none")]
280 photo_width: Option<i64>,
281 #[serde(skip_serializing_if = "Option::is_none")]
282 photo_height: Option<i64>,
283 #[serde(skip_serializing_if = "Option::is_none")]
284 need_name: Option<bool>,
285 #[serde(skip_serializing_if = "Option::is_none")]
286 need_phone_number: Option<bool>,
287 #[serde(skip_serializing_if = "Option::is_none")]
288 need_email: Option<bool>,
289 #[serde(skip_serializing_if = "Option::is_none")]
290 need_shipping_address: Option<bool>,
291 #[serde(skip_serializing_if = "Option::is_none")]
292 send_phone_number_to_provider: Option<bool>,
293 #[serde(skip_serializing_if = "Option::is_none")]
294 send_email_to_provider: Option<bool>,
295 #[serde(skip_serializing_if = "Option::is_none")]
296 is_flexible: Option<bool>,
297 #[serde(skip_serializing_if = "Option::is_none")]
298 disable_notification: Option<bool>,
299 #[serde(skip_serializing_if = "Option::is_none")]
300 protect_content: Option<bool>,
301 #[serde(skip_serializing_if = "Option::is_none")]
302 allow_paid_broadcast: Option<bool>,
303 #[serde(skip_serializing_if = "Option::is_none")]
304 message_effect_id: Option<&'a str>,
305 #[serde(skip_serializing_if = "Option::is_none")]
306 suggested_post_parameters: Option<String>,
307 #[serde(skip_serializing_if = "Option::is_none")]
308 reply_parameters: Option<String>,
309 #[serde(skip_serializing_if = "Option::is_none")]
310 reply_markup: Option<String>,
311}
312#[derive(Serialize, Debug)]
313struct CloseForumTopicOpts<V: Into<ChatHandle> + Serialize> {
314 chat_id: V,
315 message_thread_id: i64,
316}
317#[derive(Serialize, Debug)]
318struct RefundStarPaymentOpts<'a> {
319 user_id: i64,
320 telegram_payment_charge_id: &'a str,
321}
322#[derive(Serialize, Debug)]
323struct GetUpdatesOpts {
324 #[serde(skip_serializing_if = "Option::is_none")]
325 offset: Option<i64>,
326 #[serde(skip_serializing_if = "Option::is_none")]
327 limit: Option<i64>,
328 #[serde(skip_serializing_if = "Option::is_none")]
329 timeout: Option<i64>,
330 #[serde(skip_serializing_if = "Option::is_none")]
331 allowed_updates: Option<String>,
332}
333#[derive(Serialize, Debug)]
334struct SendPaidMediaOpts<'a, V: Into<ChatHandle> + Serialize> {
335 #[serde(skip_serializing_if = "Option::is_none")]
336 business_connection_id: Option<&'a str>,
337 chat_id: V,
338 #[serde(skip_serializing_if = "Option::is_none")]
339 message_thread_id: Option<i64>,
340 #[serde(skip_serializing_if = "Option::is_none")]
341 direct_messages_topic_id: Option<i64>,
342 star_count: i64,
343 media: String,
344 #[serde(skip_serializing_if = "Option::is_none")]
345 payload: Option<&'a str>,
346 #[serde(skip_serializing_if = "Option::is_none")]
347 caption: Option<&'a str>,
348 #[serde(skip_serializing_if = "Option::is_none")]
349 parse_mode: Option<&'a str>,
350 #[serde(skip_serializing_if = "Option::is_none")]
351 caption_entities: Option<String>,
352 #[serde(skip_serializing_if = "Option::is_none")]
353 show_caption_above_media: Option<bool>,
354 #[serde(skip_serializing_if = "Option::is_none")]
355 disable_notification: Option<bool>,
356 #[serde(skip_serializing_if = "Option::is_none")]
357 protect_content: Option<bool>,
358 #[serde(skip_serializing_if = "Option::is_none")]
359 allow_paid_broadcast: Option<bool>,
360 #[serde(skip_serializing_if = "Option::is_none")]
361 suggested_post_parameters: Option<String>,
362 #[serde(skip_serializing_if = "Option::is_none")]
363 reply_parameters: Option<String>,
364 #[serde(skip_serializing_if = "Option::is_none")]
365 reply_markup: Option<String>,
366}
367#[derive(Serialize, Debug)]
368struct ReopenForumTopicOpts<V: Into<ChatHandle> + Serialize> {
369 chat_id: V,
370 message_thread_id: i64,
371}
372#[derive(Serialize, Debug)]
373struct EditMessageLiveLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
374 #[serde(skip_serializing_if = "Option::is_none")]
375 business_connection_id: Option<&'a str>,
376 #[serde(skip_serializing_if = "Option::is_none")]
377 chat_id: Option<V>,
378 #[serde(skip_serializing_if = "Option::is_none")]
379 message_id: Option<i64>,
380 #[serde(skip_serializing_if = "Option::is_none")]
381 inline_message_id: Option<&'a str>,
382 latitude: ::ordered_float::OrderedFloat<f64>,
383 longitude: ::ordered_float::OrderedFloat<f64>,
384 #[serde(skip_serializing_if = "Option::is_none")]
385 live_period: Option<i64>,
386 #[serde(skip_serializing_if = "Option::is_none")]
387 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
388 #[serde(skip_serializing_if = "Option::is_none")]
389 heading: Option<i64>,
390 #[serde(skip_serializing_if = "Option::is_none")]
391 proximity_alert_radius: Option<i64>,
392 #[serde(skip_serializing_if = "Option::is_none")]
393 reply_markup: Option<String>,
394}
395#[derive(Serialize, Debug)]
396struct EditMessageChecklistOpts<'a> {
397 business_connection_id: &'a str,
398 chat_id: i64,
399 message_id: i64,
400 checklist: String,
401 #[serde(skip_serializing_if = "Option::is_none")]
402 reply_markup: Option<String>,
403}
404#[derive(Serialize, Debug)]
405struct SetBusinessAccountUsernameOpts<'a> {
406 business_connection_id: &'a str,
407 #[serde(skip_serializing_if = "Option::is_none")]
408 username: Option<&'a str>,
409}
410#[derive(Serialize, Debug)]
411struct SetPassportDataErrorsOpts {
412 user_id: i64,
413 errors: String,
414}
415#[derive(Serialize, Debug)]
416struct RemoveBusinessAccountProfilePhotoOpts<'a> {
417 business_connection_id: &'a str,
418 #[serde(skip_serializing_if = "Option::is_none")]
419 is_public: Option<bool>,
420}
421#[derive(Serialize, Debug)]
422struct SetMessageReactionOpts<V: Into<ChatHandle> + Serialize> {
423 chat_id: V,
424 message_id: i64,
425 #[serde(skip_serializing_if = "Option::is_none")]
426 reaction: Option<String>,
427 #[serde(skip_serializing_if = "Option::is_none")]
428 is_big: Option<bool>,
429}
430#[derive(Serialize, Debug)]
431struct SendPhotoOpts<'a, V: Into<ChatHandle> + Serialize> {
432 #[serde(skip_serializing_if = "Option::is_none")]
433 business_connection_id: Option<&'a str>,
434 chat_id: V,
435 #[serde(skip_serializing_if = "Option::is_none")]
436 message_thread_id: Option<i64>,
437 #[serde(skip_serializing_if = "Option::is_none")]
438 direct_messages_topic_id: Option<i64>,
439 photo: String,
440 #[serde(skip_serializing_if = "Option::is_none")]
441 caption: Option<&'a str>,
442 #[serde(skip_serializing_if = "Option::is_none")]
443 parse_mode: Option<&'a str>,
444 #[serde(skip_serializing_if = "Option::is_none")]
445 caption_entities: Option<String>,
446 #[serde(skip_serializing_if = "Option::is_none")]
447 show_caption_above_media: Option<bool>,
448 #[serde(skip_serializing_if = "Option::is_none")]
449 has_spoiler: Option<bool>,
450 #[serde(skip_serializing_if = "Option::is_none")]
451 disable_notification: Option<bool>,
452 #[serde(skip_serializing_if = "Option::is_none")]
453 protect_content: Option<bool>,
454 #[serde(skip_serializing_if = "Option::is_none")]
455 allow_paid_broadcast: Option<bool>,
456 #[serde(skip_serializing_if = "Option::is_none")]
457 message_effect_id: Option<&'a str>,
458 #[serde(skip_serializing_if = "Option::is_none")]
459 suggested_post_parameters: Option<String>,
460 #[serde(skip_serializing_if = "Option::is_none")]
461 reply_parameters: Option<String>,
462 #[serde(skip_serializing_if = "Option::is_none")]
463 reply_markup: Option<String>,
464}
465#[derive(Serialize, Debug)]
466struct UpgradeGiftOpts<'a> {
467 business_connection_id: &'a str,
468 owned_gift_id: &'a str,
469 #[serde(skip_serializing_if = "Option::is_none")]
470 keep_original_details: Option<bool>,
471 #[serde(skip_serializing_if = "Option::is_none")]
472 star_count: Option<i64>,
473}
474#[derive(Serialize, Debug)]
475struct DeleteMessageOpts<V: Into<ChatHandle> + Serialize> {
476 chat_id: V,
477 message_id: i64,
478}
479#[derive(Serialize, Debug)]
480struct GetUserChatBoostsOpts<V: Into<ChatHandle> + Serialize> {
481 chat_id: V,
482 user_id: i64,
483}
484#[derive(Serialize, Debug)]
485struct GiftPremiumSubscriptionOpts<'a> {
486 user_id: i64,
487 month_count: i64,
488 star_count: i64,
489 #[serde(skip_serializing_if = "Option::is_none")]
490 text: Option<&'a str>,
491 #[serde(skip_serializing_if = "Option::is_none")]
492 text_parse_mode: Option<&'a str>,
493 #[serde(skip_serializing_if = "Option::is_none")]
494 text_entities: Option<String>,
495}
496#[derive(Serialize, Debug)]
497struct LogOutOpts();
498#[derive(Serialize, Debug)]
499struct ConvertGiftToStarsOpts<'a> {
500 business_connection_id: &'a str,
501 owned_gift_id: &'a str,
502}
503#[derive(Serialize, Debug)]
504struct CopyMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
505 chat_id: V,
506 #[serde(skip_serializing_if = "Option::is_none")]
507 message_thread_id: Option<i64>,
508 #[serde(skip_serializing_if = "Option::is_none")]
509 direct_messages_topic_id: Option<i64>,
510 from_chat_id: V,
511 message_id: i64,
512 #[serde(skip_serializing_if = "Option::is_none")]
513 video_start_timestamp: Option<i64>,
514 #[serde(skip_serializing_if = "Option::is_none")]
515 caption: Option<&'a str>,
516 #[serde(skip_serializing_if = "Option::is_none")]
517 parse_mode: Option<&'a str>,
518 #[serde(skip_serializing_if = "Option::is_none")]
519 caption_entities: Option<String>,
520 #[serde(skip_serializing_if = "Option::is_none")]
521 show_caption_above_media: Option<bool>,
522 #[serde(skip_serializing_if = "Option::is_none")]
523 disable_notification: Option<bool>,
524 #[serde(skip_serializing_if = "Option::is_none")]
525 protect_content: Option<bool>,
526 #[serde(skip_serializing_if = "Option::is_none")]
527 allow_paid_broadcast: Option<bool>,
528 #[serde(skip_serializing_if = "Option::is_none")]
529 suggested_post_parameters: Option<String>,
530 #[serde(skip_serializing_if = "Option::is_none")]
531 reply_parameters: Option<String>,
532 #[serde(skip_serializing_if = "Option::is_none")]
533 reply_markup: Option<String>,
534}
535#[derive(Serialize, Debug)]
536struct EditForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
537 chat_id: V,
538 message_thread_id: i64,
539 #[serde(skip_serializing_if = "Option::is_none")]
540 name: Option<&'a str>,
541 #[serde(skip_serializing_if = "Option::is_none")]
542 icon_custom_emoji_id: Option<&'a str>,
543}
544#[derive(Serialize, Debug)]
545struct SetBusinessAccountBioOpts<'a> {
546 business_connection_id: &'a str,
547 #[serde(skip_serializing_if = "Option::is_none")]
548 bio: Option<&'a str>,
549}
550#[derive(Serialize, Debug)]
551struct GetChatOpts<V: Into<ChatHandle> + Serialize> {
552 chat_id: V,
553}
554#[derive(Serialize, Debug)]
555struct EditMessageMediaOpts<'a, V: Into<ChatHandle> + Serialize> {
556 #[serde(skip_serializing_if = "Option::is_none")]
557 business_connection_id: Option<&'a str>,
558 #[serde(skip_serializing_if = "Option::is_none")]
559 chat_id: Option<V>,
560 #[serde(skip_serializing_if = "Option::is_none")]
561 message_id: Option<i64>,
562 #[serde(skip_serializing_if = "Option::is_none")]
563 inline_message_id: Option<&'a str>,
564 media: String,
565 #[serde(skip_serializing_if = "Option::is_none")]
566 reply_markup: Option<String>,
567}
568#[derive(Serialize, Debug)]
569struct SetGameScoreOpts<'a> {
570 user_id: i64,
571 score: i64,
572 #[serde(skip_serializing_if = "Option::is_none")]
573 force: Option<bool>,
574 #[serde(skip_serializing_if = "Option::is_none")]
575 disable_edit_message: Option<bool>,
576 #[serde(skip_serializing_if = "Option::is_none")]
577 chat_id: Option<i64>,
578 #[serde(skip_serializing_if = "Option::is_none")]
579 message_id: Option<i64>,
580 #[serde(skip_serializing_if = "Option::is_none")]
581 inline_message_id: Option<&'a str>,
582}
583#[derive(Serialize, Debug)]
584struct GetCustomEmojiStickersOpts {
585 custom_emoji_ids: String,
586}
587#[derive(Serialize, Debug)]
588struct SetChatAdministratorCustomTitleOpts<'a, V: Into<ChatHandle> + Serialize> {
589 chat_id: V,
590 user_id: i64,
591 custom_title: &'a str,
592}
593#[derive(Serialize, Debug)]
594struct SendGiftOpts<'a, V: Into<ChatHandle> + Serialize> {
595 #[serde(skip_serializing_if = "Option::is_none")]
596 user_id: Option<i64>,
597 #[serde(skip_serializing_if = "Option::is_none")]
598 chat_id: Option<V>,
599 gift_id: &'a str,
600 #[serde(skip_serializing_if = "Option::is_none")]
601 pay_for_upgrade: Option<bool>,
602 #[serde(skip_serializing_if = "Option::is_none")]
603 text: Option<&'a str>,
604 #[serde(skip_serializing_if = "Option::is_none")]
605 text_parse_mode: Option<&'a str>,
606 #[serde(skip_serializing_if = "Option::is_none")]
607 text_entities: Option<String>,
608}
609#[derive(Serialize, Debug)]
610struct SendDiceOpts<'a, V: Into<ChatHandle> + Serialize> {
611 #[serde(skip_serializing_if = "Option::is_none")]
612 business_connection_id: Option<&'a str>,
613 chat_id: V,
614 #[serde(skip_serializing_if = "Option::is_none")]
615 message_thread_id: Option<i64>,
616 #[serde(skip_serializing_if = "Option::is_none")]
617 direct_messages_topic_id: Option<i64>,
618 #[serde(skip_serializing_if = "Option::is_none")]
619 emoji: Option<&'a str>,
620 #[serde(skip_serializing_if = "Option::is_none")]
621 disable_notification: Option<bool>,
622 #[serde(skip_serializing_if = "Option::is_none")]
623 protect_content: Option<bool>,
624 #[serde(skip_serializing_if = "Option::is_none")]
625 allow_paid_broadcast: Option<bool>,
626 #[serde(skip_serializing_if = "Option::is_none")]
627 message_effect_id: Option<&'a str>,
628 #[serde(skip_serializing_if = "Option::is_none")]
629 suggested_post_parameters: Option<String>,
630 #[serde(skip_serializing_if = "Option::is_none")]
631 reply_parameters: Option<String>,
632 #[serde(skip_serializing_if = "Option::is_none")]
633 reply_markup: Option<String>,
634}
635#[derive(Serialize, Debug)]
636struct UnpinAllGeneralForumTopicMessagesOpts<V: Into<ChatHandle> + Serialize> {
637 chat_id: V,
638}
639#[derive(Serialize, Debug)]
640struct GetMyCommandsOpts<'a> {
641 #[serde(skip_serializing_if = "Option::is_none")]
642 scope: Option<String>,
643 #[serde(skip_serializing_if = "Option::is_none")]
644 language_code: Option<&'a str>,
645}
646#[derive(Serialize, Debug)]
647struct SetBusinessAccountProfilePhotoOpts<'a> {
648 business_connection_id: &'a str,
649 photo: String,
650 #[serde(skip_serializing_if = "Option::is_none")]
651 is_public: Option<bool>,
652}
653#[derive(Serialize, Debug)]
654struct CreateChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
655 chat_id: V,
656 #[serde(skip_serializing_if = "Option::is_none")]
657 name: Option<&'a str>,
658 #[serde(skip_serializing_if = "Option::is_none")]
659 expire_date: Option<i64>,
660 #[serde(skip_serializing_if = "Option::is_none")]
661 member_limit: Option<i64>,
662 #[serde(skip_serializing_if = "Option::is_none")]
663 creates_join_request: Option<bool>,
664}
665#[derive(Serialize, Debug)]
666struct DeleteStickerFromSetOpts<'a> {
667 sticker: &'a str,
668}
669#[derive(Serialize, Debug)]
670struct GetMyDescriptionOpts<'a> {
671 #[serde(skip_serializing_if = "Option::is_none")]
672 language_code: Option<&'a str>,
673}
674#[derive(Serialize, Debug)]
675struct GetMyStarBalanceOpts();
676#[derive(Serialize, Debug)]
677struct SendMediaGroupOpts<'a, V: Into<ChatHandle> + Serialize> {
678 #[serde(skip_serializing_if = "Option::is_none")]
679 business_connection_id: Option<&'a str>,
680 chat_id: V,
681 #[serde(skip_serializing_if = "Option::is_none")]
682 message_thread_id: Option<i64>,
683 #[serde(skip_serializing_if = "Option::is_none")]
684 direct_messages_topic_id: Option<i64>,
685 media: String,
686 #[serde(skip_serializing_if = "Option::is_none")]
687 disable_notification: Option<bool>,
688 #[serde(skip_serializing_if = "Option::is_none")]
689 protect_content: Option<bool>,
690 #[serde(skip_serializing_if = "Option::is_none")]
691 allow_paid_broadcast: Option<bool>,
692 #[serde(skip_serializing_if = "Option::is_none")]
693 message_effect_id: Option<&'a str>,
694 #[serde(skip_serializing_if = "Option::is_none")]
695 reply_parameters: Option<String>,
696}
697#[derive(Serialize, Debug)]
698struct GetWebhookInfoOpts();
699#[derive(Serialize, Debug)]
700struct GetChatMemberCountOpts<V: Into<ChatHandle> + Serialize> {
701 chat_id: V,
702}
703#[derive(Serialize, Debug)]
704struct AnswerPreCheckoutQueryOpts<'a> {
705 pre_checkout_query_id: &'a str,
706 ok: bool,
707 #[serde(skip_serializing_if = "Option::is_none")]
708 error_message: Option<&'a str>,
709}
710#[derive(Serialize, Debug)]
711struct RemoveChatVerificationOpts<V: Into<ChatHandle> + Serialize> {
712 chat_id: V,
713}
714#[derive(Serialize, Debug)]
715struct CopyMessagesOpts<V: Into<ChatHandle> + Serialize> {
716 chat_id: V,
717 #[serde(skip_serializing_if = "Option::is_none")]
718 message_thread_id: Option<i64>,
719 #[serde(skip_serializing_if = "Option::is_none")]
720 direct_messages_topic_id: Option<i64>,
721 from_chat_id: V,
722 message_ids: String,
723 #[serde(skip_serializing_if = "Option::is_none")]
724 disable_notification: Option<bool>,
725 #[serde(skip_serializing_if = "Option::is_none")]
726 protect_content: Option<bool>,
727 #[serde(skip_serializing_if = "Option::is_none")]
728 remove_caption: Option<bool>,
729}
730#[derive(Serialize, Debug)]
731struct SetStickerSetThumbnailOpts<'a> {
732 name: &'a str,
733 user_id: i64,
734 #[serde(skip_serializing_if = "Option::is_none")]
735 thumbnail: Option<String>,
736 format: &'a str,
737}
738#[derive(Serialize, Debug)]
739struct DeleteMyCommandsOpts<'a> {
740 #[serde(skip_serializing_if = "Option::is_none")]
741 scope: Option<String>,
742 #[serde(skip_serializing_if = "Option::is_none")]
743 language_code: Option<&'a str>,
744}
745#[derive(Serialize, Debug)]
746struct DeleteStickerSetOpts<'a> {
747 name: &'a str,
748}
749#[derive(Serialize, Debug)]
750struct SetChatDescriptionOpts<'a, V: Into<ChatHandle> + Serialize> {
751 chat_id: V,
752 #[serde(skip_serializing_if = "Option::is_none")]
753 description: Option<&'a str>,
754}
755#[derive(Serialize, Debug)]
756struct SetStickerEmojiListOpts<'a> {
757 sticker: &'a str,
758 emoji_list: String,
759}
760#[derive(Serialize, Debug)]
761struct SendLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
762 #[serde(skip_serializing_if = "Option::is_none")]
763 business_connection_id: Option<&'a str>,
764 chat_id: V,
765 #[serde(skip_serializing_if = "Option::is_none")]
766 message_thread_id: Option<i64>,
767 #[serde(skip_serializing_if = "Option::is_none")]
768 direct_messages_topic_id: Option<i64>,
769 latitude: ::ordered_float::OrderedFloat<f64>,
770 longitude: ::ordered_float::OrderedFloat<f64>,
771 #[serde(skip_serializing_if = "Option::is_none")]
772 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
773 #[serde(skip_serializing_if = "Option::is_none")]
774 live_period: Option<i64>,
775 #[serde(skip_serializing_if = "Option::is_none")]
776 heading: Option<i64>,
777 #[serde(skip_serializing_if = "Option::is_none")]
778 proximity_alert_radius: Option<i64>,
779 #[serde(skip_serializing_if = "Option::is_none")]
780 disable_notification: Option<bool>,
781 #[serde(skip_serializing_if = "Option::is_none")]
782 protect_content: Option<bool>,
783 #[serde(skip_serializing_if = "Option::is_none")]
784 allow_paid_broadcast: Option<bool>,
785 #[serde(skip_serializing_if = "Option::is_none")]
786 message_effect_id: Option<&'a str>,
787 #[serde(skip_serializing_if = "Option::is_none")]
788 suggested_post_parameters: Option<String>,
789 #[serde(skip_serializing_if = "Option::is_none")]
790 reply_parameters: Option<String>,
791 #[serde(skip_serializing_if = "Option::is_none")]
792 reply_markup: Option<String>,
793}
794#[derive(Serialize, Debug)]
795struct SetChatTitleOpts<'a, V: Into<ChatHandle> + Serialize> {
796 chat_id: V,
797 title: &'a str,
798}
799#[derive(Serialize, Debug)]
800struct ReplaceStickerInSetOpts<'a> {
801 user_id: i64,
802 name: &'a str,
803 old_sticker: &'a str,
804 sticker: String,
805}
806#[derive(Serialize, Debug)]
807struct DeclineSuggestedPostOpts<'a> {
808 chat_id: i64,
809 message_id: i64,
810 #[serde(skip_serializing_if = "Option::is_none")]
811 comment: Option<&'a str>,
812}
813#[derive(Serialize, Debug)]
814struct SetMyShortDescriptionOpts<'a> {
815 #[serde(skip_serializing_if = "Option::is_none")]
816 short_description: Option<&'a str>,
817 #[serde(skip_serializing_if = "Option::is_none")]
818 language_code: Option<&'a str>,
819}
820#[derive(Serialize, Debug)]
821struct GetMyDefaultAdministratorRightsOpts {
822 #[serde(skip_serializing_if = "Option::is_none")]
823 for_channels: Option<bool>,
824}
825#[derive(Serialize, Debug)]
826struct GetBusinessAccountStarBalanceOpts<'a> {
827 business_connection_id: &'a str,
828}
829#[derive(Serialize, Debug)]
830struct DeleteChatStickerSetOpts<V: Into<ChatHandle> + Serialize> {
831 chat_id: V,
832}
833#[derive(Serialize, Debug)]
834struct SendAnimationOpts<'a, V: Into<ChatHandle> + Serialize> {
835 #[serde(skip_serializing_if = "Option::is_none")]
836 business_connection_id: Option<&'a str>,
837 chat_id: V,
838 #[serde(skip_serializing_if = "Option::is_none")]
839 message_thread_id: Option<i64>,
840 #[serde(skip_serializing_if = "Option::is_none")]
841 direct_messages_topic_id: Option<i64>,
842 animation: String,
843 #[serde(skip_serializing_if = "Option::is_none")]
844 duration: Option<i64>,
845 #[serde(skip_serializing_if = "Option::is_none")]
846 width: Option<i64>,
847 #[serde(skip_serializing_if = "Option::is_none")]
848 height: Option<i64>,
849 #[serde(skip_serializing_if = "Option::is_none")]
850 thumbnail: Option<String>,
851 #[serde(skip_serializing_if = "Option::is_none")]
852 caption: Option<&'a str>,
853 #[serde(skip_serializing_if = "Option::is_none")]
854 parse_mode: Option<&'a str>,
855 #[serde(skip_serializing_if = "Option::is_none")]
856 caption_entities: Option<String>,
857 #[serde(skip_serializing_if = "Option::is_none")]
858 show_caption_above_media: Option<bool>,
859 #[serde(skip_serializing_if = "Option::is_none")]
860 has_spoiler: Option<bool>,
861 #[serde(skip_serializing_if = "Option::is_none")]
862 disable_notification: Option<bool>,
863 #[serde(skip_serializing_if = "Option::is_none")]
864 protect_content: Option<bool>,
865 #[serde(skip_serializing_if = "Option::is_none")]
866 allow_paid_broadcast: Option<bool>,
867 #[serde(skip_serializing_if = "Option::is_none")]
868 message_effect_id: Option<&'a str>,
869 #[serde(skip_serializing_if = "Option::is_none")]
870 suggested_post_parameters: Option<String>,
871 #[serde(skip_serializing_if = "Option::is_none")]
872 reply_parameters: Option<String>,
873 #[serde(skip_serializing_if = "Option::is_none")]
874 reply_markup: Option<String>,
875}
876#[derive(Serialize, Debug)]
877struct AddStickerToSetOpts<'a> {
878 user_id: i64,
879 name: &'a str,
880 sticker: String,
881}
882#[derive(Serialize, Debug)]
883struct DeleteWebhookOpts {
884 #[serde(skip_serializing_if = "Option::is_none")]
885 drop_pending_updates: Option<bool>,
886}
887#[derive(Serialize, Debug)]
888struct UnpinAllChatMessagesOpts<V: Into<ChatHandle> + Serialize> {
889 chat_id: V,
890}
891#[derive(Serialize, Debug)]
892struct DeclineChatJoinRequestOpts<V: Into<ChatHandle> + Serialize> {
893 chat_id: V,
894 user_id: i64,
895}
896#[derive(Serialize, Debug)]
897struct ReadBusinessMessageOpts<'a> {
898 business_connection_id: &'a str,
899 chat_id: i64,
900 message_id: i64,
901}
902#[derive(Serialize, Debug)]
903struct SetStickerMaskPositionOpts<'a> {
904 sticker: &'a str,
905 #[serde(skip_serializing_if = "Option::is_none")]
906 mask_position: Option<String>,
907}
908#[derive(Serialize, Debug)]
909struct SetMyDefaultAdministratorRightsOpts {
910 #[serde(skip_serializing_if = "Option::is_none")]
911 rights: Option<String>,
912 #[serde(skip_serializing_if = "Option::is_none")]
913 for_channels: Option<bool>,
914}
915#[derive(Serialize, Debug)]
916struct EditUserStarSubscriptionOpts<'a> {
917 user_id: i64,
918 telegram_payment_charge_id: &'a str,
919 is_canceled: bool,
920}
921#[derive(Serialize, Debug)]
922struct GetGameHighScoresOpts<'a> {
923 user_id: i64,
924 #[serde(skip_serializing_if = "Option::is_none")]
925 chat_id: Option<i64>,
926 #[serde(skip_serializing_if = "Option::is_none")]
927 message_id: Option<i64>,
928 #[serde(skip_serializing_if = "Option::is_none")]
929 inline_message_id: Option<&'a str>,
930}
931#[derive(Serialize, Debug)]
932struct SendChatActionOpts<'a, V: Into<ChatHandle> + Serialize> {
933 #[serde(skip_serializing_if = "Option::is_none")]
934 business_connection_id: Option<&'a str>,
935 chat_id: V,
936 #[serde(skip_serializing_if = "Option::is_none")]
937 message_thread_id: Option<i64>,
938 action: &'a str,
939}
940#[derive(Serialize, Debug)]
941struct GetMyNameOpts<'a> {
942 #[serde(skip_serializing_if = "Option::is_none")]
943 language_code: Option<&'a str>,
944}
945#[derive(Serialize, Debug)]
946struct SetChatStickerSetOpts<'a, V: Into<ChatHandle> + Serialize> {
947 chat_id: V,
948 sticker_set_name: &'a str,
949}
950#[derive(Serialize, Debug)]
951struct SetWebhookOpts<'a> {
952 url: &'a str,
953 #[serde(skip_serializing_if = "Option::is_none")]
954 certificate: Option<String>,
955 #[serde(skip_serializing_if = "Option::is_none")]
956 ip_address: Option<&'a str>,
957 #[serde(skip_serializing_if = "Option::is_none")]
958 max_connections: Option<i64>,
959 #[serde(skip_serializing_if = "Option::is_none")]
960 allowed_updates: Option<String>,
961 #[serde(skip_serializing_if = "Option::is_none")]
962 drop_pending_updates: Option<bool>,
963 #[serde(skip_serializing_if = "Option::is_none")]
964 secret_token: Option<&'a str>,
965}
966#[derive(Serialize, Debug)]
967struct VerifyChatOpts<'a, V: Into<ChatHandle> + Serialize> {
968 chat_id: V,
969 #[serde(skip_serializing_if = "Option::is_none")]
970 custom_description: Option<&'a str>,
971}
972#[derive(Serialize, Debug)]
973struct CloseOpts();
974#[derive(Serialize, Debug)]
975struct AnswerWebAppQueryOpts<'a> {
976 web_app_query_id: &'a str,
977 result: String,
978}
979#[derive(Serialize, Debug)]
980struct LeaveChatOpts<V: Into<ChatHandle> + Serialize> {
981 chat_id: V,
982}
983#[derive(Serialize, Debug)]
984struct SendVoiceOpts<'a, V: Into<ChatHandle> + Serialize> {
985 #[serde(skip_serializing_if = "Option::is_none")]
986 business_connection_id: Option<&'a str>,
987 chat_id: V,
988 #[serde(skip_serializing_if = "Option::is_none")]
989 message_thread_id: Option<i64>,
990 #[serde(skip_serializing_if = "Option::is_none")]
991 direct_messages_topic_id: Option<i64>,
992 voice: String,
993 #[serde(skip_serializing_if = "Option::is_none")]
994 caption: Option<&'a str>,
995 #[serde(skip_serializing_if = "Option::is_none")]
996 parse_mode: Option<&'a str>,
997 #[serde(skip_serializing_if = "Option::is_none")]
998 caption_entities: Option<String>,
999 #[serde(skip_serializing_if = "Option::is_none")]
1000 duration: Option<i64>,
1001 #[serde(skip_serializing_if = "Option::is_none")]
1002 disable_notification: Option<bool>,
1003 #[serde(skip_serializing_if = "Option::is_none")]
1004 protect_content: Option<bool>,
1005 #[serde(skip_serializing_if = "Option::is_none")]
1006 allow_paid_broadcast: Option<bool>,
1007 #[serde(skip_serializing_if = "Option::is_none")]
1008 message_effect_id: Option<&'a str>,
1009 #[serde(skip_serializing_if = "Option::is_none")]
1010 suggested_post_parameters: Option<String>,
1011 #[serde(skip_serializing_if = "Option::is_none")]
1012 reply_parameters: Option<String>,
1013 #[serde(skip_serializing_if = "Option::is_none")]
1014 reply_markup: Option<String>,
1015}
1016#[derive(Serialize, Debug)]
1017struct EditGeneralForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
1018 chat_id: V,
1019 name: &'a str,
1020}
1021#[derive(Serialize, Debug)]
1022struct SavePreparedInlineMessageOpts {
1023 user_id: i64,
1024 result: String,
1025 #[serde(skip_serializing_if = "Option::is_none")]
1026 allow_user_chats: Option<bool>,
1027 #[serde(skip_serializing_if = "Option::is_none")]
1028 allow_bot_chats: Option<bool>,
1029 #[serde(skip_serializing_if = "Option::is_none")]
1030 allow_group_chats: Option<bool>,
1031 #[serde(skip_serializing_if = "Option::is_none")]
1032 allow_channel_chats: Option<bool>,
1033}
1034#[derive(Serialize, Debug)]
1035struct TransferBusinessAccountStarsOpts<'a> {
1036 business_connection_id: &'a str,
1037 star_count: i64,
1038}
1039#[derive(Serialize, Debug)]
1040struct PromoteChatMemberOpts<V: Into<ChatHandle> + Serialize> {
1041 chat_id: V,
1042 user_id: i64,
1043 #[serde(skip_serializing_if = "Option::is_none")]
1044 is_anonymous: Option<bool>,
1045 #[serde(skip_serializing_if = "Option::is_none")]
1046 can_manage_chat: Option<bool>,
1047 #[serde(skip_serializing_if = "Option::is_none")]
1048 can_delete_messages: Option<bool>,
1049 #[serde(skip_serializing_if = "Option::is_none")]
1050 can_manage_video_chats: Option<bool>,
1051 #[serde(skip_serializing_if = "Option::is_none")]
1052 can_restrict_members: Option<bool>,
1053 #[serde(skip_serializing_if = "Option::is_none")]
1054 can_promote_members: Option<bool>,
1055 #[serde(skip_serializing_if = "Option::is_none")]
1056 can_change_info: Option<bool>,
1057 #[serde(skip_serializing_if = "Option::is_none")]
1058 can_invite_users: Option<bool>,
1059 #[serde(skip_serializing_if = "Option::is_none")]
1060 can_post_stories: Option<bool>,
1061 #[serde(skip_serializing_if = "Option::is_none")]
1062 can_edit_stories: Option<bool>,
1063 #[serde(skip_serializing_if = "Option::is_none")]
1064 can_delete_stories: Option<bool>,
1065 #[serde(skip_serializing_if = "Option::is_none")]
1066 can_post_messages: Option<bool>,
1067 #[serde(skip_serializing_if = "Option::is_none")]
1068 can_edit_messages: Option<bool>,
1069 #[serde(skip_serializing_if = "Option::is_none")]
1070 can_pin_messages: Option<bool>,
1071 #[serde(skip_serializing_if = "Option::is_none")]
1072 can_manage_topics: Option<bool>,
1073 #[serde(skip_serializing_if = "Option::is_none")]
1074 can_manage_direct_messages: Option<bool>,
1075}
1076#[derive(Serialize, Debug)]
1077struct PinChatMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
1078 #[serde(skip_serializing_if = "Option::is_none")]
1079 business_connection_id: Option<&'a str>,
1080 chat_id: V,
1081 message_id: i64,
1082 #[serde(skip_serializing_if = "Option::is_none")]
1083 disable_notification: Option<bool>,
1084}
1085#[derive(Serialize, Debug)]
1086struct GetMyShortDescriptionOpts<'a> {
1087 #[serde(skip_serializing_if = "Option::is_none")]
1088 language_code: Option<&'a str>,
1089}
1090#[derive(Serialize, Debug)]
1091struct CreateInvoiceLinkOpts<'a> {
1092 #[serde(skip_serializing_if = "Option::is_none")]
1093 business_connection_id: Option<&'a str>,
1094 title: &'a str,
1095 description: &'a str,
1096 payload: &'a str,
1097 #[serde(skip_serializing_if = "Option::is_none")]
1098 provider_token: Option<&'a str>,
1099 currency: &'a str,
1100 prices: String,
1101 #[serde(skip_serializing_if = "Option::is_none")]
1102 subscription_period: Option<i64>,
1103 #[serde(skip_serializing_if = "Option::is_none")]
1104 max_tip_amount: Option<i64>,
1105 #[serde(skip_serializing_if = "Option::is_none")]
1106 suggested_tip_amounts: Option<String>,
1107 #[serde(skip_serializing_if = "Option::is_none")]
1108 provider_data: Option<&'a str>,
1109 #[serde(skip_serializing_if = "Option::is_none")]
1110 photo_url: Option<&'a str>,
1111 #[serde(skip_serializing_if = "Option::is_none")]
1112 photo_size: Option<i64>,
1113 #[serde(skip_serializing_if = "Option::is_none")]
1114 photo_width: Option<i64>,
1115 #[serde(skip_serializing_if = "Option::is_none")]
1116 photo_height: Option<i64>,
1117 #[serde(skip_serializing_if = "Option::is_none")]
1118 need_name: Option<bool>,
1119 #[serde(skip_serializing_if = "Option::is_none")]
1120 need_phone_number: Option<bool>,
1121 #[serde(skip_serializing_if = "Option::is_none")]
1122 need_email: Option<bool>,
1123 #[serde(skip_serializing_if = "Option::is_none")]
1124 need_shipping_address: Option<bool>,
1125 #[serde(skip_serializing_if = "Option::is_none")]
1126 send_phone_number_to_provider: Option<bool>,
1127 #[serde(skip_serializing_if = "Option::is_none")]
1128 send_email_to_provider: Option<bool>,
1129 #[serde(skip_serializing_if = "Option::is_none")]
1130 is_flexible: Option<bool>,
1131}
1132#[derive(Serialize, Debug)]
1133struct GetAvailableGiftsOpts();
1134#[derive(Serialize, Debug)]
1135struct SetChatPhotoOpts<V: Into<ChatHandle> + Serialize> {
1136 chat_id: V,
1137 photo: String,
1138}
1139#[derive(Serialize, Debug)]
1140struct SetMyDescriptionOpts<'a> {
1141 #[serde(skip_serializing_if = "Option::is_none")]
1142 description: Option<&'a str>,
1143 #[serde(skip_serializing_if = "Option::is_none")]
1144 language_code: Option<&'a str>,
1145}
1146#[derive(Serialize, Debug)]
1147struct SetMyNameOpts<'a> {
1148 #[serde(skip_serializing_if = "Option::is_none")]
1149 name: Option<&'a str>,
1150 #[serde(skip_serializing_if = "Option::is_none")]
1151 language_code: Option<&'a str>,
1152}
1153#[derive(Serialize, Debug)]
1154struct SetMyCommandsOpts<'a> {
1155 commands: String,
1156 #[serde(skip_serializing_if = "Option::is_none")]
1157 scope: Option<String>,
1158 #[serde(skip_serializing_if = "Option::is_none")]
1159 language_code: Option<&'a str>,
1160}
1161#[derive(Serialize, Debug)]
1162struct EditMessageCaptionOpts<'a, V: Into<ChatHandle> + Serialize> {
1163 #[serde(skip_serializing_if = "Option::is_none")]
1164 business_connection_id: Option<&'a str>,
1165 #[serde(skip_serializing_if = "Option::is_none")]
1166 chat_id: Option<V>,
1167 #[serde(skip_serializing_if = "Option::is_none")]
1168 message_id: Option<i64>,
1169 #[serde(skip_serializing_if = "Option::is_none")]
1170 inline_message_id: Option<&'a str>,
1171 #[serde(skip_serializing_if = "Option::is_none")]
1172 caption: Option<&'a str>,
1173 #[serde(skip_serializing_if = "Option::is_none")]
1174 parse_mode: Option<&'a str>,
1175 #[serde(skip_serializing_if = "Option::is_none")]
1176 caption_entities: Option<String>,
1177 #[serde(skip_serializing_if = "Option::is_none")]
1178 show_caption_above_media: Option<bool>,
1179 #[serde(skip_serializing_if = "Option::is_none")]
1180 reply_markup: Option<String>,
1181}
1182#[derive(Serialize, Debug)]
1183struct DeleteStoryOpts<'a> {
1184 business_connection_id: &'a str,
1185 story_id: i64,
1186}
1187#[derive(Serialize, Debug)]
1188struct DeleteBusinessMessagesOpts<'a> {
1189 business_connection_id: &'a str,
1190 message_ids: String,
1191}
1192#[derive(Serialize, Debug)]
1193struct GetUserProfilePhotosOpts {
1194 user_id: i64,
1195 #[serde(skip_serializing_if = "Option::is_none")]
1196 offset: Option<i64>,
1197 #[serde(skip_serializing_if = "Option::is_none")]
1198 limit: Option<i64>,
1199}
1200#[derive(Serialize, Debug)]
1201struct GetBusinessAccountGiftsOpts<'a> {
1202 business_connection_id: &'a str,
1203 #[serde(skip_serializing_if = "Option::is_none")]
1204 exclude_unsaved: Option<bool>,
1205 #[serde(skip_serializing_if = "Option::is_none")]
1206 exclude_saved: Option<bool>,
1207 #[serde(skip_serializing_if = "Option::is_none")]
1208 exclude_unlimited: Option<bool>,
1209 #[serde(skip_serializing_if = "Option::is_none")]
1210 exclude_limited: Option<bool>,
1211 #[serde(skip_serializing_if = "Option::is_none")]
1212 exclude_unique: Option<bool>,
1213 #[serde(skip_serializing_if = "Option::is_none")]
1214 sort_by_price: Option<bool>,
1215 #[serde(skip_serializing_if = "Option::is_none")]
1216 offset: Option<&'a str>,
1217 #[serde(skip_serializing_if = "Option::is_none")]
1218 limit: Option<i64>,
1219}
1220#[derive(Serialize, Debug)]
1221struct SetChatPermissionsOpts<V: Into<ChatHandle> + Serialize> {
1222 chat_id: V,
1223 permissions: String,
1224 #[serde(skip_serializing_if = "Option::is_none")]
1225 use_independent_chat_permissions: Option<bool>,
1226}
1227#[derive(Serialize, Debug)]
1228struct AnswerShippingQueryOpts<'a> {
1229 shipping_query_id: &'a str,
1230 ok: bool,
1231 #[serde(skip_serializing_if = "Option::is_none")]
1232 shipping_options: Option<String>,
1233 #[serde(skip_serializing_if = "Option::is_none")]
1234 error_message: Option<&'a str>,
1235}
1236#[derive(Serialize, Debug)]
1237struct CreateChatSubscriptionInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
1238 chat_id: V,
1239 #[serde(skip_serializing_if = "Option::is_none")]
1240 name: Option<&'a str>,
1241 subscription_period: i64,
1242 subscription_price: i64,
1243}
1244#[derive(Serialize, Debug)]
1245struct SetStickerSetTitleOpts<'a> {
1246 name: &'a str,
1247 title: &'a str,
1248}
1249#[derive(Serialize, Debug)]
1250struct ApproveSuggestedPostOpts {
1251 chat_id: i64,
1252 message_id: i64,
1253 #[serde(skip_serializing_if = "Option::is_none")]
1254 send_date: Option<i64>,
1255}
1256#[derive(Serialize, Debug)]
1257struct HideGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
1258 chat_id: V,
1259}
1260#[derive(Serialize, Debug)]
1261struct CreateNewStickerSetOpts<'a> {
1262 user_id: i64,
1263 name: &'a str,
1264 title: &'a str,
1265 stickers: String,
1266 #[serde(skip_serializing_if = "Option::is_none")]
1267 sticker_type: Option<&'a str>,
1268 #[serde(skip_serializing_if = "Option::is_none")]
1269 needs_repainting: Option<bool>,
1270}
1271#[derive(Serialize, Debug)]
1272struct SendVideoNoteOpts<'a, V: Into<ChatHandle> + Serialize> {
1273 #[serde(skip_serializing_if = "Option::is_none")]
1274 business_connection_id: Option<&'a str>,
1275 chat_id: V,
1276 #[serde(skip_serializing_if = "Option::is_none")]
1277 message_thread_id: Option<i64>,
1278 #[serde(skip_serializing_if = "Option::is_none")]
1279 direct_messages_topic_id: Option<i64>,
1280 video_note: String,
1281 #[serde(skip_serializing_if = "Option::is_none")]
1282 duration: Option<i64>,
1283 #[serde(skip_serializing_if = "Option::is_none")]
1284 length: Option<i64>,
1285 #[serde(skip_serializing_if = "Option::is_none")]
1286 thumbnail: Option<String>,
1287 #[serde(skip_serializing_if = "Option::is_none")]
1288 disable_notification: Option<bool>,
1289 #[serde(skip_serializing_if = "Option::is_none")]
1290 protect_content: Option<bool>,
1291 #[serde(skip_serializing_if = "Option::is_none")]
1292 allow_paid_broadcast: Option<bool>,
1293 #[serde(skip_serializing_if = "Option::is_none")]
1294 message_effect_id: Option<&'a str>,
1295 #[serde(skip_serializing_if = "Option::is_none")]
1296 suggested_post_parameters: Option<String>,
1297 #[serde(skip_serializing_if = "Option::is_none")]
1298 reply_parameters: Option<String>,
1299 #[serde(skip_serializing_if = "Option::is_none")]
1300 reply_markup: Option<String>,
1301}
1302#[derive(Serialize, Debug)]
1303struct UnbanChatMemberOpts<V: Into<ChatHandle> + Serialize> {
1304 chat_id: V,
1305 user_id: i64,
1306 #[serde(skip_serializing_if = "Option::is_none")]
1307 only_if_banned: Option<bool>,
1308}
1309#[derive(Serialize, Debug)]
1310struct EditChatSubscriptionInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
1311 chat_id: V,
1312 invite_link: &'a str,
1313 #[serde(skip_serializing_if = "Option::is_none")]
1314 name: Option<&'a str>,
1315}
1316#[derive(Serialize, Debug)]
1317struct UnpinAllForumTopicMessagesOpts<V: Into<ChatHandle> + Serialize> {
1318 chat_id: V,
1319 message_thread_id: i64,
1320}
1321#[derive(Serialize, Debug)]
1322struct SendGameOpts<'a> {
1323 #[serde(skip_serializing_if = "Option::is_none")]
1324 business_connection_id: Option<&'a str>,
1325 chat_id: i64,
1326 #[serde(skip_serializing_if = "Option::is_none")]
1327 message_thread_id: Option<i64>,
1328 game_short_name: &'a str,
1329 #[serde(skip_serializing_if = "Option::is_none")]
1330 disable_notification: Option<bool>,
1331 #[serde(skip_serializing_if = "Option::is_none")]
1332 protect_content: Option<bool>,
1333 #[serde(skip_serializing_if = "Option::is_none")]
1334 allow_paid_broadcast: Option<bool>,
1335 #[serde(skip_serializing_if = "Option::is_none")]
1336 message_effect_id: Option<&'a str>,
1337 #[serde(skip_serializing_if = "Option::is_none")]
1338 reply_parameters: Option<String>,
1339 #[serde(skip_serializing_if = "Option::is_none")]
1340 reply_markup: Option<String>,
1341}
1342#[derive(Serialize, Debug)]
1343struct CloseGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
1344 chat_id: V,
1345}
1346#[derive(Serialize, Debug)]
1347struct SetStickerPositionInSetOpts<'a> {
1348 sticker: &'a str,
1349 position: i64,
1350}
1351#[derive(Serialize, Debug)]
1352struct SendAudioOpts<'a, V: Into<ChatHandle> + Serialize> {
1353 #[serde(skip_serializing_if = "Option::is_none")]
1354 business_connection_id: Option<&'a str>,
1355 chat_id: V,
1356 #[serde(skip_serializing_if = "Option::is_none")]
1357 message_thread_id: Option<i64>,
1358 #[serde(skip_serializing_if = "Option::is_none")]
1359 direct_messages_topic_id: Option<i64>,
1360 audio: String,
1361 #[serde(skip_serializing_if = "Option::is_none")]
1362 caption: Option<&'a str>,
1363 #[serde(skip_serializing_if = "Option::is_none")]
1364 parse_mode: Option<&'a str>,
1365 #[serde(skip_serializing_if = "Option::is_none")]
1366 caption_entities: Option<String>,
1367 #[serde(skip_serializing_if = "Option::is_none")]
1368 duration: Option<i64>,
1369 #[serde(skip_serializing_if = "Option::is_none")]
1370 performer: Option<&'a str>,
1371 #[serde(skip_serializing_if = "Option::is_none")]
1372 title: Option<&'a str>,
1373 #[serde(skip_serializing_if = "Option::is_none")]
1374 thumbnail: Option<String>,
1375 #[serde(skip_serializing_if = "Option::is_none")]
1376 disable_notification: Option<bool>,
1377 #[serde(skip_serializing_if = "Option::is_none")]
1378 protect_content: Option<bool>,
1379 #[serde(skip_serializing_if = "Option::is_none")]
1380 allow_paid_broadcast: Option<bool>,
1381 #[serde(skip_serializing_if = "Option::is_none")]
1382 message_effect_id: Option<&'a str>,
1383 #[serde(skip_serializing_if = "Option::is_none")]
1384 suggested_post_parameters: Option<String>,
1385 #[serde(skip_serializing_if = "Option::is_none")]
1386 reply_parameters: Option<String>,
1387 #[serde(skip_serializing_if = "Option::is_none")]
1388 reply_markup: Option<String>,
1389}
1390#[derive(Serialize, Debug)]
1391struct EditMessageTextOpts<'a, V: Into<ChatHandle> + Serialize> {
1392 #[serde(skip_serializing_if = "Option::is_none")]
1393 business_connection_id: Option<&'a str>,
1394 #[serde(skip_serializing_if = "Option::is_none")]
1395 chat_id: Option<V>,
1396 #[serde(skip_serializing_if = "Option::is_none")]
1397 message_id: Option<i64>,
1398 #[serde(skip_serializing_if = "Option::is_none")]
1399 inline_message_id: Option<&'a str>,
1400 text: &'a str,
1401 #[serde(skip_serializing_if = "Option::is_none")]
1402 parse_mode: Option<&'a str>,
1403 #[serde(skip_serializing_if = "Option::is_none")]
1404 entities: Option<String>,
1405 #[serde(skip_serializing_if = "Option::is_none")]
1406 link_preview_options: Option<String>,
1407 #[serde(skip_serializing_if = "Option::is_none")]
1408 reply_markup: Option<String>,
1409}
1410#[derive(Serialize, Debug)]
1411struct GetChatMenuButtonOpts {
1412 #[serde(skip_serializing_if = "Option::is_none")]
1413 chat_id: Option<i64>,
1414}
1415#[derive(Serialize, Debug)]
1416struct SendStickerOpts<'a, V: Into<ChatHandle> + Serialize> {
1417 #[serde(skip_serializing_if = "Option::is_none")]
1418 business_connection_id: Option<&'a str>,
1419 chat_id: V,
1420 #[serde(skip_serializing_if = "Option::is_none")]
1421 message_thread_id: Option<i64>,
1422 #[serde(skip_serializing_if = "Option::is_none")]
1423 direct_messages_topic_id: Option<i64>,
1424 sticker: String,
1425 #[serde(skip_serializing_if = "Option::is_none")]
1426 emoji: Option<&'a str>,
1427 #[serde(skip_serializing_if = "Option::is_none")]
1428 disable_notification: Option<bool>,
1429 #[serde(skip_serializing_if = "Option::is_none")]
1430 protect_content: Option<bool>,
1431 #[serde(skip_serializing_if = "Option::is_none")]
1432 allow_paid_broadcast: Option<bool>,
1433 #[serde(skip_serializing_if = "Option::is_none")]
1434 message_effect_id: Option<&'a str>,
1435 #[serde(skip_serializing_if = "Option::is_none")]
1436 suggested_post_parameters: Option<String>,
1437 #[serde(skip_serializing_if = "Option::is_none")]
1438 reply_parameters: Option<String>,
1439 #[serde(skip_serializing_if = "Option::is_none")]
1440 reply_markup: Option<String>,
1441}
1442#[derive(Serialize, Debug)]
1443struct SendVideoOpts<'a, V: Into<ChatHandle> + Serialize> {
1444 #[serde(skip_serializing_if = "Option::is_none")]
1445 business_connection_id: Option<&'a str>,
1446 chat_id: V,
1447 #[serde(skip_serializing_if = "Option::is_none")]
1448 message_thread_id: Option<i64>,
1449 #[serde(skip_serializing_if = "Option::is_none")]
1450 direct_messages_topic_id: Option<i64>,
1451 video: String,
1452 #[serde(skip_serializing_if = "Option::is_none")]
1453 duration: Option<i64>,
1454 #[serde(skip_serializing_if = "Option::is_none")]
1455 width: Option<i64>,
1456 #[serde(skip_serializing_if = "Option::is_none")]
1457 height: Option<i64>,
1458 #[serde(skip_serializing_if = "Option::is_none")]
1459 thumbnail: Option<String>,
1460 #[serde(skip_serializing_if = "Option::is_none")]
1461 cover: Option<String>,
1462 #[serde(skip_serializing_if = "Option::is_none")]
1463 start_timestamp: Option<i64>,
1464 #[serde(skip_serializing_if = "Option::is_none")]
1465 caption: Option<&'a str>,
1466 #[serde(skip_serializing_if = "Option::is_none")]
1467 parse_mode: Option<&'a str>,
1468 #[serde(skip_serializing_if = "Option::is_none")]
1469 caption_entities: Option<String>,
1470 #[serde(skip_serializing_if = "Option::is_none")]
1471 show_caption_above_media: Option<bool>,
1472 #[serde(skip_serializing_if = "Option::is_none")]
1473 has_spoiler: Option<bool>,
1474 #[serde(skip_serializing_if = "Option::is_none")]
1475 supports_streaming: Option<bool>,
1476 #[serde(skip_serializing_if = "Option::is_none")]
1477 disable_notification: Option<bool>,
1478 #[serde(skip_serializing_if = "Option::is_none")]
1479 protect_content: Option<bool>,
1480 #[serde(skip_serializing_if = "Option::is_none")]
1481 allow_paid_broadcast: Option<bool>,
1482 #[serde(skip_serializing_if = "Option::is_none")]
1483 message_effect_id: Option<&'a str>,
1484 #[serde(skip_serializing_if = "Option::is_none")]
1485 suggested_post_parameters: Option<String>,
1486 #[serde(skip_serializing_if = "Option::is_none")]
1487 reply_parameters: Option<String>,
1488 #[serde(skip_serializing_if = "Option::is_none")]
1489 reply_markup: Option<String>,
1490}
1491#[derive(Serialize, Debug)]
1492struct BanChatSenderChatOpts<V: Into<ChatHandle> + Serialize> {
1493 chat_id: V,
1494 sender_chat_id: i64,
1495}
1496#[derive(Serialize, Debug)]
1497struct GetChatAdministratorsOpts<V: Into<ChatHandle> + Serialize> {
1498 chat_id: V,
1499}
1500#[derive(Serialize, Debug)]
1501struct DeleteForumTopicOpts<V: Into<ChatHandle> + Serialize> {
1502 chat_id: V,
1503 message_thread_id: i64,
1504}
1505#[derive(Serialize, Debug)]
1506struct GetBusinessConnectionOpts<'a> {
1507 business_connection_id: &'a str,
1508}
1509#[derive(Serialize, Debug)]
1510struct SetBusinessAccountNameOpts<'a> {
1511 business_connection_id: &'a str,
1512 first_name: &'a str,
1513 #[serde(skip_serializing_if = "Option::is_none")]
1514 last_name: Option<&'a str>,
1515}
1516#[derive(Serialize, Debug)]
1517struct SetBusinessAccountGiftSettingsOpts<'a> {
1518 business_connection_id: &'a str,
1519 show_gift_button: bool,
1520 accepted_gift_types: String,
1521}
1522#[derive(Serialize, Debug)]
1523struct StopMessageLiveLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
1524 #[serde(skip_serializing_if = "Option::is_none")]
1525 business_connection_id: Option<&'a str>,
1526 #[serde(skip_serializing_if = "Option::is_none")]
1527 chat_id: Option<V>,
1528 #[serde(skip_serializing_if = "Option::is_none")]
1529 message_id: Option<i64>,
1530 #[serde(skip_serializing_if = "Option::is_none")]
1531 inline_message_id: Option<&'a str>,
1532 #[serde(skip_serializing_if = "Option::is_none")]
1533 reply_markup: Option<String>,
1534}
1535#[derive(Serialize, Debug)]
1536struct SendPollOpts<'a, V: Into<ChatHandle> + Serialize> {
1537 #[serde(skip_serializing_if = "Option::is_none")]
1538 business_connection_id: Option<&'a str>,
1539 chat_id: V,
1540 #[serde(skip_serializing_if = "Option::is_none")]
1541 message_thread_id: Option<i64>,
1542 question: &'a str,
1543 #[serde(skip_serializing_if = "Option::is_none")]
1544 question_parse_mode: Option<&'a str>,
1545 #[serde(skip_serializing_if = "Option::is_none")]
1546 question_entities: Option<String>,
1547 options: String,
1548 #[serde(skip_serializing_if = "Option::is_none")]
1549 is_anonymous: Option<bool>,
1550 #[serde(skip_serializing_if = "Option::is_none")]
1551 tg_type: Option<&'a str>,
1552 #[serde(skip_serializing_if = "Option::is_none")]
1553 allows_multiple_answers: Option<bool>,
1554 #[serde(skip_serializing_if = "Option::is_none")]
1555 correct_option_id: Option<i64>,
1556 #[serde(skip_serializing_if = "Option::is_none")]
1557 explanation: Option<&'a str>,
1558 #[serde(skip_serializing_if = "Option::is_none")]
1559 explanation_parse_mode: Option<&'a str>,
1560 #[serde(skip_serializing_if = "Option::is_none")]
1561 explanation_entities: Option<String>,
1562 #[serde(skip_serializing_if = "Option::is_none")]
1563 open_period: Option<i64>,
1564 #[serde(skip_serializing_if = "Option::is_none")]
1565 close_date: Option<i64>,
1566 #[serde(skip_serializing_if = "Option::is_none")]
1567 is_closed: Option<bool>,
1568 #[serde(skip_serializing_if = "Option::is_none")]
1569 disable_notification: Option<bool>,
1570 #[serde(skip_serializing_if = "Option::is_none")]
1571 protect_content: Option<bool>,
1572 #[serde(skip_serializing_if = "Option::is_none")]
1573 allow_paid_broadcast: Option<bool>,
1574 #[serde(skip_serializing_if = "Option::is_none")]
1575 message_effect_id: Option<&'a str>,
1576 #[serde(skip_serializing_if = "Option::is_none")]
1577 reply_parameters: Option<String>,
1578 #[serde(skip_serializing_if = "Option::is_none")]
1579 reply_markup: Option<String>,
1580}
1581#[derive(Serialize, Debug)]
1582struct AnswerCallbackQueryOpts<'a> {
1583 callback_query_id: &'a str,
1584 #[serde(skip_serializing_if = "Option::is_none")]
1585 text: Option<&'a str>,
1586 #[serde(skip_serializing_if = "Option::is_none")]
1587 show_alert: Option<bool>,
1588 #[serde(skip_serializing_if = "Option::is_none")]
1589 url: Option<&'a str>,
1590 #[serde(skip_serializing_if = "Option::is_none")]
1591 cache_time: Option<i64>,
1592}
1593#[derive(Serialize, Debug)]
1594struct ForwardMessageOpts<V: Into<ChatHandle> + Serialize> {
1595 chat_id: V,
1596 #[serde(skip_serializing_if = "Option::is_none")]
1597 message_thread_id: Option<i64>,
1598 #[serde(skip_serializing_if = "Option::is_none")]
1599 direct_messages_topic_id: Option<i64>,
1600 from_chat_id: V,
1601 #[serde(skip_serializing_if = "Option::is_none")]
1602 video_start_timestamp: Option<i64>,
1603 #[serde(skip_serializing_if = "Option::is_none")]
1604 disable_notification: Option<bool>,
1605 #[serde(skip_serializing_if = "Option::is_none")]
1606 protect_content: Option<bool>,
1607 #[serde(skip_serializing_if = "Option::is_none")]
1608 suggested_post_parameters: Option<String>,
1609 message_id: i64,
1610}
1611#[derive(Serialize, Debug)]
1612struct RevokeChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
1613 chat_id: V,
1614 invite_link: &'a str,
1615}
1616#[derive(Serialize, Debug)]
1617struct StopPollOpts<'a, V: Into<ChatHandle> + Serialize> {
1618 #[serde(skip_serializing_if = "Option::is_none")]
1619 business_connection_id: Option<&'a str>,
1620 chat_id: V,
1621 message_id: i64,
1622 #[serde(skip_serializing_if = "Option::is_none")]
1623 reply_markup: Option<String>,
1624}
1625#[derive(Serialize, Debug)]
1626struct UnhideGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
1627 chat_id: V,
1628}
1629#[derive(Serialize, Debug)]
1630struct UploadStickerFileOpts<'a> {
1631 user_id: i64,
1632 sticker: String,
1633 sticker_format: &'a str,
1634}
1635#[derive(Serialize, Debug)]
1636struct SetStickerKeywordsOpts<'a> {
1637 sticker: &'a str,
1638 #[serde(skip_serializing_if = "Option::is_none")]
1639 keywords: Option<String>,
1640}
1641#[derive(Serialize, Debug)]
1642struct SetChatMenuButtonOpts {
1643 #[serde(skip_serializing_if = "Option::is_none")]
1644 chat_id: Option<i64>,
1645 #[serde(skip_serializing_if = "Option::is_none")]
1646 menu_button: Option<String>,
1647}
1648#[derive(Serialize, Debug)]
1649struct EditStoryOpts<'a> {
1650 business_connection_id: &'a str,
1651 story_id: i64,
1652 content: String,
1653 #[serde(skip_serializing_if = "Option::is_none")]
1654 caption: Option<&'a str>,
1655 #[serde(skip_serializing_if = "Option::is_none")]
1656 parse_mode: Option<&'a str>,
1657 #[serde(skip_serializing_if = "Option::is_none")]
1658 caption_entities: Option<String>,
1659 #[serde(skip_serializing_if = "Option::is_none")]
1660 areas: Option<String>,
1661}
1662#[derive(Serialize, Debug)]
1663struct SendDocumentOpts<'a, V: Into<ChatHandle> + Serialize> {
1664 #[serde(skip_serializing_if = "Option::is_none")]
1665 business_connection_id: Option<&'a str>,
1666 chat_id: V,
1667 #[serde(skip_serializing_if = "Option::is_none")]
1668 message_thread_id: Option<i64>,
1669 #[serde(skip_serializing_if = "Option::is_none")]
1670 direct_messages_topic_id: Option<i64>,
1671 document: String,
1672 #[serde(skip_serializing_if = "Option::is_none")]
1673 thumbnail: Option<String>,
1674 #[serde(skip_serializing_if = "Option::is_none")]
1675 caption: Option<&'a str>,
1676 #[serde(skip_serializing_if = "Option::is_none")]
1677 parse_mode: Option<&'a str>,
1678 #[serde(skip_serializing_if = "Option::is_none")]
1679 caption_entities: Option<String>,
1680 #[serde(skip_serializing_if = "Option::is_none")]
1681 disable_content_type_detection: Option<bool>,
1682 #[serde(skip_serializing_if = "Option::is_none")]
1683 disable_notification: Option<bool>,
1684 #[serde(skip_serializing_if = "Option::is_none")]
1685 protect_content: Option<bool>,
1686 #[serde(skip_serializing_if = "Option::is_none")]
1687 allow_paid_broadcast: Option<bool>,
1688 #[serde(skip_serializing_if = "Option::is_none")]
1689 message_effect_id: Option<&'a str>,
1690 #[serde(skip_serializing_if = "Option::is_none")]
1691 suggested_post_parameters: Option<String>,
1692 #[serde(skip_serializing_if = "Option::is_none")]
1693 reply_parameters: Option<String>,
1694 #[serde(skip_serializing_if = "Option::is_none")]
1695 reply_markup: Option<String>,
1696}
1697#[derive(Serialize, Debug)]
1698struct SendVenueOpts<'a, V: Into<ChatHandle> + Serialize> {
1699 #[serde(skip_serializing_if = "Option::is_none")]
1700 business_connection_id: Option<&'a str>,
1701 chat_id: V,
1702 #[serde(skip_serializing_if = "Option::is_none")]
1703 message_thread_id: Option<i64>,
1704 #[serde(skip_serializing_if = "Option::is_none")]
1705 direct_messages_topic_id: Option<i64>,
1706 latitude: ::ordered_float::OrderedFloat<f64>,
1707 longitude: ::ordered_float::OrderedFloat<f64>,
1708 title: &'a str,
1709 address: &'a str,
1710 #[serde(skip_serializing_if = "Option::is_none")]
1711 foursquare_id: Option<&'a str>,
1712 #[serde(skip_serializing_if = "Option::is_none")]
1713 foursquare_type: Option<&'a str>,
1714 #[serde(skip_serializing_if = "Option::is_none")]
1715 google_place_id: Option<&'a str>,
1716 #[serde(skip_serializing_if = "Option::is_none")]
1717 google_place_type: Option<&'a str>,
1718 #[serde(skip_serializing_if = "Option::is_none")]
1719 disable_notification: Option<bool>,
1720 #[serde(skip_serializing_if = "Option::is_none")]
1721 protect_content: Option<bool>,
1722 #[serde(skip_serializing_if = "Option::is_none")]
1723 allow_paid_broadcast: Option<bool>,
1724 #[serde(skip_serializing_if = "Option::is_none")]
1725 message_effect_id: Option<&'a str>,
1726 #[serde(skip_serializing_if = "Option::is_none")]
1727 suggested_post_parameters: Option<String>,
1728 #[serde(skip_serializing_if = "Option::is_none")]
1729 reply_parameters: Option<String>,
1730 #[serde(skip_serializing_if = "Option::is_none")]
1731 reply_markup: Option<String>,
1732}
1733#[derive(Serialize, Debug)]
1734struct CreateForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
1735 chat_id: V,
1736 name: &'a str,
1737 #[serde(skip_serializing_if = "Option::is_none")]
1738 icon_color: Option<i64>,
1739 #[serde(skip_serializing_if = "Option::is_none")]
1740 icon_custom_emoji_id: Option<&'a str>,
1741}
1742#[derive(Serialize, Debug)]
1743struct RemoveUserVerificationOpts {
1744 user_id: i64,
1745}
1746#[derive(Serialize, Debug)]
1747struct RestrictChatMemberOpts<V: Into<ChatHandle> + Serialize> {
1748 chat_id: V,
1749 user_id: i64,
1750 permissions: String,
1751 #[serde(skip_serializing_if = "Option::is_none")]
1752 use_independent_chat_permissions: Option<bool>,
1753 #[serde(skip_serializing_if = "Option::is_none")]
1754 until_date: Option<i64>,
1755}
1756pub struct CallEditMessageReplyMarkup<'a, V> {
1757 bot: &'a Bot,
1758 business_connection_id: Option<&'a str>,
1759 chat_id: Option<V>,
1760 message_id: Option<i64>,
1761 inline_message_id: Option<&'a str>,
1762 reply_markup: Option<&'a InlineKeyboardMarkup>,
1763}
1764impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageReplyMarkup<'a, V> {
1765 #[allow(rustdoc::invalid_html_tags)]
1766 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
1767 #[allow(clippy::needless_lifetimes)]
1768 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
1769 self.business_connection_id = Some(business_connection_id);
1770 self
1771 }
1772 #[allow(clippy::needless_lifetimes)]
1773 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
1774 &self.business_connection_id
1775 }
1776 #[allow(rustdoc::invalid_html_tags)]
1777 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
1778 #[allow(clippy::needless_lifetimes)]
1779 pub fn chat_id(mut self, chat_id: V) -> Self {
1780 self.chat_id = Some(chat_id);
1781 self
1782 }
1783 #[allow(clippy::needless_lifetimes)]
1784 pub fn get_chat_id(&'a self) -> &'a Option<V> {
1785 &self.chat_id
1786 }
1787 #[allow(rustdoc::invalid_html_tags)]
1788 #[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
1789 #[allow(clippy::needless_lifetimes)]
1790 pub fn message_id(mut self, message_id: i64) -> Self {
1791 self.message_id = Some(message_id);
1792 self
1793 }
1794 #[allow(clippy::needless_lifetimes)]
1795 pub fn get_message_id(&'a self) -> &'a Option<i64> {
1796 &self.message_id
1797 }
1798 #[allow(rustdoc::invalid_html_tags)]
1799 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
1800 #[allow(clippy::needless_lifetimes)]
1801 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
1802 self.inline_message_id = Some(inline_message_id);
1803 self
1804 }
1805 #[allow(clippy::needless_lifetimes)]
1806 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
1807 &self.inline_message_id
1808 }
1809 #[allow(rustdoc::invalid_html_tags)]
1810 #[doc = "A JSON-serialized object for an inline keyboard."]
1811 #[allow(clippy::needless_lifetimes)]
1812 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
1813 where
1814 T: Into<&'a InlineKeyboardMarkup>,
1815 {
1816 self.reply_markup = Some(reply_markup.into());
1817 self
1818 }
1819 #[allow(clippy::needless_lifetimes)]
1820 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
1821 &self.reply_markup
1822 }
1823 pub async fn build(self) -> BotResult<MessageBool> {
1824 self.bot
1825 .edit_message_reply_markup(
1826 self.business_connection_id,
1827 self.chat_id,
1828 self.message_id,
1829 self.inline_message_id,
1830 self.reply_markup,
1831 )
1832 .await
1833 }
1834}
1835pub struct CallPostStory<'a> {
1836 bot: &'a Bot,
1837 business_connection_id: &'a str,
1838 content: &'a InputStoryContent,
1839 active_period: i64,
1840 caption: Option<&'a str>,
1841 parse_mode: Option<&'a str>,
1842 caption_entities: Option<&'a Vec<MessageEntity>>,
1843 areas: Option<&'a Vec<StoryArea>>,
1844 post_to_chat_page: Option<bool>,
1845 protect_content: Option<bool>,
1846}
1847impl<'a> CallPostStory<'a> {
1848 #[allow(rustdoc::invalid_html_tags)]
1849 #[doc = "Unique identifier of the business connection"]
1850 #[allow(clippy::needless_lifetimes)]
1851 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
1852 self.business_connection_id = business_connection_id;
1853 self
1854 }
1855 #[allow(clippy::needless_lifetimes)]
1856 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
1857 &self.business_connection_id
1858 }
1859 #[allow(rustdoc::invalid_html_tags)]
1860 #[doc = "Content of the story"]
1861 #[allow(clippy::needless_lifetimes)]
1862 pub fn content<T>(mut self, content: T) -> Self
1863 where
1864 T: Into<&'a InputStoryContent>,
1865 {
1866 self.content = content.into();
1867 self
1868 }
1869 #[allow(clippy::needless_lifetimes)]
1870 pub fn get_content(&'a self) -> &'a &'a InputStoryContent {
1871 &self.content
1872 }
1873 #[allow(rustdoc::invalid_html_tags)]
1874 #[doc = "Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400"]
1875 #[allow(clippy::needless_lifetimes)]
1876 pub fn active_period(mut self, active_period: i64) -> Self {
1877 self.active_period = active_period;
1878 self
1879 }
1880 #[allow(clippy::needless_lifetimes)]
1881 pub fn get_active_period(&'a self) -> &'a i64 {
1882 &self.active_period
1883 }
1884 #[allow(rustdoc::invalid_html_tags)]
1885 #[doc = "Caption of the story, 0-2048 characters after entities parsing"]
1886 #[allow(clippy::needless_lifetimes)]
1887 pub fn caption(mut self, caption: &'a str) -> Self {
1888 self.caption = Some(caption);
1889 self
1890 }
1891 #[allow(clippy::needless_lifetimes)]
1892 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
1893 &self.caption
1894 }
1895 #[allow(rustdoc::invalid_html_tags)]
1896 #[doc = "Mode for parsing entities in the story caption. See formatting options for more details."]
1897 #[allow(clippy::needless_lifetimes)]
1898 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
1899 self.parse_mode = Some(parse_mode);
1900 self
1901 }
1902 #[allow(clippy::needless_lifetimes)]
1903 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
1904 &self.parse_mode
1905 }
1906 #[allow(rustdoc::invalid_html_tags)]
1907 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
1908 #[allow(clippy::needless_lifetimes)]
1909 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
1910 self.caption_entities = Some(caption_entities);
1911 self
1912 }
1913 #[allow(clippy::needless_lifetimes)]
1914 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
1915 &self.caption_entities
1916 }
1917 #[allow(rustdoc::invalid_html_tags)]
1918 #[doc = "A JSON-serialized list of clickable areas to be shown on the story"]
1919 #[allow(clippy::needless_lifetimes)]
1920 pub fn areas(mut self, areas: &'a Vec<StoryArea>) -> Self {
1921 self.areas = Some(areas);
1922 self
1923 }
1924 #[allow(clippy::needless_lifetimes)]
1925 pub fn get_areas(&'a self) -> &'a Option<&'a Vec<StoryArea>> {
1926 &self.areas
1927 }
1928 #[allow(rustdoc::invalid_html_tags)]
1929 #[doc = "Pass True to keep the story accessible after it expires"]
1930 #[allow(clippy::needless_lifetimes)]
1931 pub fn post_to_chat_page(mut self, post_to_chat_page: bool) -> Self {
1932 self.post_to_chat_page = Some(post_to_chat_page);
1933 self
1934 }
1935 #[allow(clippy::needless_lifetimes)]
1936 pub fn get_post_to_chat_page(&'a self) -> &'a Option<bool> {
1937 &self.post_to_chat_page
1938 }
1939 #[allow(rustdoc::invalid_html_tags)]
1940 #[doc = "Pass True if the content of the story must be protected from forwarding and screenshotting"]
1941 #[allow(clippy::needless_lifetimes)]
1942 pub fn protect_content(mut self, protect_content: bool) -> Self {
1943 self.protect_content = Some(protect_content);
1944 self
1945 }
1946 #[allow(clippy::needless_lifetimes)]
1947 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
1948 &self.protect_content
1949 }
1950 pub async fn build(self) -> BotResult<Story> {
1951 self.bot
1952 .post_story(
1953 self.business_connection_id,
1954 self.content,
1955 self.active_period,
1956 self.caption,
1957 self.parse_mode,
1958 self.caption_entities,
1959 self.areas,
1960 self.post_to_chat_page,
1961 self.protect_content,
1962 )
1963 .await
1964 }
1965}
1966pub struct CallUnbanChatSenderChat<'a, V> {
1967 bot: &'a Bot,
1968 chat_id: V,
1969 sender_chat_id: i64,
1970}
1971impl<'a, V: Into<ChatHandle> + Serialize> CallUnbanChatSenderChat<'a, V> {
1972 #[allow(rustdoc::invalid_html_tags)]
1973 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
1974 #[allow(clippy::needless_lifetimes)]
1975 pub fn chat_id(mut self, chat_id: V) -> Self {
1976 self.chat_id = chat_id;
1977 self
1978 }
1979 #[allow(clippy::needless_lifetimes)]
1980 pub fn get_chat_id(&'a self) -> &'a V {
1981 &self.chat_id
1982 }
1983 #[allow(rustdoc::invalid_html_tags)]
1984 #[doc = "Unique identifier of the target sender chat"]
1985 #[allow(clippy::needless_lifetimes)]
1986 pub fn sender_chat_id(mut self, sender_chat_id: i64) -> Self {
1987 self.sender_chat_id = sender_chat_id;
1988 self
1989 }
1990 #[allow(clippy::needless_lifetimes)]
1991 pub fn get_sender_chat_id(&'a self) -> &'a i64 {
1992 &self.sender_chat_id
1993 }
1994 pub async fn build(self) -> BotResult<bool> {
1995 self.bot
1996 .unban_chat_sender_chat(self.chat_id, self.sender_chat_id)
1997 .await
1998 }
1999}
2000pub struct CallGetMe<'a> {
2001 bot: &'a Bot,
2002}
2003impl<'a> CallGetMe<'a> {
2004 pub async fn build(self) -> BotResult<User> {
2005 self.bot.get_me().await
2006 }
2007}
2008pub struct CallExportChatInviteLink<'a, V> {
2009 bot: &'a Bot,
2010 chat_id: V,
2011}
2012impl<'a, V: Into<ChatHandle> + Serialize> CallExportChatInviteLink<'a, V> {
2013 #[allow(rustdoc::invalid_html_tags)]
2014 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2015 #[allow(clippy::needless_lifetimes)]
2016 pub fn chat_id(mut self, chat_id: V) -> Self {
2017 self.chat_id = chat_id;
2018 self
2019 }
2020 #[allow(clippy::needless_lifetimes)]
2021 pub fn get_chat_id(&'a self) -> &'a V {
2022 &self.chat_id
2023 }
2024 pub async fn build(self) -> BotResult<String> {
2025 self.bot.export_chat_invite_link(self.chat_id).await
2026 }
2027}
2028pub struct CallGetChatMember<'a, V> {
2029 bot: &'a Bot,
2030 chat_id: V,
2031 user_id: i64,
2032}
2033impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatMember<'a, V> {
2034 #[allow(rustdoc::invalid_html_tags)]
2035 #[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
2036 #[allow(clippy::needless_lifetimes)]
2037 pub fn chat_id(mut self, chat_id: V) -> Self {
2038 self.chat_id = chat_id;
2039 self
2040 }
2041 #[allow(clippy::needless_lifetimes)]
2042 pub fn get_chat_id(&'a self) -> &'a V {
2043 &self.chat_id
2044 }
2045 #[allow(rustdoc::invalid_html_tags)]
2046 #[doc = "Unique identifier of the target user"]
2047 #[allow(clippy::needless_lifetimes)]
2048 pub fn user_id(mut self, user_id: i64) -> Self {
2049 self.user_id = user_id;
2050 self
2051 }
2052 #[allow(clippy::needless_lifetimes)]
2053 pub fn get_user_id(&'a self) -> &'a i64 {
2054 &self.user_id
2055 }
2056 pub async fn build(self) -> BotResult<ChatMember> {
2057 self.bot.get_chat_member(self.chat_id, self.user_id).await
2058 }
2059}
2060pub struct CallSetCustomEmojiStickerSetThumbnail<'a> {
2061 bot: &'a Bot,
2062 name: &'a str,
2063 custom_emoji_id: Option<&'a str>,
2064}
2065impl<'a> CallSetCustomEmojiStickerSetThumbnail<'a> {
2066 #[allow(rustdoc::invalid_html_tags)]
2067 #[doc = "Sticker set name"]
2068 #[allow(clippy::needless_lifetimes)]
2069 pub fn name(mut self, name: &'a str) -> Self {
2070 self.name = name;
2071 self
2072 }
2073 #[allow(clippy::needless_lifetimes)]
2074 pub fn get_name(&'a self) -> &'a &'a str {
2075 &self.name
2076 }
2077 #[allow(rustdoc::invalid_html_tags)]
2078 #[doc = "Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."]
2079 #[allow(clippy::needless_lifetimes)]
2080 pub fn custom_emoji_id(mut self, custom_emoji_id: &'a str) -> Self {
2081 self.custom_emoji_id = Some(custom_emoji_id);
2082 self
2083 }
2084 #[allow(clippy::needless_lifetimes)]
2085 pub fn get_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
2086 &self.custom_emoji_id
2087 }
2088 pub async fn build(self) -> BotResult<bool> {
2089 self.bot
2090 .set_custom_emoji_sticker_set_thumbnail(self.name, self.custom_emoji_id)
2091 .await
2092 }
2093}
2094pub struct CallSetUserEmojiStatus<'a> {
2095 bot: &'a Bot,
2096 user_id: i64,
2097 emoji_status_custom_emoji_id: Option<&'a str>,
2098 emoji_status_expiration_date: Option<i64>,
2099}
2100impl<'a> CallSetUserEmojiStatus<'a> {
2101 #[allow(rustdoc::invalid_html_tags)]
2102 #[doc = "Unique identifier of the target user"]
2103 #[allow(clippy::needless_lifetimes)]
2104 pub fn user_id(mut self, user_id: i64) -> Self {
2105 self.user_id = user_id;
2106 self
2107 }
2108 #[allow(clippy::needless_lifetimes)]
2109 pub fn get_user_id(&'a self) -> &'a i64 {
2110 &self.user_id
2111 }
2112 #[allow(rustdoc::invalid_html_tags)]
2113 #[doc = "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status."]
2114 #[allow(clippy::needless_lifetimes)]
2115 pub fn emoji_status_custom_emoji_id(mut self, emoji_status_custom_emoji_id: &'a str) -> Self {
2116 self.emoji_status_custom_emoji_id = Some(emoji_status_custom_emoji_id);
2117 self
2118 }
2119 #[allow(clippy::needless_lifetimes)]
2120 pub fn get_emoji_status_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
2121 &self.emoji_status_custom_emoji_id
2122 }
2123 #[allow(rustdoc::invalid_html_tags)]
2124 #[doc = "Expiration date of the emoji status, if any"]
2125 #[allow(clippy::needless_lifetimes)]
2126 pub fn emoji_status_expiration_date(mut self, emoji_status_expiration_date: i64) -> Self {
2127 self.emoji_status_expiration_date = Some(emoji_status_expiration_date);
2128 self
2129 }
2130 #[allow(clippy::needless_lifetimes)]
2131 pub fn get_emoji_status_expiration_date(&'a self) -> &'a Option<i64> {
2132 &self.emoji_status_expiration_date
2133 }
2134 pub async fn build(self) -> BotResult<bool> {
2135 self.bot
2136 .set_user_emoji_status(
2137 self.user_id,
2138 self.emoji_status_custom_emoji_id,
2139 self.emoji_status_expiration_date,
2140 )
2141 .await
2142 }
2143}
2144pub struct CallSendContact<'a, V> {
2145 bot: &'a Bot,
2146 business_connection_id: Option<&'a str>,
2147 chat_id: V,
2148 message_thread_id: Option<i64>,
2149 direct_messages_topic_id: Option<i64>,
2150 phone_number: &'a str,
2151 first_name: &'a str,
2152 last_name: Option<&'a str>,
2153 vcard: Option<&'a str>,
2154 disable_notification: Option<bool>,
2155 protect_content: Option<bool>,
2156 allow_paid_broadcast: Option<bool>,
2157 message_effect_id: Option<&'a str>,
2158 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
2159 reply_parameters: Option<&'a ReplyParameters>,
2160 reply_markup: Option<&'a EReplyMarkup>,
2161}
2162impl<'a, V: Into<ChatHandle> + Serialize> CallSendContact<'a, V> {
2163 #[allow(rustdoc::invalid_html_tags)]
2164 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
2165 #[allow(clippy::needless_lifetimes)]
2166 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
2167 self.business_connection_id = Some(business_connection_id);
2168 self
2169 }
2170 #[allow(clippy::needless_lifetimes)]
2171 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
2172 &self.business_connection_id
2173 }
2174 #[allow(rustdoc::invalid_html_tags)]
2175 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2176 #[allow(clippy::needless_lifetimes)]
2177 pub fn chat_id(mut self, chat_id: V) -> Self {
2178 self.chat_id = chat_id;
2179 self
2180 }
2181 #[allow(clippy::needless_lifetimes)]
2182 pub fn get_chat_id(&'a self) -> &'a V {
2183 &self.chat_id
2184 }
2185 #[allow(rustdoc::invalid_html_tags)]
2186 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
2187 #[allow(clippy::needless_lifetimes)]
2188 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
2189 self.message_thread_id = Some(message_thread_id);
2190 self
2191 }
2192 #[allow(clippy::needless_lifetimes)]
2193 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
2194 &self.message_thread_id
2195 }
2196 #[allow(rustdoc::invalid_html_tags)]
2197 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
2198 #[allow(clippy::needless_lifetimes)]
2199 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
2200 self.direct_messages_topic_id = Some(direct_messages_topic_id);
2201 self
2202 }
2203 #[allow(clippy::needless_lifetimes)]
2204 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
2205 &self.direct_messages_topic_id
2206 }
2207 #[allow(rustdoc::invalid_html_tags)]
2208 #[doc = "Contact's phone number"]
2209 #[allow(clippy::needless_lifetimes)]
2210 pub fn phone_number(mut self, phone_number: &'a str) -> Self {
2211 self.phone_number = phone_number;
2212 self
2213 }
2214 #[allow(clippy::needless_lifetimes)]
2215 pub fn get_phone_number(&'a self) -> &'a &'a str {
2216 &self.phone_number
2217 }
2218 #[allow(rustdoc::invalid_html_tags)]
2219 #[doc = "Contact's first name"]
2220 #[allow(clippy::needless_lifetimes)]
2221 pub fn first_name(mut self, first_name: &'a str) -> Self {
2222 self.first_name = first_name;
2223 self
2224 }
2225 #[allow(clippy::needless_lifetimes)]
2226 pub fn get_first_name(&'a self) -> &'a &'a str {
2227 &self.first_name
2228 }
2229 #[allow(rustdoc::invalid_html_tags)]
2230 #[doc = "Contact's last name"]
2231 #[allow(clippy::needless_lifetimes)]
2232 pub fn last_name(mut self, last_name: &'a str) -> Self {
2233 self.last_name = Some(last_name);
2234 self
2235 }
2236 #[allow(clippy::needless_lifetimes)]
2237 pub fn get_last_name(&'a self) -> &'a Option<&'a str> {
2238 &self.last_name
2239 }
2240 #[allow(rustdoc::invalid_html_tags)]
2241 #[doc = "Additional data about the contact in the form of a vCard, 0-2048 bytes"]
2242 #[allow(clippy::needless_lifetimes)]
2243 pub fn vcard(mut self, vcard: &'a str) -> Self {
2244 self.vcard = Some(vcard);
2245 self
2246 }
2247 #[allow(clippy::needless_lifetimes)]
2248 pub fn get_vcard(&'a self) -> &'a Option<&'a str> {
2249 &self.vcard
2250 }
2251 #[allow(rustdoc::invalid_html_tags)]
2252 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
2253 #[allow(clippy::needless_lifetimes)]
2254 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
2255 self.disable_notification = Some(disable_notification);
2256 self
2257 }
2258 #[allow(clippy::needless_lifetimes)]
2259 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
2260 &self.disable_notification
2261 }
2262 #[allow(rustdoc::invalid_html_tags)]
2263 #[doc = "Protects the contents of the sent message from forwarding and saving"]
2264 #[allow(clippy::needless_lifetimes)]
2265 pub fn protect_content(mut self, protect_content: bool) -> Self {
2266 self.protect_content = Some(protect_content);
2267 self
2268 }
2269 #[allow(clippy::needless_lifetimes)]
2270 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
2271 &self.protect_content
2272 }
2273 #[allow(rustdoc::invalid_html_tags)]
2274 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
2275 #[allow(clippy::needless_lifetimes)]
2276 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
2277 self.allow_paid_broadcast = Some(allow_paid_broadcast);
2278 self
2279 }
2280 #[allow(clippy::needless_lifetimes)]
2281 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
2282 &self.allow_paid_broadcast
2283 }
2284 #[allow(rustdoc::invalid_html_tags)]
2285 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
2286 #[allow(clippy::needless_lifetimes)]
2287 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
2288 self.message_effect_id = Some(message_effect_id);
2289 self
2290 }
2291 #[allow(clippy::needless_lifetimes)]
2292 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
2293 &self.message_effect_id
2294 }
2295 #[allow(rustdoc::invalid_html_tags)]
2296 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
2297 #[allow(clippy::needless_lifetimes)]
2298 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
2299 where
2300 T: Into<&'a SuggestedPostParameters>,
2301 {
2302 self.suggested_post_parameters = Some(suggested_post_parameters.into());
2303 self
2304 }
2305 #[allow(clippy::needless_lifetimes)]
2306 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
2307 &self.suggested_post_parameters
2308 }
2309 #[allow(rustdoc::invalid_html_tags)]
2310 #[doc = "Description of the message to reply to"]
2311 #[allow(clippy::needless_lifetimes)]
2312 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
2313 where
2314 T: Into<&'a ReplyParameters>,
2315 {
2316 self.reply_parameters = Some(reply_parameters.into());
2317 self
2318 }
2319 #[allow(clippy::needless_lifetimes)]
2320 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
2321 &self.reply_parameters
2322 }
2323 #[allow(rustdoc::invalid_html_tags)]
2324 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
2325 #[allow(clippy::needless_lifetimes)]
2326 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
2327 where
2328 T: Into<&'a EReplyMarkup>,
2329 {
2330 self.reply_markup = Some(reply_markup.into());
2331 self
2332 }
2333 #[allow(clippy::needless_lifetimes)]
2334 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
2335 &self.reply_markup
2336 }
2337 pub async fn build(self) -> BotResult<Message> {
2338 self.bot
2339 .send_contact(
2340 self.business_connection_id,
2341 self.chat_id,
2342 self.message_thread_id,
2343 self.direct_messages_topic_id,
2344 self.phone_number,
2345 self.first_name,
2346 self.last_name,
2347 self.vcard,
2348 self.disable_notification,
2349 self.protect_content,
2350 self.allow_paid_broadcast,
2351 self.message_effect_id,
2352 self.suggested_post_parameters,
2353 self.reply_parameters,
2354 self.reply_markup,
2355 )
2356 .await
2357 }
2358}
2359pub struct CallSendMessage<'a, V> {
2360 bot: &'a Bot,
2361 business_connection_id: Option<&'a str>,
2362 chat_id: V,
2363 message_thread_id: Option<i64>,
2364 direct_messages_topic_id: Option<i64>,
2365 text: &'a str,
2366 parse_mode: Option<&'a str>,
2367 entities: Option<&'a Vec<MessageEntity>>,
2368 link_preview_options: Option<&'a LinkPreviewOptions>,
2369 disable_notification: Option<bool>,
2370 protect_content: Option<bool>,
2371 allow_paid_broadcast: Option<bool>,
2372 message_effect_id: Option<&'a str>,
2373 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
2374 reply_parameters: Option<&'a ReplyParameters>,
2375 reply_markup: Option<&'a EReplyMarkup>,
2376}
2377impl<'a, V: Into<ChatHandle> + Serialize> CallSendMessage<'a, V> {
2378 #[allow(rustdoc::invalid_html_tags)]
2379 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
2380 #[allow(clippy::needless_lifetimes)]
2381 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
2382 self.business_connection_id = Some(business_connection_id);
2383 self
2384 }
2385 #[allow(clippy::needless_lifetimes)]
2386 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
2387 &self.business_connection_id
2388 }
2389 #[allow(rustdoc::invalid_html_tags)]
2390 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2391 #[allow(clippy::needless_lifetimes)]
2392 pub fn chat_id(mut self, chat_id: V) -> Self {
2393 self.chat_id = chat_id;
2394 self
2395 }
2396 #[allow(clippy::needless_lifetimes)]
2397 pub fn get_chat_id(&'a self) -> &'a V {
2398 &self.chat_id
2399 }
2400 #[allow(rustdoc::invalid_html_tags)]
2401 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
2402 #[allow(clippy::needless_lifetimes)]
2403 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
2404 self.message_thread_id = Some(message_thread_id);
2405 self
2406 }
2407 #[allow(clippy::needless_lifetimes)]
2408 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
2409 &self.message_thread_id
2410 }
2411 #[allow(rustdoc::invalid_html_tags)]
2412 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
2413 #[allow(clippy::needless_lifetimes)]
2414 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
2415 self.direct_messages_topic_id = Some(direct_messages_topic_id);
2416 self
2417 }
2418 #[allow(clippy::needless_lifetimes)]
2419 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
2420 &self.direct_messages_topic_id
2421 }
2422 #[allow(rustdoc::invalid_html_tags)]
2423 #[doc = "Text of the message to be sent, 1-4096 characters after entities parsing"]
2424 #[allow(clippy::needless_lifetimes)]
2425 pub fn text(mut self, text: &'a str) -> Self {
2426 self.text = text;
2427 self
2428 }
2429 #[allow(clippy::needless_lifetimes)]
2430 pub fn get_text(&'a self) -> &'a &'a str {
2431 &self.text
2432 }
2433 #[allow(rustdoc::invalid_html_tags)]
2434 #[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
2435 #[allow(clippy::needless_lifetimes)]
2436 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
2437 self.parse_mode = Some(parse_mode);
2438 self
2439 }
2440 #[allow(clippy::needless_lifetimes)]
2441 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
2442 &self.parse_mode
2443 }
2444 #[allow(rustdoc::invalid_html_tags)]
2445 #[doc = "A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode"]
2446 #[allow(clippy::needless_lifetimes)]
2447 pub fn entities(mut self, entities: &'a Vec<MessageEntity>) -> Self {
2448 self.entities = Some(entities);
2449 self
2450 }
2451 #[allow(clippy::needless_lifetimes)]
2452 pub fn get_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
2453 &self.entities
2454 }
2455 #[allow(rustdoc::invalid_html_tags)]
2456 #[doc = "Link preview generation options for the message"]
2457 #[allow(clippy::needless_lifetimes)]
2458 pub fn link_preview_options<T>(mut self, link_preview_options: T) -> Self
2459 where
2460 T: Into<&'a LinkPreviewOptions>,
2461 {
2462 self.link_preview_options = Some(link_preview_options.into());
2463 self
2464 }
2465 #[allow(clippy::needless_lifetimes)]
2466 pub fn get_link_preview_options(&'a self) -> &'a Option<&'a LinkPreviewOptions> {
2467 &self.link_preview_options
2468 }
2469 #[allow(rustdoc::invalid_html_tags)]
2470 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
2471 #[allow(clippy::needless_lifetimes)]
2472 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
2473 self.disable_notification = Some(disable_notification);
2474 self
2475 }
2476 #[allow(clippy::needless_lifetimes)]
2477 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
2478 &self.disable_notification
2479 }
2480 #[allow(rustdoc::invalid_html_tags)]
2481 #[doc = "Protects the contents of the sent message from forwarding and saving"]
2482 #[allow(clippy::needless_lifetimes)]
2483 pub fn protect_content(mut self, protect_content: bool) -> Self {
2484 self.protect_content = Some(protect_content);
2485 self
2486 }
2487 #[allow(clippy::needless_lifetimes)]
2488 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
2489 &self.protect_content
2490 }
2491 #[allow(rustdoc::invalid_html_tags)]
2492 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
2493 #[allow(clippy::needless_lifetimes)]
2494 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
2495 self.allow_paid_broadcast = Some(allow_paid_broadcast);
2496 self
2497 }
2498 #[allow(clippy::needless_lifetimes)]
2499 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
2500 &self.allow_paid_broadcast
2501 }
2502 #[allow(rustdoc::invalid_html_tags)]
2503 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
2504 #[allow(clippy::needless_lifetimes)]
2505 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
2506 self.message_effect_id = Some(message_effect_id);
2507 self
2508 }
2509 #[allow(clippy::needless_lifetimes)]
2510 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
2511 &self.message_effect_id
2512 }
2513 #[allow(rustdoc::invalid_html_tags)]
2514 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
2515 #[allow(clippy::needless_lifetimes)]
2516 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
2517 where
2518 T: Into<&'a SuggestedPostParameters>,
2519 {
2520 self.suggested_post_parameters = Some(suggested_post_parameters.into());
2521 self
2522 }
2523 #[allow(clippy::needless_lifetimes)]
2524 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
2525 &self.suggested_post_parameters
2526 }
2527 #[allow(rustdoc::invalid_html_tags)]
2528 #[doc = "Description of the message to reply to"]
2529 #[allow(clippy::needless_lifetimes)]
2530 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
2531 where
2532 T: Into<&'a ReplyParameters>,
2533 {
2534 self.reply_parameters = Some(reply_parameters.into());
2535 self
2536 }
2537 #[allow(clippy::needless_lifetimes)]
2538 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
2539 &self.reply_parameters
2540 }
2541 #[allow(rustdoc::invalid_html_tags)]
2542 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
2543 #[allow(clippy::needless_lifetimes)]
2544 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
2545 where
2546 T: Into<&'a EReplyMarkup>,
2547 {
2548 self.reply_markup = Some(reply_markup.into());
2549 self
2550 }
2551 #[allow(clippy::needless_lifetimes)]
2552 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
2553 &self.reply_markup
2554 }
2555 pub async fn build(self) -> BotResult<Message> {
2556 self.bot
2557 .send_message(
2558 self.business_connection_id,
2559 self.chat_id,
2560 self.message_thread_id,
2561 self.direct_messages_topic_id,
2562 self.text,
2563 self.parse_mode,
2564 self.entities,
2565 self.link_preview_options,
2566 self.disable_notification,
2567 self.protect_content,
2568 self.allow_paid_broadcast,
2569 self.message_effect_id,
2570 self.suggested_post_parameters,
2571 self.reply_parameters,
2572 self.reply_markup,
2573 )
2574 .await
2575 }
2576}
2577pub struct CallBanChatMember<'a, V> {
2578 bot: &'a Bot,
2579 chat_id: V,
2580 user_id: i64,
2581 until_date: Option<i64>,
2582 revoke_messages: Option<bool>,
2583}
2584impl<'a, V: Into<ChatHandle> + Serialize> CallBanChatMember<'a, V> {
2585 #[allow(rustdoc::invalid_html_tags)]
2586 #[doc = "Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)"]
2587 #[allow(clippy::needless_lifetimes)]
2588 pub fn chat_id(mut self, chat_id: V) -> Self {
2589 self.chat_id = chat_id;
2590 self
2591 }
2592 #[allow(clippy::needless_lifetimes)]
2593 pub fn get_chat_id(&'a self) -> &'a V {
2594 &self.chat_id
2595 }
2596 #[allow(rustdoc::invalid_html_tags)]
2597 #[doc = "Unique identifier of the target user"]
2598 #[allow(clippy::needless_lifetimes)]
2599 pub fn user_id(mut self, user_id: i64) -> Self {
2600 self.user_id = user_id;
2601 self
2602 }
2603 #[allow(clippy::needless_lifetimes)]
2604 pub fn get_user_id(&'a self) -> &'a i64 {
2605 &self.user_id
2606 }
2607 #[allow(rustdoc::invalid_html_tags)]
2608 #[doc = "Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."]
2609 #[allow(clippy::needless_lifetimes)]
2610 pub fn until_date(mut self, until_date: i64) -> Self {
2611 self.until_date = Some(until_date);
2612 self
2613 }
2614 #[allow(clippy::needless_lifetimes)]
2615 pub fn get_until_date(&'a self) -> &'a Option<i64> {
2616 &self.until_date
2617 }
2618 #[allow(rustdoc::invalid_html_tags)]
2619 #[doc = "Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels."]
2620 #[allow(clippy::needless_lifetimes)]
2621 pub fn revoke_messages(mut self, revoke_messages: bool) -> Self {
2622 self.revoke_messages = Some(revoke_messages);
2623 self
2624 }
2625 #[allow(clippy::needless_lifetimes)]
2626 pub fn get_revoke_messages(&'a self) -> &'a Option<bool> {
2627 &self.revoke_messages
2628 }
2629 pub async fn build(self) -> BotResult<bool> {
2630 self.bot
2631 .ban_chat_member(
2632 self.chat_id,
2633 self.user_id,
2634 self.until_date,
2635 self.revoke_messages,
2636 )
2637 .await
2638 }
2639}
2640pub struct CallEditChatInviteLink<'a, V> {
2641 bot: &'a Bot,
2642 chat_id: V,
2643 invite_link: &'a str,
2644 name: Option<&'a str>,
2645 expire_date: Option<i64>,
2646 member_limit: Option<i64>,
2647 creates_join_request: Option<bool>,
2648}
2649impl<'a, V: Into<ChatHandle> + Serialize> CallEditChatInviteLink<'a, V> {
2650 #[allow(rustdoc::invalid_html_tags)]
2651 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2652 #[allow(clippy::needless_lifetimes)]
2653 pub fn chat_id(mut self, chat_id: V) -> Self {
2654 self.chat_id = chat_id;
2655 self
2656 }
2657 #[allow(clippy::needless_lifetimes)]
2658 pub fn get_chat_id(&'a self) -> &'a V {
2659 &self.chat_id
2660 }
2661 #[allow(rustdoc::invalid_html_tags)]
2662 #[doc = "The invite link to edit"]
2663 #[allow(clippy::needless_lifetimes)]
2664 pub fn invite_link(mut self, invite_link: &'a str) -> Self {
2665 self.invite_link = invite_link;
2666 self
2667 }
2668 #[allow(clippy::needless_lifetimes)]
2669 pub fn get_invite_link(&'a self) -> &'a &'a str {
2670 &self.invite_link
2671 }
2672 #[allow(rustdoc::invalid_html_tags)]
2673 #[doc = "Invite link name; 0-32 characters"]
2674 #[allow(clippy::needless_lifetimes)]
2675 pub fn name(mut self, name: &'a str) -> Self {
2676 self.name = Some(name);
2677 self
2678 }
2679 #[allow(clippy::needless_lifetimes)]
2680 pub fn get_name(&'a self) -> &'a Option<&'a str> {
2681 &self.name
2682 }
2683 #[allow(rustdoc::invalid_html_tags)]
2684 #[doc = "Point in time (Unix timestamp) when the link will expire"]
2685 #[allow(clippy::needless_lifetimes)]
2686 pub fn expire_date(mut self, expire_date: i64) -> Self {
2687 self.expire_date = Some(expire_date);
2688 self
2689 }
2690 #[allow(clippy::needless_lifetimes)]
2691 pub fn get_expire_date(&'a self) -> &'a Option<i64> {
2692 &self.expire_date
2693 }
2694 #[allow(rustdoc::invalid_html_tags)]
2695 #[doc = "The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"]
2696 #[allow(clippy::needless_lifetimes)]
2697 pub fn member_limit(mut self, member_limit: i64) -> Self {
2698 self.member_limit = Some(member_limit);
2699 self
2700 }
2701 #[allow(clippy::needless_lifetimes)]
2702 pub fn get_member_limit(&'a self) -> &'a Option<i64> {
2703 &self.member_limit
2704 }
2705 #[allow(rustdoc::invalid_html_tags)]
2706 #[doc = "True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified"]
2707 #[allow(clippy::needless_lifetimes)]
2708 pub fn creates_join_request(mut self, creates_join_request: bool) -> Self {
2709 self.creates_join_request = Some(creates_join_request);
2710 self
2711 }
2712 #[allow(clippy::needless_lifetimes)]
2713 pub fn get_creates_join_request(&'a self) -> &'a Option<bool> {
2714 &self.creates_join_request
2715 }
2716 pub async fn build(self) -> BotResult<ChatInviteLink> {
2717 self.bot
2718 .edit_chat_invite_link(
2719 self.chat_id,
2720 self.invite_link,
2721 self.name,
2722 self.expire_date,
2723 self.member_limit,
2724 self.creates_join_request,
2725 )
2726 .await
2727 }
2728}
2729pub struct CallUnpinChatMessage<'a, V> {
2730 bot: &'a Bot,
2731 business_connection_id: Option<&'a str>,
2732 chat_id: V,
2733 message_id: Option<i64>,
2734}
2735impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinChatMessage<'a, V> {
2736 #[allow(rustdoc::invalid_html_tags)]
2737 #[doc = "Unique identifier of the business connection on behalf of which the message will be unpinned"]
2738 #[allow(clippy::needless_lifetimes)]
2739 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
2740 self.business_connection_id = Some(business_connection_id);
2741 self
2742 }
2743 #[allow(clippy::needless_lifetimes)]
2744 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
2745 &self.business_connection_id
2746 }
2747 #[allow(rustdoc::invalid_html_tags)]
2748 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2749 #[allow(clippy::needless_lifetimes)]
2750 pub fn chat_id(mut self, chat_id: V) -> Self {
2751 self.chat_id = chat_id;
2752 self
2753 }
2754 #[allow(clippy::needless_lifetimes)]
2755 pub fn get_chat_id(&'a self) -> &'a V {
2756 &self.chat_id
2757 }
2758 #[allow(rustdoc::invalid_html_tags)]
2759 #[doc = "Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned."]
2760 #[allow(clippy::needless_lifetimes)]
2761 pub fn message_id(mut self, message_id: i64) -> Self {
2762 self.message_id = Some(message_id);
2763 self
2764 }
2765 #[allow(clippy::needless_lifetimes)]
2766 pub fn get_message_id(&'a self) -> &'a Option<i64> {
2767 &self.message_id
2768 }
2769 pub async fn build(self) -> BotResult<bool> {
2770 self.bot
2771 .unpin_chat_message(self.business_connection_id, self.chat_id, self.message_id)
2772 .await
2773 }
2774}
2775pub struct CallAnswerInlineQuery<'a> {
2776 bot: &'a Bot,
2777 inline_query_id: &'a str,
2778 results: &'a Vec<InlineQueryResult>,
2779 cache_time: Option<i64>,
2780 is_personal: Option<bool>,
2781 next_offset: Option<&'a str>,
2782 button: Option<&'a InlineQueryResultsButton>,
2783}
2784impl<'a> CallAnswerInlineQuery<'a> {
2785 #[allow(rustdoc::invalid_html_tags)]
2786 #[doc = "Unique identifier for the answered query"]
2787 #[allow(clippy::needless_lifetimes)]
2788 pub fn inline_query_id(mut self, inline_query_id: &'a str) -> Self {
2789 self.inline_query_id = inline_query_id;
2790 self
2791 }
2792 #[allow(clippy::needless_lifetimes)]
2793 pub fn get_inline_query_id(&'a self) -> &'a &'a str {
2794 &self.inline_query_id
2795 }
2796 #[allow(rustdoc::invalid_html_tags)]
2797 #[doc = "A JSON-serialized array of results for the inline query"]
2798 #[allow(clippy::needless_lifetimes)]
2799 pub fn results(mut self, results: &'a Vec<InlineQueryResult>) -> Self {
2800 self.results = results;
2801 self
2802 }
2803 #[allow(clippy::needless_lifetimes)]
2804 pub fn get_results(&'a self) -> &'a &'a Vec<InlineQueryResult> {
2805 &self.results
2806 }
2807 #[allow(rustdoc::invalid_html_tags)]
2808 #[doc = "The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."]
2809 #[allow(clippy::needless_lifetimes)]
2810 pub fn cache_time(mut self, cache_time: i64) -> Self {
2811 self.cache_time = Some(cache_time);
2812 self
2813 }
2814 #[allow(clippy::needless_lifetimes)]
2815 pub fn get_cache_time(&'a self) -> &'a Option<i64> {
2816 &self.cache_time
2817 }
2818 #[allow(rustdoc::invalid_html_tags)]
2819 #[doc = "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query."]
2820 #[allow(clippy::needless_lifetimes)]
2821 pub fn is_personal(mut self, is_personal: bool) -> Self {
2822 self.is_personal = Some(is_personal);
2823 self
2824 }
2825 #[allow(clippy::needless_lifetimes)]
2826 pub fn get_is_personal(&'a self) -> &'a Option<bool> {
2827 &self.is_personal
2828 }
2829 #[allow(rustdoc::invalid_html_tags)]
2830 #[doc = "Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."]
2831 #[allow(clippy::needless_lifetimes)]
2832 pub fn next_offset(mut self, next_offset: &'a str) -> Self {
2833 self.next_offset = Some(next_offset);
2834 self
2835 }
2836 #[allow(clippy::needless_lifetimes)]
2837 pub fn get_next_offset(&'a self) -> &'a Option<&'a str> {
2838 &self.next_offset
2839 }
2840 #[allow(rustdoc::invalid_html_tags)]
2841 #[doc = "A JSON-serialized object describing a button to be shown above inline query results"]
2842 #[allow(clippy::needless_lifetimes)]
2843 pub fn button<T>(mut self, button: T) -> Self
2844 where
2845 T: Into<&'a InlineQueryResultsButton>,
2846 {
2847 self.button = Some(button.into());
2848 self
2849 }
2850 #[allow(clippy::needless_lifetimes)]
2851 pub fn get_button(&'a self) -> &'a Option<&'a InlineQueryResultsButton> {
2852 &self.button
2853 }
2854 pub async fn build(self) -> BotResult<bool> {
2855 self.bot
2856 .answer_inline_query(
2857 self.inline_query_id,
2858 self.results,
2859 self.cache_time,
2860 self.is_personal,
2861 self.next_offset,
2862 self.button,
2863 )
2864 .await
2865 }
2866}
2867pub struct CallGetFile<'a> {
2868 bot: &'a Bot,
2869 file_id: &'a str,
2870}
2871impl<'a> CallGetFile<'a> {
2872 #[allow(rustdoc::invalid_html_tags)]
2873 #[doc = "File identifier to get information about"]
2874 #[allow(clippy::needless_lifetimes)]
2875 pub fn file_id(mut self, file_id: &'a str) -> Self {
2876 self.file_id = file_id;
2877 self
2878 }
2879 #[allow(clippy::needless_lifetimes)]
2880 pub fn get_file_id(&'a self) -> &'a &'a str {
2881 &self.file_id
2882 }
2883 pub async fn build(self) -> BotResult<File> {
2884 self.bot.get_file(self.file_id).await
2885 }
2886}
2887pub struct CallGetStarTransactions<'a> {
2888 bot: &'a Bot,
2889 offset: Option<i64>,
2890 limit: Option<i64>,
2891}
2892impl<'a> CallGetStarTransactions<'a> {
2893 #[allow(rustdoc::invalid_html_tags)]
2894 #[doc = "Number of transactions to skip in the response"]
2895 #[allow(clippy::needless_lifetimes)]
2896 pub fn offset(mut self, offset: i64) -> Self {
2897 self.offset = Some(offset);
2898 self
2899 }
2900 #[allow(clippy::needless_lifetimes)]
2901 pub fn get_offset(&'a self) -> &'a Option<i64> {
2902 &self.offset
2903 }
2904 #[allow(rustdoc::invalid_html_tags)]
2905 #[doc = "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
2906 #[allow(clippy::needless_lifetimes)]
2907 pub fn limit(mut self, limit: i64) -> Self {
2908 self.limit = Some(limit);
2909 self
2910 }
2911 #[allow(clippy::needless_lifetimes)]
2912 pub fn get_limit(&'a self) -> &'a Option<i64> {
2913 &self.limit
2914 }
2915 pub async fn build(self) -> BotResult<StarTransactions> {
2916 self.bot
2917 .get_star_transactions(self.offset, self.limit)
2918 .await
2919 }
2920}
2921pub struct CallForwardMessages<'a, V> {
2922 bot: &'a Bot,
2923 chat_id: V,
2924 message_thread_id: Option<i64>,
2925 direct_messages_topic_id: Option<i64>,
2926 from_chat_id: V,
2927 message_ids: &'a Vec<i64>,
2928 disable_notification: Option<bool>,
2929 protect_content: Option<bool>,
2930}
2931impl<'a, V: Into<ChatHandle> + Serialize> CallForwardMessages<'a, V> {
2932 #[allow(rustdoc::invalid_html_tags)]
2933 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
2934 #[allow(clippy::needless_lifetimes)]
2935 pub fn chat_id(mut self, chat_id: V) -> Self {
2936 self.chat_id = chat_id;
2937 self
2938 }
2939 #[allow(clippy::needless_lifetimes)]
2940 pub fn get_chat_id(&'a self) -> &'a V {
2941 &self.chat_id
2942 }
2943 #[allow(rustdoc::invalid_html_tags)]
2944 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
2945 #[allow(clippy::needless_lifetimes)]
2946 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
2947 self.message_thread_id = Some(message_thread_id);
2948 self
2949 }
2950 #[allow(clippy::needless_lifetimes)]
2951 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
2952 &self.message_thread_id
2953 }
2954 #[allow(rustdoc::invalid_html_tags)]
2955 #[doc = "Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat"]
2956 #[allow(clippy::needless_lifetimes)]
2957 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
2958 self.direct_messages_topic_id = Some(direct_messages_topic_id);
2959 self
2960 }
2961 #[allow(clippy::needless_lifetimes)]
2962 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
2963 &self.direct_messages_topic_id
2964 }
2965 #[allow(rustdoc::invalid_html_tags)]
2966 #[doc = "Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)"]
2967 #[allow(clippy::needless_lifetimes)]
2968 pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
2969 self.from_chat_id = from_chat_id;
2970 self
2971 }
2972 #[allow(clippy::needless_lifetimes)]
2973 pub fn get_from_chat_id(&'a self) -> &'a V {
2974 &self.from_chat_id
2975 }
2976 #[allow(rustdoc::invalid_html_tags)]
2977 #[doc = "A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order."]
2978 #[allow(clippy::needless_lifetimes)]
2979 pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
2980 self.message_ids = message_ids;
2981 self
2982 }
2983 #[allow(clippy::needless_lifetimes)]
2984 pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
2985 &self.message_ids
2986 }
2987 #[allow(rustdoc::invalid_html_tags)]
2988 #[doc = "Sends the messages silently. Users will receive a notification with no sound."]
2989 #[allow(clippy::needless_lifetimes)]
2990 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
2991 self.disable_notification = Some(disable_notification);
2992 self
2993 }
2994 #[allow(clippy::needless_lifetimes)]
2995 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
2996 &self.disable_notification
2997 }
2998 #[allow(rustdoc::invalid_html_tags)]
2999 #[doc = "Protects the contents of the forwarded messages from forwarding and saving"]
3000 #[allow(clippy::needless_lifetimes)]
3001 pub fn protect_content(mut self, protect_content: bool) -> Self {
3002 self.protect_content = Some(protect_content);
3003 self
3004 }
3005 #[allow(clippy::needless_lifetimes)]
3006 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
3007 &self.protect_content
3008 }
3009 pub async fn build(self) -> BotResult<Vec<MessageId>> {
3010 self.bot
3011 .forward_messages(
3012 self.chat_id,
3013 self.message_thread_id,
3014 self.direct_messages_topic_id,
3015 self.from_chat_id,
3016 self.message_ids,
3017 self.disable_notification,
3018 self.protect_content,
3019 )
3020 .await
3021 }
3022}
3023pub struct CallGetStickerSet<'a> {
3024 bot: &'a Bot,
3025 name: &'a str,
3026}
3027impl<'a> CallGetStickerSet<'a> {
3028 #[allow(rustdoc::invalid_html_tags)]
3029 #[doc = "Name of the sticker set"]
3030 #[allow(clippy::needless_lifetimes)]
3031 pub fn name(mut self, name: &'a str) -> Self {
3032 self.name = name;
3033 self
3034 }
3035 #[allow(clippy::needless_lifetimes)]
3036 pub fn get_name(&'a self) -> &'a &'a str {
3037 &self.name
3038 }
3039 pub async fn build(self) -> BotResult<StickerSet> {
3040 self.bot.get_sticker_set(self.name).await
3041 }
3042}
3043pub struct CallGetForumTopicIconStickers<'a> {
3044 bot: &'a Bot,
3045}
3046impl<'a> CallGetForumTopicIconStickers<'a> {
3047 pub async fn build(self) -> BotResult<Vec<Sticker>> {
3048 self.bot.get_forum_topic_icon_stickers().await
3049 }
3050}
3051pub struct CallTransferGift<'a> {
3052 bot: &'a Bot,
3053 business_connection_id: &'a str,
3054 owned_gift_id: &'a str,
3055 new_owner_chat_id: i64,
3056 star_count: Option<i64>,
3057}
3058impl<'a> CallTransferGift<'a> {
3059 #[allow(rustdoc::invalid_html_tags)]
3060 #[doc = "Unique identifier of the business connection"]
3061 #[allow(clippy::needless_lifetimes)]
3062 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
3063 self.business_connection_id = business_connection_id;
3064 self
3065 }
3066 #[allow(clippy::needless_lifetimes)]
3067 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
3068 &self.business_connection_id
3069 }
3070 #[allow(rustdoc::invalid_html_tags)]
3071 #[doc = "Unique identifier of the regular gift that should be transferred"]
3072 #[allow(clippy::needless_lifetimes)]
3073 pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
3074 self.owned_gift_id = owned_gift_id;
3075 self
3076 }
3077 #[allow(clippy::needless_lifetimes)]
3078 pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
3079 &self.owned_gift_id
3080 }
3081 #[allow(rustdoc::invalid_html_tags)]
3082 #[doc = "Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours."]
3083 #[allow(clippy::needless_lifetimes)]
3084 pub fn new_owner_chat_id(mut self, new_owner_chat_id: i64) -> Self {
3085 self.new_owner_chat_id = new_owner_chat_id;
3086 self
3087 }
3088 #[allow(clippy::needless_lifetimes)]
3089 pub fn get_new_owner_chat_id(&'a self) -> &'a i64 {
3090 &self.new_owner_chat_id
3091 }
3092 #[allow(rustdoc::invalid_html_tags)]
3093 #[doc = "The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required."]
3094 #[allow(clippy::needless_lifetimes)]
3095 pub fn star_count(mut self, star_count: i64) -> Self {
3096 self.star_count = Some(star_count);
3097 self
3098 }
3099 #[allow(clippy::needless_lifetimes)]
3100 pub fn get_star_count(&'a self) -> &'a Option<i64> {
3101 &self.star_count
3102 }
3103 pub async fn build(self) -> BotResult<bool> {
3104 self.bot
3105 .transfer_gift(
3106 self.business_connection_id,
3107 self.owned_gift_id,
3108 self.new_owner_chat_id,
3109 self.star_count,
3110 )
3111 .await
3112 }
3113}
3114pub struct CallDeleteMessages<'a, V> {
3115 bot: &'a Bot,
3116 chat_id: V,
3117 message_ids: &'a Vec<i64>,
3118}
3119impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteMessages<'a, V> {
3120 #[allow(rustdoc::invalid_html_tags)]
3121 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
3122 #[allow(clippy::needless_lifetimes)]
3123 pub fn chat_id(mut self, chat_id: V) -> Self {
3124 self.chat_id = chat_id;
3125 self
3126 }
3127 #[allow(clippy::needless_lifetimes)]
3128 pub fn get_chat_id(&'a self) -> &'a V {
3129 &self.chat_id
3130 }
3131 #[allow(rustdoc::invalid_html_tags)]
3132 #[doc = "A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted"]
3133 #[allow(clippy::needless_lifetimes)]
3134 pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
3135 self.message_ids = message_ids;
3136 self
3137 }
3138 #[allow(clippy::needless_lifetimes)]
3139 pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
3140 &self.message_ids
3141 }
3142 pub async fn build(self) -> BotResult<bool> {
3143 self.bot
3144 .delete_messages(self.chat_id, self.message_ids)
3145 .await
3146 }
3147}
3148pub struct CallReopenGeneralForumTopic<'a, V> {
3149 bot: &'a Bot,
3150 chat_id: V,
3151}
3152impl<'a, V: Into<ChatHandle> + Serialize> CallReopenGeneralForumTopic<'a, V> {
3153 #[allow(rustdoc::invalid_html_tags)]
3154 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
3155 #[allow(clippy::needless_lifetimes)]
3156 pub fn chat_id(mut self, chat_id: V) -> Self {
3157 self.chat_id = chat_id;
3158 self
3159 }
3160 #[allow(clippy::needless_lifetimes)]
3161 pub fn get_chat_id(&'a self) -> &'a V {
3162 &self.chat_id
3163 }
3164 pub async fn build(self) -> BotResult<bool> {
3165 self.bot.reopen_general_forum_topic(self.chat_id).await
3166 }
3167}
3168pub struct CallSendChecklist<'a> {
3169 bot: &'a Bot,
3170 business_connection_id: &'a str,
3171 chat_id: i64,
3172 checklist: &'a InputChecklist,
3173 disable_notification: Option<bool>,
3174 protect_content: Option<bool>,
3175 message_effect_id: Option<&'a str>,
3176 reply_parameters: Option<&'a ReplyParameters>,
3177 reply_markup: Option<&'a InlineKeyboardMarkup>,
3178}
3179impl<'a> CallSendChecklist<'a> {
3180 #[allow(rustdoc::invalid_html_tags)]
3181 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
3182 #[allow(clippy::needless_lifetimes)]
3183 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
3184 self.business_connection_id = business_connection_id;
3185 self
3186 }
3187 #[allow(clippy::needless_lifetimes)]
3188 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
3189 &self.business_connection_id
3190 }
3191 #[allow(rustdoc::invalid_html_tags)]
3192 #[doc = "Unique identifier for the target chat"]
3193 #[allow(clippy::needless_lifetimes)]
3194 pub fn chat_id(mut self, chat_id: i64) -> Self {
3195 self.chat_id = chat_id;
3196 self
3197 }
3198 #[allow(clippy::needless_lifetimes)]
3199 pub fn get_chat_id(&'a self) -> &'a i64 {
3200 &self.chat_id
3201 }
3202 #[allow(rustdoc::invalid_html_tags)]
3203 #[doc = "A JSON-serialized object for the checklist to send"]
3204 #[allow(clippy::needless_lifetimes)]
3205 pub fn checklist<T>(mut self, checklist: T) -> Self
3206 where
3207 T: Into<&'a InputChecklist>,
3208 {
3209 self.checklist = checklist.into();
3210 self
3211 }
3212 #[allow(clippy::needless_lifetimes)]
3213 pub fn get_checklist(&'a self) -> &'a &'a InputChecklist {
3214 &self.checklist
3215 }
3216 #[allow(rustdoc::invalid_html_tags)]
3217 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
3218 #[allow(clippy::needless_lifetimes)]
3219 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
3220 self.disable_notification = Some(disable_notification);
3221 self
3222 }
3223 #[allow(clippy::needless_lifetimes)]
3224 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
3225 &self.disable_notification
3226 }
3227 #[allow(rustdoc::invalid_html_tags)]
3228 #[doc = "Protects the contents of the sent message from forwarding and saving"]
3229 #[allow(clippy::needless_lifetimes)]
3230 pub fn protect_content(mut self, protect_content: bool) -> Self {
3231 self.protect_content = Some(protect_content);
3232 self
3233 }
3234 #[allow(clippy::needless_lifetimes)]
3235 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
3236 &self.protect_content
3237 }
3238 #[allow(rustdoc::invalid_html_tags)]
3239 #[doc = "Unique identifier of the message effect to be added to the message"]
3240 #[allow(clippy::needless_lifetimes)]
3241 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
3242 self.message_effect_id = Some(message_effect_id);
3243 self
3244 }
3245 #[allow(clippy::needless_lifetimes)]
3246 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
3247 &self.message_effect_id
3248 }
3249 #[allow(rustdoc::invalid_html_tags)]
3250 #[doc = "A JSON-serialized object for description of the message to reply to"]
3251 #[allow(clippy::needless_lifetimes)]
3252 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
3253 where
3254 T: Into<&'a ReplyParameters>,
3255 {
3256 self.reply_parameters = Some(reply_parameters.into());
3257 self
3258 }
3259 #[allow(clippy::needless_lifetimes)]
3260 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
3261 &self.reply_parameters
3262 }
3263 #[allow(rustdoc::invalid_html_tags)]
3264 #[doc = "A JSON-serialized object for an inline keyboard"]
3265 #[allow(clippy::needless_lifetimes)]
3266 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
3267 where
3268 T: Into<&'a InlineKeyboardMarkup>,
3269 {
3270 self.reply_markup = Some(reply_markup.into());
3271 self
3272 }
3273 #[allow(clippy::needless_lifetimes)]
3274 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
3275 &self.reply_markup
3276 }
3277 pub async fn build(self) -> BotResult<Message> {
3278 self.bot
3279 .send_checklist(
3280 self.business_connection_id,
3281 self.chat_id,
3282 self.checklist,
3283 self.disable_notification,
3284 self.protect_content,
3285 self.message_effect_id,
3286 self.reply_parameters,
3287 self.reply_markup,
3288 )
3289 .await
3290 }
3291}
3292pub struct CallDeleteChatPhoto<'a, V> {
3293 bot: &'a Bot,
3294 chat_id: V,
3295}
3296impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteChatPhoto<'a, V> {
3297 #[allow(rustdoc::invalid_html_tags)]
3298 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
3299 #[allow(clippy::needless_lifetimes)]
3300 pub fn chat_id(mut self, chat_id: V) -> Self {
3301 self.chat_id = chat_id;
3302 self
3303 }
3304 #[allow(clippy::needless_lifetimes)]
3305 pub fn get_chat_id(&'a self) -> &'a V {
3306 &self.chat_id
3307 }
3308 pub async fn build(self) -> BotResult<bool> {
3309 self.bot.delete_chat_photo(self.chat_id).await
3310 }
3311}
3312pub struct CallVerifyUser<'a> {
3313 bot: &'a Bot,
3314 user_id: i64,
3315 custom_description: Option<&'a str>,
3316}
3317impl<'a> CallVerifyUser<'a> {
3318 #[allow(rustdoc::invalid_html_tags)]
3319 #[doc = "Unique identifier of the target user"]
3320 #[allow(clippy::needless_lifetimes)]
3321 pub fn user_id(mut self, user_id: i64) -> Self {
3322 self.user_id = user_id;
3323 self
3324 }
3325 #[allow(clippy::needless_lifetimes)]
3326 pub fn get_user_id(&'a self) -> &'a i64 {
3327 &self.user_id
3328 }
3329 #[allow(rustdoc::invalid_html_tags)]
3330 #[doc = "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."]
3331 #[allow(clippy::needless_lifetimes)]
3332 pub fn custom_description(mut self, custom_description: &'a str) -> Self {
3333 self.custom_description = Some(custom_description);
3334 self
3335 }
3336 #[allow(clippy::needless_lifetimes)]
3337 pub fn get_custom_description(&'a self) -> &'a Option<&'a str> {
3338 &self.custom_description
3339 }
3340 pub async fn build(self) -> BotResult<bool> {
3341 self.bot
3342 .verify_user(self.user_id, self.custom_description)
3343 .await
3344 }
3345}
3346pub struct CallApproveChatJoinRequest<'a, V> {
3347 bot: &'a Bot,
3348 chat_id: V,
3349 user_id: i64,
3350}
3351impl<'a, V: Into<ChatHandle> + Serialize> CallApproveChatJoinRequest<'a, V> {
3352 #[allow(rustdoc::invalid_html_tags)]
3353 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
3354 #[allow(clippy::needless_lifetimes)]
3355 pub fn chat_id(mut self, chat_id: V) -> Self {
3356 self.chat_id = chat_id;
3357 self
3358 }
3359 #[allow(clippy::needless_lifetimes)]
3360 pub fn get_chat_id(&'a self) -> &'a V {
3361 &self.chat_id
3362 }
3363 #[allow(rustdoc::invalid_html_tags)]
3364 #[doc = "Unique identifier of the target user"]
3365 #[allow(clippy::needless_lifetimes)]
3366 pub fn user_id(mut self, user_id: i64) -> Self {
3367 self.user_id = user_id;
3368 self
3369 }
3370 #[allow(clippy::needless_lifetimes)]
3371 pub fn get_user_id(&'a self) -> &'a i64 {
3372 &self.user_id
3373 }
3374 pub async fn build(self) -> BotResult<bool> {
3375 self.bot
3376 .approve_chat_join_request(self.chat_id, self.user_id)
3377 .await
3378 }
3379}
3380pub struct CallSendInvoice<'a, V> {
3381 bot: &'a Bot,
3382 chat_id: V,
3383 message_thread_id: Option<i64>,
3384 direct_messages_topic_id: Option<i64>,
3385 title: &'a str,
3386 description: &'a str,
3387 payload: &'a str,
3388 provider_token: Option<&'a str>,
3389 currency: &'a str,
3390 prices: &'a Vec<LabeledPrice>,
3391 max_tip_amount: Option<i64>,
3392 suggested_tip_amounts: Option<&'a Vec<i64>>,
3393 start_parameter: Option<&'a str>,
3394 provider_data: Option<&'a str>,
3395 photo_url: Option<&'a str>,
3396 photo_size: Option<i64>,
3397 photo_width: Option<i64>,
3398 photo_height: Option<i64>,
3399 need_name: Option<bool>,
3400 need_phone_number: Option<bool>,
3401 need_email: Option<bool>,
3402 need_shipping_address: Option<bool>,
3403 send_phone_number_to_provider: Option<bool>,
3404 send_email_to_provider: Option<bool>,
3405 is_flexible: Option<bool>,
3406 disable_notification: Option<bool>,
3407 protect_content: Option<bool>,
3408 allow_paid_broadcast: Option<bool>,
3409 message_effect_id: Option<&'a str>,
3410 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
3411 reply_parameters: Option<&'a ReplyParameters>,
3412 reply_markup: Option<&'a InlineKeyboardMarkup>,
3413}
3414impl<'a, V: Into<ChatHandle> + Serialize> CallSendInvoice<'a, V> {
3415 #[allow(rustdoc::invalid_html_tags)]
3416 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
3417 #[allow(clippy::needless_lifetimes)]
3418 pub fn chat_id(mut self, chat_id: V) -> Self {
3419 self.chat_id = chat_id;
3420 self
3421 }
3422 #[allow(clippy::needless_lifetimes)]
3423 pub fn get_chat_id(&'a self) -> &'a V {
3424 &self.chat_id
3425 }
3426 #[allow(rustdoc::invalid_html_tags)]
3427 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
3428 #[allow(clippy::needless_lifetimes)]
3429 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
3430 self.message_thread_id = Some(message_thread_id);
3431 self
3432 }
3433 #[allow(clippy::needless_lifetimes)]
3434 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
3435 &self.message_thread_id
3436 }
3437 #[allow(rustdoc::invalid_html_tags)]
3438 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
3439 #[allow(clippy::needless_lifetimes)]
3440 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
3441 self.direct_messages_topic_id = Some(direct_messages_topic_id);
3442 self
3443 }
3444 #[allow(clippy::needless_lifetimes)]
3445 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
3446 &self.direct_messages_topic_id
3447 }
3448 #[allow(rustdoc::invalid_html_tags)]
3449 #[doc = "Product name, 1-32 characters"]
3450 #[allow(clippy::needless_lifetimes)]
3451 pub fn title(mut self, title: &'a str) -> Self {
3452 self.title = title;
3453 self
3454 }
3455 #[allow(clippy::needless_lifetimes)]
3456 pub fn get_title(&'a self) -> &'a &'a str {
3457 &self.title
3458 }
3459 #[allow(rustdoc::invalid_html_tags)]
3460 #[doc = "Product description, 1-255 characters"]
3461 #[allow(clippy::needless_lifetimes)]
3462 pub fn description(mut self, description: &'a str) -> Self {
3463 self.description = description;
3464 self
3465 }
3466 #[allow(clippy::needless_lifetimes)]
3467 pub fn get_description(&'a self) -> &'a &'a str {
3468 &self.description
3469 }
3470 #[allow(rustdoc::invalid_html_tags)]
3471 #[doc = "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."]
3472 #[allow(clippy::needless_lifetimes)]
3473 pub fn payload(mut self, payload: &'a str) -> Self {
3474 self.payload = payload;
3475 self
3476 }
3477 #[allow(clippy::needless_lifetimes)]
3478 pub fn get_payload(&'a self) -> &'a &'a str {
3479 &self.payload
3480 }
3481 #[allow(rustdoc::invalid_html_tags)]
3482 #[doc = "Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."]
3483 #[allow(clippy::needless_lifetimes)]
3484 pub fn provider_token(mut self, provider_token: &'a str) -> Self {
3485 self.provider_token = Some(provider_token);
3486 self
3487 }
3488 #[allow(clippy::needless_lifetimes)]
3489 pub fn get_provider_token(&'a self) -> &'a Option<&'a str> {
3490 &self.provider_token
3491 }
3492 #[allow(rustdoc::invalid_html_tags)]
3493 #[doc = "Three-letter ISO 4217 currency code, see more on currencies. Pass \"XTR\" for payments in Telegram Stars."]
3494 #[allow(clippy::needless_lifetimes)]
3495 pub fn currency(mut self, currency: &'a str) -> Self {
3496 self.currency = currency;
3497 self
3498 }
3499 #[allow(clippy::needless_lifetimes)]
3500 pub fn get_currency(&'a self) -> &'a &'a str {
3501 &self.currency
3502 }
3503 #[allow(rustdoc::invalid_html_tags)]
3504 #[doc = "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."]
3505 #[allow(clippy::needless_lifetimes)]
3506 pub fn prices(mut self, prices: &'a Vec<LabeledPrice>) -> Self {
3507 self.prices = prices;
3508 self
3509 }
3510 #[allow(clippy::needless_lifetimes)]
3511 pub fn get_prices(&'a self) -> &'a &'a Vec<LabeledPrice> {
3512 &self.prices
3513 }
3514 #[allow(rustdoc::invalid_html_tags)]
3515 #[doc = "The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."]
3516 #[allow(clippy::needless_lifetimes)]
3517 pub fn max_tip_amount(mut self, max_tip_amount: i64) -> Self {
3518 self.max_tip_amount = Some(max_tip_amount);
3519 self
3520 }
3521 #[allow(clippy::needless_lifetimes)]
3522 pub fn get_max_tip_amount(&'a self) -> &'a Option<i64> {
3523 &self.max_tip_amount
3524 }
3525 #[allow(rustdoc::invalid_html_tags)]
3526 #[doc = "A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount."]
3527 #[allow(clippy::needless_lifetimes)]
3528 pub fn suggested_tip_amounts(mut self, suggested_tip_amounts: &'a Vec<i64>) -> Self {
3529 self.suggested_tip_amounts = Some(suggested_tip_amounts);
3530 self
3531 }
3532 #[allow(clippy::needless_lifetimes)]
3533 pub fn get_suggested_tip_amounts(&'a self) -> &'a Option<&'a Vec<i64>> {
3534 &self.suggested_tip_amounts
3535 }
3536 #[allow(rustdoc::invalid_html_tags)]
3537 #[doc = "Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter"]
3538 #[allow(clippy::needless_lifetimes)]
3539 pub fn start_parameter(mut self, start_parameter: &'a str) -> Self {
3540 self.start_parameter = Some(start_parameter);
3541 self
3542 }
3543 #[allow(clippy::needless_lifetimes)]
3544 pub fn get_start_parameter(&'a self) -> &'a Option<&'a str> {
3545 &self.start_parameter
3546 }
3547 #[allow(rustdoc::invalid_html_tags)]
3548 #[doc = "JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."]
3549 #[allow(clippy::needless_lifetimes)]
3550 pub fn provider_data(mut self, provider_data: &'a str) -> Self {
3551 self.provider_data = Some(provider_data);
3552 self
3553 }
3554 #[allow(clippy::needless_lifetimes)]
3555 pub fn get_provider_data(&'a self) -> &'a Option<&'a str> {
3556 &self.provider_data
3557 }
3558 #[allow(rustdoc::invalid_html_tags)]
3559 #[doc = "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for."]
3560 #[allow(clippy::needless_lifetimes)]
3561 pub fn photo_url(mut self, photo_url: &'a str) -> Self {
3562 self.photo_url = Some(photo_url);
3563 self
3564 }
3565 #[allow(clippy::needless_lifetimes)]
3566 pub fn get_photo_url(&'a self) -> &'a Option<&'a str> {
3567 &self.photo_url
3568 }
3569 #[allow(rustdoc::invalid_html_tags)]
3570 #[doc = "Photo size in bytes"]
3571 #[allow(clippy::needless_lifetimes)]
3572 pub fn photo_size(mut self, photo_size: i64) -> Self {
3573 self.photo_size = Some(photo_size);
3574 self
3575 }
3576 #[allow(clippy::needless_lifetimes)]
3577 pub fn get_photo_size(&'a self) -> &'a Option<i64> {
3578 &self.photo_size
3579 }
3580 #[allow(rustdoc::invalid_html_tags)]
3581 #[doc = "Photo width"]
3582 #[allow(clippy::needless_lifetimes)]
3583 pub fn photo_width(mut self, photo_width: i64) -> Self {
3584 self.photo_width = Some(photo_width);
3585 self
3586 }
3587 #[allow(clippy::needless_lifetimes)]
3588 pub fn get_photo_width(&'a self) -> &'a Option<i64> {
3589 &self.photo_width
3590 }
3591 #[allow(rustdoc::invalid_html_tags)]
3592 #[doc = "Photo height"]
3593 #[allow(clippy::needless_lifetimes)]
3594 pub fn photo_height(mut self, photo_height: i64) -> Self {
3595 self.photo_height = Some(photo_height);
3596 self
3597 }
3598 #[allow(clippy::needless_lifetimes)]
3599 pub fn get_photo_height(&'a self) -> &'a Option<i64> {
3600 &self.photo_height
3601 }
3602 #[allow(rustdoc::invalid_html_tags)]
3603 #[doc = "Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."]
3604 #[allow(clippy::needless_lifetimes)]
3605 pub fn need_name(mut self, need_name: bool) -> Self {
3606 self.need_name = Some(need_name);
3607 self
3608 }
3609 #[allow(clippy::needless_lifetimes)]
3610 pub fn get_need_name(&'a self) -> &'a Option<bool> {
3611 &self.need_name
3612 }
3613 #[allow(rustdoc::invalid_html_tags)]
3614 #[doc = "Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."]
3615 #[allow(clippy::needless_lifetimes)]
3616 pub fn need_phone_number(mut self, need_phone_number: bool) -> Self {
3617 self.need_phone_number = Some(need_phone_number);
3618 self
3619 }
3620 #[allow(clippy::needless_lifetimes)]
3621 pub fn get_need_phone_number(&'a self) -> &'a Option<bool> {
3622 &self.need_phone_number
3623 }
3624 #[allow(rustdoc::invalid_html_tags)]
3625 #[doc = "Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."]
3626 #[allow(clippy::needless_lifetimes)]
3627 pub fn need_email(mut self, need_email: bool) -> Self {
3628 self.need_email = Some(need_email);
3629 self
3630 }
3631 #[allow(clippy::needless_lifetimes)]
3632 pub fn get_need_email(&'a self) -> &'a Option<bool> {
3633 &self.need_email
3634 }
3635 #[allow(rustdoc::invalid_html_tags)]
3636 #[doc = "Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."]
3637 #[allow(clippy::needless_lifetimes)]
3638 pub fn need_shipping_address(mut self, need_shipping_address: bool) -> Self {
3639 self.need_shipping_address = Some(need_shipping_address);
3640 self
3641 }
3642 #[allow(clippy::needless_lifetimes)]
3643 pub fn get_need_shipping_address(&'a self) -> &'a Option<bool> {
3644 &self.need_shipping_address
3645 }
3646 #[allow(rustdoc::invalid_html_tags)]
3647 #[doc = "Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."]
3648 #[allow(clippy::needless_lifetimes)]
3649 pub fn send_phone_number_to_provider(mut self, send_phone_number_to_provider: bool) -> Self {
3650 self.send_phone_number_to_provider = Some(send_phone_number_to_provider);
3651 self
3652 }
3653 #[allow(clippy::needless_lifetimes)]
3654 pub fn get_send_phone_number_to_provider(&'a self) -> &'a Option<bool> {
3655 &self.send_phone_number_to_provider
3656 }
3657 #[allow(rustdoc::invalid_html_tags)]
3658 #[doc = "Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."]
3659 #[allow(clippy::needless_lifetimes)]
3660 pub fn send_email_to_provider(mut self, send_email_to_provider: bool) -> Self {
3661 self.send_email_to_provider = Some(send_email_to_provider);
3662 self
3663 }
3664 #[allow(clippy::needless_lifetimes)]
3665 pub fn get_send_email_to_provider(&'a self) -> &'a Option<bool> {
3666 &self.send_email_to_provider
3667 }
3668 #[allow(rustdoc::invalid_html_tags)]
3669 #[doc = "Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."]
3670 #[allow(clippy::needless_lifetimes)]
3671 pub fn is_flexible(mut self, is_flexible: bool) -> Self {
3672 self.is_flexible = Some(is_flexible);
3673 self
3674 }
3675 #[allow(clippy::needless_lifetimes)]
3676 pub fn get_is_flexible(&'a self) -> &'a Option<bool> {
3677 &self.is_flexible
3678 }
3679 #[allow(rustdoc::invalid_html_tags)]
3680 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
3681 #[allow(clippy::needless_lifetimes)]
3682 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
3683 self.disable_notification = Some(disable_notification);
3684 self
3685 }
3686 #[allow(clippy::needless_lifetimes)]
3687 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
3688 &self.disable_notification
3689 }
3690 #[allow(rustdoc::invalid_html_tags)]
3691 #[doc = "Protects the contents of the sent message from forwarding and saving"]
3692 #[allow(clippy::needless_lifetimes)]
3693 pub fn protect_content(mut self, protect_content: bool) -> Self {
3694 self.protect_content = Some(protect_content);
3695 self
3696 }
3697 #[allow(clippy::needless_lifetimes)]
3698 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
3699 &self.protect_content
3700 }
3701 #[allow(rustdoc::invalid_html_tags)]
3702 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
3703 #[allow(clippy::needless_lifetimes)]
3704 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
3705 self.allow_paid_broadcast = Some(allow_paid_broadcast);
3706 self
3707 }
3708 #[allow(clippy::needless_lifetimes)]
3709 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
3710 &self.allow_paid_broadcast
3711 }
3712 #[allow(rustdoc::invalid_html_tags)]
3713 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
3714 #[allow(clippy::needless_lifetimes)]
3715 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
3716 self.message_effect_id = Some(message_effect_id);
3717 self
3718 }
3719 #[allow(clippy::needless_lifetimes)]
3720 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
3721 &self.message_effect_id
3722 }
3723 #[allow(rustdoc::invalid_html_tags)]
3724 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
3725 #[allow(clippy::needless_lifetimes)]
3726 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
3727 where
3728 T: Into<&'a SuggestedPostParameters>,
3729 {
3730 self.suggested_post_parameters = Some(suggested_post_parameters.into());
3731 self
3732 }
3733 #[allow(clippy::needless_lifetimes)]
3734 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
3735 &self.suggested_post_parameters
3736 }
3737 #[allow(rustdoc::invalid_html_tags)]
3738 #[doc = "Description of the message to reply to"]
3739 #[allow(clippy::needless_lifetimes)]
3740 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
3741 where
3742 T: Into<&'a ReplyParameters>,
3743 {
3744 self.reply_parameters = Some(reply_parameters.into());
3745 self
3746 }
3747 #[allow(clippy::needless_lifetimes)]
3748 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
3749 &self.reply_parameters
3750 }
3751 #[allow(rustdoc::invalid_html_tags)]
3752 #[doc = "A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button."]
3753 #[allow(clippy::needless_lifetimes)]
3754 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
3755 where
3756 T: Into<&'a InlineKeyboardMarkup>,
3757 {
3758 self.reply_markup = Some(reply_markup.into());
3759 self
3760 }
3761 #[allow(clippy::needless_lifetimes)]
3762 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
3763 &self.reply_markup
3764 }
3765 pub async fn build(self) -> BotResult<Message> {
3766 self.bot
3767 .send_invoice(
3768 self.chat_id,
3769 self.message_thread_id,
3770 self.direct_messages_topic_id,
3771 self.title,
3772 self.description,
3773 self.payload,
3774 self.provider_token,
3775 self.currency,
3776 self.prices,
3777 self.max_tip_amount,
3778 self.suggested_tip_amounts,
3779 self.start_parameter,
3780 self.provider_data,
3781 self.photo_url,
3782 self.photo_size,
3783 self.photo_width,
3784 self.photo_height,
3785 self.need_name,
3786 self.need_phone_number,
3787 self.need_email,
3788 self.need_shipping_address,
3789 self.send_phone_number_to_provider,
3790 self.send_email_to_provider,
3791 self.is_flexible,
3792 self.disable_notification,
3793 self.protect_content,
3794 self.allow_paid_broadcast,
3795 self.message_effect_id,
3796 self.suggested_post_parameters,
3797 self.reply_parameters,
3798 self.reply_markup,
3799 )
3800 .await
3801 }
3802}
3803pub struct CallCloseForumTopic<'a, V> {
3804 bot: &'a Bot,
3805 chat_id: V,
3806 message_thread_id: i64,
3807}
3808impl<'a, V: Into<ChatHandle> + Serialize> CallCloseForumTopic<'a, V> {
3809 #[allow(rustdoc::invalid_html_tags)]
3810 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
3811 #[allow(clippy::needless_lifetimes)]
3812 pub fn chat_id(mut self, chat_id: V) -> Self {
3813 self.chat_id = chat_id;
3814 self
3815 }
3816 #[allow(clippy::needless_lifetimes)]
3817 pub fn get_chat_id(&'a self) -> &'a V {
3818 &self.chat_id
3819 }
3820 #[allow(rustdoc::invalid_html_tags)]
3821 #[doc = "Unique identifier for the target message thread of the forum topic"]
3822 #[allow(clippy::needless_lifetimes)]
3823 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
3824 self.message_thread_id = message_thread_id;
3825 self
3826 }
3827 #[allow(clippy::needless_lifetimes)]
3828 pub fn get_message_thread_id(&'a self) -> &'a i64 {
3829 &self.message_thread_id
3830 }
3831 pub async fn build(self) -> BotResult<bool> {
3832 self.bot
3833 .close_forum_topic(self.chat_id, self.message_thread_id)
3834 .await
3835 }
3836}
3837pub struct CallRefundStarPayment<'a> {
3838 bot: &'a Bot,
3839 user_id: i64,
3840 telegram_payment_charge_id: &'a str,
3841}
3842impl<'a> CallRefundStarPayment<'a> {
3843 #[allow(rustdoc::invalid_html_tags)]
3844 #[doc = "Identifier of the user whose payment will be refunded"]
3845 #[allow(clippy::needless_lifetimes)]
3846 pub fn user_id(mut self, user_id: i64) -> Self {
3847 self.user_id = user_id;
3848 self
3849 }
3850 #[allow(clippy::needless_lifetimes)]
3851 pub fn get_user_id(&'a self) -> &'a i64 {
3852 &self.user_id
3853 }
3854 #[allow(rustdoc::invalid_html_tags)]
3855 #[doc = "Telegram payment identifier"]
3856 #[allow(clippy::needless_lifetimes)]
3857 pub fn telegram_payment_charge_id(mut self, telegram_payment_charge_id: &'a str) -> Self {
3858 self.telegram_payment_charge_id = telegram_payment_charge_id;
3859 self
3860 }
3861 #[allow(clippy::needless_lifetimes)]
3862 pub fn get_telegram_payment_charge_id(&'a self) -> &'a &'a str {
3863 &self.telegram_payment_charge_id
3864 }
3865 pub async fn build(self) -> BotResult<bool> {
3866 self.bot
3867 .refund_star_payment(self.user_id, self.telegram_payment_charge_id)
3868 .await
3869 }
3870}
3871pub struct CallGetUpdates<'a> {
3872 bot: &'a Bot,
3873 offset: Option<i64>,
3874 limit: Option<i64>,
3875 timeout: Option<i64>,
3876 allowed_updates: Option<&'a Vec<String>>,
3877}
3878impl<'a> CallGetUpdates<'a> {
3879 #[allow(rustdoc::invalid_html_tags)]
3880 #[doc = "Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten."]
3881 #[allow(clippy::needless_lifetimes)]
3882 pub fn offset(mut self, offset: i64) -> Self {
3883 self.offset = Some(offset);
3884 self
3885 }
3886 #[allow(clippy::needless_lifetimes)]
3887 pub fn get_offset(&'a self) -> &'a Option<i64> {
3888 &self.offset
3889 }
3890 #[allow(rustdoc::invalid_html_tags)]
3891 #[doc = "Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
3892 #[allow(clippy::needless_lifetimes)]
3893 pub fn limit(mut self, limit: i64) -> Self {
3894 self.limit = Some(limit);
3895 self
3896 }
3897 #[allow(clippy::needless_lifetimes)]
3898 pub fn get_limit(&'a self) -> &'a Option<i64> {
3899 &self.limit
3900 }
3901 #[allow(rustdoc::invalid_html_tags)]
3902 #[doc = "Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."]
3903 #[allow(clippy::needless_lifetimes)]
3904 pub fn timeout(mut self, timeout: i64) -> Self {
3905 self.timeout = Some(timeout);
3906 self
3907 }
3908 #[allow(clippy::needless_lifetimes)]
3909 pub fn get_timeout(&'a self) -> &'a Option<i64> {
3910 &self.timeout
3911 }
3912 #[allow(rustdoc::invalid_html_tags)]
3913 #[doc = "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time."]
3914 #[allow(clippy::needless_lifetimes)]
3915 pub fn allowed_updates(mut self, allowed_updates: &'a Vec<String>) -> Self {
3916 self.allowed_updates = Some(allowed_updates);
3917 self
3918 }
3919 #[allow(clippy::needless_lifetimes)]
3920 pub fn get_allowed_updates(&'a self) -> &'a Option<&'a Vec<String>> {
3921 &self.allowed_updates
3922 }
3923 pub async fn build(self) -> BotResult<Vec<Update>> {
3924 self.bot
3925 .get_updates(self.offset, self.limit, self.timeout, self.allowed_updates)
3926 .await
3927 }
3928}
3929pub struct CallSendPaidMedia<'a, V> {
3930 bot: &'a Bot,
3931 business_connection_id: Option<&'a str>,
3932 chat_id: V,
3933 message_thread_id: Option<i64>,
3934 direct_messages_topic_id: Option<i64>,
3935 star_count: i64,
3936 media: &'a Vec<InputPaidMedia>,
3937 payload: Option<&'a str>,
3938 caption: Option<&'a str>,
3939 parse_mode: Option<&'a str>,
3940 caption_entities: Option<&'a Vec<MessageEntity>>,
3941 show_caption_above_media: Option<bool>,
3942 disable_notification: Option<bool>,
3943 protect_content: Option<bool>,
3944 allow_paid_broadcast: Option<bool>,
3945 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
3946 reply_parameters: Option<&'a ReplyParameters>,
3947 reply_markup: Option<&'a EReplyMarkup>,
3948}
3949impl<'a, V: Into<ChatHandle> + Serialize> CallSendPaidMedia<'a, V> {
3950 #[allow(rustdoc::invalid_html_tags)]
3951 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
3952 #[allow(clippy::needless_lifetimes)]
3953 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
3954 self.business_connection_id = Some(business_connection_id);
3955 self
3956 }
3957 #[allow(clippy::needless_lifetimes)]
3958 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
3959 &self.business_connection_id
3960 }
3961 #[allow(rustdoc::invalid_html_tags)]
3962 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance."]
3963 #[allow(clippy::needless_lifetimes)]
3964 pub fn chat_id(mut self, chat_id: V) -> Self {
3965 self.chat_id = chat_id;
3966 self
3967 }
3968 #[allow(clippy::needless_lifetimes)]
3969 pub fn get_chat_id(&'a self) -> &'a V {
3970 &self.chat_id
3971 }
3972 #[allow(rustdoc::invalid_html_tags)]
3973 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
3974 #[allow(clippy::needless_lifetimes)]
3975 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
3976 self.message_thread_id = Some(message_thread_id);
3977 self
3978 }
3979 #[allow(clippy::needless_lifetimes)]
3980 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
3981 &self.message_thread_id
3982 }
3983 #[allow(rustdoc::invalid_html_tags)]
3984 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
3985 #[allow(clippy::needless_lifetimes)]
3986 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
3987 self.direct_messages_topic_id = Some(direct_messages_topic_id);
3988 self
3989 }
3990 #[allow(clippy::needless_lifetimes)]
3991 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
3992 &self.direct_messages_topic_id
3993 }
3994 #[allow(rustdoc::invalid_html_tags)]
3995 #[doc = "The number of Telegram Stars that must be paid to buy access to the media; 1-10000"]
3996 #[allow(clippy::needless_lifetimes)]
3997 pub fn star_count(mut self, star_count: i64) -> Self {
3998 self.star_count = star_count;
3999 self
4000 }
4001 #[allow(clippy::needless_lifetimes)]
4002 pub fn get_star_count(&'a self) -> &'a i64 {
4003 &self.star_count
4004 }
4005 #[allow(rustdoc::invalid_html_tags)]
4006 #[doc = "A JSON-serialized array describing the media to be sent; up to 10 items"]
4007 #[allow(clippy::needless_lifetimes)]
4008 pub fn media(mut self, media: &'a Vec<InputPaidMedia>) -> Self {
4009 self.media = media;
4010 self
4011 }
4012 #[allow(clippy::needless_lifetimes)]
4013 pub fn get_media(&'a self) -> &'a &'a Vec<InputPaidMedia> {
4014 &self.media
4015 }
4016 #[allow(rustdoc::invalid_html_tags)]
4017 #[doc = "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."]
4018 #[allow(clippy::needless_lifetimes)]
4019 pub fn payload(mut self, payload: &'a str) -> Self {
4020 self.payload = Some(payload);
4021 self
4022 }
4023 #[allow(clippy::needless_lifetimes)]
4024 pub fn get_payload(&'a self) -> &'a Option<&'a str> {
4025 &self.payload
4026 }
4027 #[allow(rustdoc::invalid_html_tags)]
4028 #[doc = "Media caption, 0-1024 characters after entities parsing"]
4029 #[allow(clippy::needless_lifetimes)]
4030 pub fn caption(mut self, caption: &'a str) -> Self {
4031 self.caption = Some(caption);
4032 self
4033 }
4034 #[allow(clippy::needless_lifetimes)]
4035 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
4036 &self.caption
4037 }
4038 #[allow(rustdoc::invalid_html_tags)]
4039 #[doc = "Mode for parsing entities in the media caption. See formatting options for more details."]
4040 #[allow(clippy::needless_lifetimes)]
4041 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
4042 self.parse_mode = Some(parse_mode);
4043 self
4044 }
4045 #[allow(clippy::needless_lifetimes)]
4046 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
4047 &self.parse_mode
4048 }
4049 #[allow(rustdoc::invalid_html_tags)]
4050 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
4051 #[allow(clippy::needless_lifetimes)]
4052 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
4053 self.caption_entities = Some(caption_entities);
4054 self
4055 }
4056 #[allow(clippy::needless_lifetimes)]
4057 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
4058 &self.caption_entities
4059 }
4060 #[allow(rustdoc::invalid_html_tags)]
4061 #[doc = "Pass True, if the caption must be shown above the message media"]
4062 #[allow(clippy::needless_lifetimes)]
4063 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
4064 self.show_caption_above_media = Some(show_caption_above_media);
4065 self
4066 }
4067 #[allow(clippy::needless_lifetimes)]
4068 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
4069 &self.show_caption_above_media
4070 }
4071 #[allow(rustdoc::invalid_html_tags)]
4072 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
4073 #[allow(clippy::needless_lifetimes)]
4074 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
4075 self.disable_notification = Some(disable_notification);
4076 self
4077 }
4078 #[allow(clippy::needless_lifetimes)]
4079 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
4080 &self.disable_notification
4081 }
4082 #[allow(rustdoc::invalid_html_tags)]
4083 #[doc = "Protects the contents of the sent message from forwarding and saving"]
4084 #[allow(clippy::needless_lifetimes)]
4085 pub fn protect_content(mut self, protect_content: bool) -> Self {
4086 self.protect_content = Some(protect_content);
4087 self
4088 }
4089 #[allow(clippy::needless_lifetimes)]
4090 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
4091 &self.protect_content
4092 }
4093 #[allow(rustdoc::invalid_html_tags)]
4094 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
4095 #[allow(clippy::needless_lifetimes)]
4096 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
4097 self.allow_paid_broadcast = Some(allow_paid_broadcast);
4098 self
4099 }
4100 #[allow(clippy::needless_lifetimes)]
4101 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
4102 &self.allow_paid_broadcast
4103 }
4104 #[allow(rustdoc::invalid_html_tags)]
4105 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
4106 #[allow(clippy::needless_lifetimes)]
4107 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
4108 where
4109 T: Into<&'a SuggestedPostParameters>,
4110 {
4111 self.suggested_post_parameters = Some(suggested_post_parameters.into());
4112 self
4113 }
4114 #[allow(clippy::needless_lifetimes)]
4115 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
4116 &self.suggested_post_parameters
4117 }
4118 #[allow(rustdoc::invalid_html_tags)]
4119 #[doc = "Description of the message to reply to"]
4120 #[allow(clippy::needless_lifetimes)]
4121 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
4122 where
4123 T: Into<&'a ReplyParameters>,
4124 {
4125 self.reply_parameters = Some(reply_parameters.into());
4126 self
4127 }
4128 #[allow(clippy::needless_lifetimes)]
4129 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
4130 &self.reply_parameters
4131 }
4132 #[allow(rustdoc::invalid_html_tags)]
4133 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
4134 #[allow(clippy::needless_lifetimes)]
4135 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
4136 where
4137 T: Into<&'a EReplyMarkup>,
4138 {
4139 self.reply_markup = Some(reply_markup.into());
4140 self
4141 }
4142 #[allow(clippy::needless_lifetimes)]
4143 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
4144 &self.reply_markup
4145 }
4146 pub async fn build(self) -> BotResult<Message> {
4147 self.bot
4148 .send_paid_media(
4149 self.business_connection_id,
4150 self.chat_id,
4151 self.message_thread_id,
4152 self.direct_messages_topic_id,
4153 self.star_count,
4154 self.media,
4155 self.payload,
4156 self.caption,
4157 self.parse_mode,
4158 self.caption_entities,
4159 self.show_caption_above_media,
4160 self.disable_notification,
4161 self.protect_content,
4162 self.allow_paid_broadcast,
4163 self.suggested_post_parameters,
4164 self.reply_parameters,
4165 self.reply_markup,
4166 )
4167 .await
4168 }
4169}
4170pub struct CallReopenForumTopic<'a, V> {
4171 bot: &'a Bot,
4172 chat_id: V,
4173 message_thread_id: i64,
4174}
4175impl<'a, V: Into<ChatHandle> + Serialize> CallReopenForumTopic<'a, V> {
4176 #[allow(rustdoc::invalid_html_tags)]
4177 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
4178 #[allow(clippy::needless_lifetimes)]
4179 pub fn chat_id(mut self, chat_id: V) -> Self {
4180 self.chat_id = chat_id;
4181 self
4182 }
4183 #[allow(clippy::needless_lifetimes)]
4184 pub fn get_chat_id(&'a self) -> &'a V {
4185 &self.chat_id
4186 }
4187 #[allow(rustdoc::invalid_html_tags)]
4188 #[doc = "Unique identifier for the target message thread of the forum topic"]
4189 #[allow(clippy::needless_lifetimes)]
4190 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
4191 self.message_thread_id = message_thread_id;
4192 self
4193 }
4194 #[allow(clippy::needless_lifetimes)]
4195 pub fn get_message_thread_id(&'a self) -> &'a i64 {
4196 &self.message_thread_id
4197 }
4198 pub async fn build(self) -> BotResult<bool> {
4199 self.bot
4200 .reopen_forum_topic(self.chat_id, self.message_thread_id)
4201 .await
4202 }
4203}
4204pub struct CallEditMessageLiveLocation<'a, V> {
4205 bot: &'a Bot,
4206 business_connection_id: Option<&'a str>,
4207 chat_id: Option<V>,
4208 message_id: Option<i64>,
4209 inline_message_id: Option<&'a str>,
4210 latitude: ::ordered_float::OrderedFloat<f64>,
4211 longitude: ::ordered_float::OrderedFloat<f64>,
4212 live_period: Option<i64>,
4213 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
4214 heading: Option<i64>,
4215 proximity_alert_radius: Option<i64>,
4216 reply_markup: Option<&'a InlineKeyboardMarkup>,
4217}
4218impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageLiveLocation<'a, V> {
4219 #[allow(rustdoc::invalid_html_tags)]
4220 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
4221 #[allow(clippy::needless_lifetimes)]
4222 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4223 self.business_connection_id = Some(business_connection_id);
4224 self
4225 }
4226 #[allow(clippy::needless_lifetimes)]
4227 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
4228 &self.business_connection_id
4229 }
4230 #[allow(rustdoc::invalid_html_tags)]
4231 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
4232 #[allow(clippy::needless_lifetimes)]
4233 pub fn chat_id(mut self, chat_id: V) -> Self {
4234 self.chat_id = Some(chat_id);
4235 self
4236 }
4237 #[allow(clippy::needless_lifetimes)]
4238 pub fn get_chat_id(&'a self) -> &'a Option<V> {
4239 &self.chat_id
4240 }
4241 #[allow(rustdoc::invalid_html_tags)]
4242 #[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
4243 #[allow(clippy::needless_lifetimes)]
4244 pub fn message_id(mut self, message_id: i64) -> Self {
4245 self.message_id = Some(message_id);
4246 self
4247 }
4248 #[allow(clippy::needless_lifetimes)]
4249 pub fn get_message_id(&'a self) -> &'a Option<i64> {
4250 &self.message_id
4251 }
4252 #[allow(rustdoc::invalid_html_tags)]
4253 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
4254 #[allow(clippy::needless_lifetimes)]
4255 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
4256 self.inline_message_id = Some(inline_message_id);
4257 self
4258 }
4259 #[allow(clippy::needless_lifetimes)]
4260 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
4261 &self.inline_message_id
4262 }
4263 #[allow(rustdoc::invalid_html_tags)]
4264 #[doc = "Latitude of new location"]
4265 #[allow(clippy::needless_lifetimes)]
4266 pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
4267 self.latitude = latitude;
4268 self
4269 }
4270 #[allow(clippy::needless_lifetimes)]
4271 pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
4272 &self.latitude
4273 }
4274 #[allow(rustdoc::invalid_html_tags)]
4275 #[doc = "Longitude of new location"]
4276 #[allow(clippy::needless_lifetimes)]
4277 pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
4278 self.longitude = longitude;
4279 self
4280 }
4281 #[allow(clippy::needless_lifetimes)]
4282 pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
4283 &self.longitude
4284 }
4285 #[allow(rustdoc::invalid_html_tags)]
4286 #[doc = "New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged"]
4287 #[allow(clippy::needless_lifetimes)]
4288 pub fn live_period(mut self, live_period: i64) -> Self {
4289 self.live_period = Some(live_period);
4290 self
4291 }
4292 #[allow(clippy::needless_lifetimes)]
4293 pub fn get_live_period(&'a self) -> &'a Option<i64> {
4294 &self.live_period
4295 }
4296 #[allow(rustdoc::invalid_html_tags)]
4297 #[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
4298 #[allow(clippy::needless_lifetimes)]
4299 pub fn horizontal_accuracy(
4300 mut self,
4301 horizontal_accuracy: ::ordered_float::OrderedFloat<f64>,
4302 ) -> Self {
4303 self.horizontal_accuracy = Some(horizontal_accuracy);
4304 self
4305 }
4306 #[allow(clippy::needless_lifetimes)]
4307 pub fn get_horizontal_accuracy(&'a self) -> &'a Option<::ordered_float::OrderedFloat<f64>> {
4308 &self.horizontal_accuracy
4309 }
4310 #[allow(rustdoc::invalid_html_tags)]
4311 #[doc = "Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
4312 #[allow(clippy::needless_lifetimes)]
4313 pub fn heading(mut self, heading: i64) -> Self {
4314 self.heading = Some(heading);
4315 self
4316 }
4317 #[allow(clippy::needless_lifetimes)]
4318 pub fn get_heading(&'a self) -> &'a Option<i64> {
4319 &self.heading
4320 }
4321 #[allow(rustdoc::invalid_html_tags)]
4322 #[doc = "The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
4323 #[allow(clippy::needless_lifetimes)]
4324 pub fn proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
4325 self.proximity_alert_radius = Some(proximity_alert_radius);
4326 self
4327 }
4328 #[allow(clippy::needless_lifetimes)]
4329 pub fn get_proximity_alert_radius(&'a self) -> &'a Option<i64> {
4330 &self.proximity_alert_radius
4331 }
4332 #[allow(rustdoc::invalid_html_tags)]
4333 #[doc = "A JSON-serialized object for a new inline keyboard."]
4334 #[allow(clippy::needless_lifetimes)]
4335 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
4336 where
4337 T: Into<&'a InlineKeyboardMarkup>,
4338 {
4339 self.reply_markup = Some(reply_markup.into());
4340 self
4341 }
4342 #[allow(clippy::needless_lifetimes)]
4343 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
4344 &self.reply_markup
4345 }
4346 pub async fn build(self) -> BotResult<MessageBool> {
4347 self.bot
4348 .edit_message_live_location(
4349 self.business_connection_id,
4350 self.chat_id,
4351 self.message_id,
4352 self.inline_message_id,
4353 self.latitude,
4354 self.longitude,
4355 self.live_period,
4356 self.horizontal_accuracy,
4357 self.heading,
4358 self.proximity_alert_radius,
4359 self.reply_markup,
4360 )
4361 .await
4362 }
4363}
4364pub struct CallEditMessageChecklist<'a> {
4365 bot: &'a Bot,
4366 business_connection_id: &'a str,
4367 chat_id: i64,
4368 message_id: i64,
4369 checklist: &'a InputChecklist,
4370 reply_markup: Option<&'a InlineKeyboardMarkup>,
4371}
4372impl<'a> CallEditMessageChecklist<'a> {
4373 #[allow(rustdoc::invalid_html_tags)]
4374 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
4375 #[allow(clippy::needless_lifetimes)]
4376 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4377 self.business_connection_id = business_connection_id;
4378 self
4379 }
4380 #[allow(clippy::needless_lifetimes)]
4381 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
4382 &self.business_connection_id
4383 }
4384 #[allow(rustdoc::invalid_html_tags)]
4385 #[doc = "Unique identifier for the target chat"]
4386 #[allow(clippy::needless_lifetimes)]
4387 pub fn chat_id(mut self, chat_id: i64) -> Self {
4388 self.chat_id = chat_id;
4389 self
4390 }
4391 #[allow(clippy::needless_lifetimes)]
4392 pub fn get_chat_id(&'a self) -> &'a i64 {
4393 &self.chat_id
4394 }
4395 #[allow(rustdoc::invalid_html_tags)]
4396 #[doc = "Unique identifier for the target message"]
4397 #[allow(clippy::needless_lifetimes)]
4398 pub fn message_id(mut self, message_id: i64) -> Self {
4399 self.message_id = message_id;
4400 self
4401 }
4402 #[allow(clippy::needless_lifetimes)]
4403 pub fn get_message_id(&'a self) -> &'a i64 {
4404 &self.message_id
4405 }
4406 #[allow(rustdoc::invalid_html_tags)]
4407 #[doc = "A JSON-serialized object for the new checklist"]
4408 #[allow(clippy::needless_lifetimes)]
4409 pub fn checklist<T>(mut self, checklist: T) -> Self
4410 where
4411 T: Into<&'a InputChecklist>,
4412 {
4413 self.checklist = checklist.into();
4414 self
4415 }
4416 #[allow(clippy::needless_lifetimes)]
4417 pub fn get_checklist(&'a self) -> &'a &'a InputChecklist {
4418 &self.checklist
4419 }
4420 #[allow(rustdoc::invalid_html_tags)]
4421 #[doc = "A JSON-serialized object for the new inline keyboard for the message"]
4422 #[allow(clippy::needless_lifetimes)]
4423 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
4424 where
4425 T: Into<&'a InlineKeyboardMarkup>,
4426 {
4427 self.reply_markup = Some(reply_markup.into());
4428 self
4429 }
4430 #[allow(clippy::needless_lifetimes)]
4431 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
4432 &self.reply_markup
4433 }
4434 pub async fn build(self) -> BotResult<Message> {
4435 self.bot
4436 .edit_message_checklist(
4437 self.business_connection_id,
4438 self.chat_id,
4439 self.message_id,
4440 self.checklist,
4441 self.reply_markup,
4442 )
4443 .await
4444 }
4445}
4446pub struct CallSetBusinessAccountUsername<'a> {
4447 bot: &'a Bot,
4448 business_connection_id: &'a str,
4449 username: Option<&'a str>,
4450}
4451impl<'a> CallSetBusinessAccountUsername<'a> {
4452 #[allow(rustdoc::invalid_html_tags)]
4453 #[doc = "Unique identifier of the business connection"]
4454 #[allow(clippy::needless_lifetimes)]
4455 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4456 self.business_connection_id = business_connection_id;
4457 self
4458 }
4459 #[allow(clippy::needless_lifetimes)]
4460 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
4461 &self.business_connection_id
4462 }
4463 #[allow(rustdoc::invalid_html_tags)]
4464 #[doc = "The new value of the username for the business account; 0-32 characters"]
4465 #[allow(clippy::needless_lifetimes)]
4466 pub fn username(mut self, username: &'a str) -> Self {
4467 self.username = Some(username);
4468 self
4469 }
4470 #[allow(clippy::needless_lifetimes)]
4471 pub fn get_username(&'a self) -> &'a Option<&'a str> {
4472 &self.username
4473 }
4474 pub async fn build(self) -> BotResult<bool> {
4475 self.bot
4476 .set_business_account_username(self.business_connection_id, self.username)
4477 .await
4478 }
4479}
4480pub struct CallSetPassportDataErrors<'a> {
4481 bot: &'a Bot,
4482 user_id: i64,
4483 errors: &'a Vec<PassportElementError>,
4484}
4485impl<'a> CallSetPassportDataErrors<'a> {
4486 #[allow(rustdoc::invalid_html_tags)]
4487 #[doc = "User identifier"]
4488 #[allow(clippy::needless_lifetimes)]
4489 pub fn user_id(mut self, user_id: i64) -> Self {
4490 self.user_id = user_id;
4491 self
4492 }
4493 #[allow(clippy::needless_lifetimes)]
4494 pub fn get_user_id(&'a self) -> &'a i64 {
4495 &self.user_id
4496 }
4497 #[allow(rustdoc::invalid_html_tags)]
4498 #[doc = "A JSON-serialized array describing the errors"]
4499 #[allow(clippy::needless_lifetimes)]
4500 pub fn errors(mut self, errors: &'a Vec<PassportElementError>) -> Self {
4501 self.errors = errors;
4502 self
4503 }
4504 #[allow(clippy::needless_lifetimes)]
4505 pub fn get_errors(&'a self) -> &'a &'a Vec<PassportElementError> {
4506 &self.errors
4507 }
4508 pub async fn build(self) -> BotResult<bool> {
4509 self.bot
4510 .set_passport_data_errors(self.user_id, self.errors)
4511 .await
4512 }
4513}
4514pub struct CallRemoveBusinessAccountProfilePhoto<'a> {
4515 bot: &'a Bot,
4516 business_connection_id: &'a str,
4517 is_public: Option<bool>,
4518}
4519impl<'a> CallRemoveBusinessAccountProfilePhoto<'a> {
4520 #[allow(rustdoc::invalid_html_tags)]
4521 #[doc = "Unique identifier of the business connection"]
4522 #[allow(clippy::needless_lifetimes)]
4523 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4524 self.business_connection_id = business_connection_id;
4525 self
4526 }
4527 #[allow(clippy::needless_lifetimes)]
4528 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
4529 &self.business_connection_id
4530 }
4531 #[allow(rustdoc::invalid_html_tags)]
4532 #[doc = "Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo."]
4533 #[allow(clippy::needless_lifetimes)]
4534 pub fn is_public(mut self, is_public: bool) -> Self {
4535 self.is_public = Some(is_public);
4536 self
4537 }
4538 #[allow(clippy::needless_lifetimes)]
4539 pub fn get_is_public(&'a self) -> &'a Option<bool> {
4540 &self.is_public
4541 }
4542 pub async fn build(self) -> BotResult<bool> {
4543 self.bot
4544 .remove_business_account_profile_photo(self.business_connection_id, self.is_public)
4545 .await
4546 }
4547}
4548pub struct CallSetMessageReaction<'a, V> {
4549 bot: &'a Bot,
4550 chat_id: V,
4551 message_id: i64,
4552 reaction: Option<&'a Vec<ReactionType>>,
4553 is_big: Option<bool>,
4554}
4555impl<'a, V: Into<ChatHandle> + Serialize> CallSetMessageReaction<'a, V> {
4556 #[allow(rustdoc::invalid_html_tags)]
4557 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
4558 #[allow(clippy::needless_lifetimes)]
4559 pub fn chat_id(mut self, chat_id: V) -> Self {
4560 self.chat_id = chat_id;
4561 self
4562 }
4563 #[allow(clippy::needless_lifetimes)]
4564 pub fn get_chat_id(&'a self) -> &'a V {
4565 &self.chat_id
4566 }
4567 #[allow(rustdoc::invalid_html_tags)]
4568 #[doc = "Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."]
4569 #[allow(clippy::needless_lifetimes)]
4570 pub fn message_id(mut self, message_id: i64) -> Self {
4571 self.message_id = message_id;
4572 self
4573 }
4574 #[allow(clippy::needless_lifetimes)]
4575 pub fn get_message_id(&'a self) -> &'a i64 {
4576 &self.message_id
4577 }
4578 #[allow(rustdoc::invalid_html_tags)]
4579 #[doc = "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."]
4580 #[allow(clippy::needless_lifetimes)]
4581 pub fn reaction(mut self, reaction: &'a Vec<ReactionType>) -> Self {
4582 self.reaction = Some(reaction);
4583 self
4584 }
4585 #[allow(clippy::needless_lifetimes)]
4586 pub fn get_reaction(&'a self) -> &'a Option<&'a Vec<ReactionType>> {
4587 &self.reaction
4588 }
4589 #[allow(rustdoc::invalid_html_tags)]
4590 #[doc = "Pass True to set the reaction with a big animation"]
4591 #[allow(clippy::needless_lifetimes)]
4592 pub fn is_big(mut self, is_big: bool) -> Self {
4593 self.is_big = Some(is_big);
4594 self
4595 }
4596 #[allow(clippy::needless_lifetimes)]
4597 pub fn get_is_big(&'a self) -> &'a Option<bool> {
4598 &self.is_big
4599 }
4600 pub async fn build(self) -> BotResult<bool> {
4601 self.bot
4602 .set_message_reaction(self.chat_id, self.message_id, self.reaction, self.is_big)
4603 .await
4604 }
4605}
4606pub struct CallSendPhoto<'a, V> {
4607 bot: &'a Bot,
4608 business_connection_id: Option<&'a str>,
4609 chat_id: V,
4610 message_thread_id: Option<i64>,
4611 direct_messages_topic_id: Option<i64>,
4612 photo: FileData,
4613 caption: Option<&'a str>,
4614 parse_mode: Option<&'a str>,
4615 caption_entities: Option<&'a Vec<MessageEntity>>,
4616 show_caption_above_media: Option<bool>,
4617 has_spoiler: Option<bool>,
4618 disable_notification: Option<bool>,
4619 protect_content: Option<bool>,
4620 allow_paid_broadcast: Option<bool>,
4621 message_effect_id: Option<&'a str>,
4622 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
4623 reply_parameters: Option<&'a ReplyParameters>,
4624 reply_markup: Option<&'a EReplyMarkup>,
4625}
4626impl<'a, V: Into<ChatHandle> + Serialize> CallSendPhoto<'a, V> {
4627 #[allow(rustdoc::invalid_html_tags)]
4628 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
4629 #[allow(clippy::needless_lifetimes)]
4630 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4631 self.business_connection_id = Some(business_connection_id);
4632 self
4633 }
4634 #[allow(clippy::needless_lifetimes)]
4635 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
4636 &self.business_connection_id
4637 }
4638 #[allow(rustdoc::invalid_html_tags)]
4639 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
4640 #[allow(clippy::needless_lifetimes)]
4641 pub fn chat_id(mut self, chat_id: V) -> Self {
4642 self.chat_id = chat_id;
4643 self
4644 }
4645 #[allow(clippy::needless_lifetimes)]
4646 pub fn get_chat_id(&'a self) -> &'a V {
4647 &self.chat_id
4648 }
4649 #[allow(rustdoc::invalid_html_tags)]
4650 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
4651 #[allow(clippy::needless_lifetimes)]
4652 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
4653 self.message_thread_id = Some(message_thread_id);
4654 self
4655 }
4656 #[allow(clippy::needless_lifetimes)]
4657 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
4658 &self.message_thread_id
4659 }
4660 #[allow(rustdoc::invalid_html_tags)]
4661 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
4662 #[allow(clippy::needless_lifetimes)]
4663 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
4664 self.direct_messages_topic_id = Some(direct_messages_topic_id);
4665 self
4666 }
4667 #[allow(clippy::needless_lifetimes)]
4668 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
4669 &self.direct_messages_topic_id
4670 }
4671 #[allow(rustdoc::invalid_html_tags)]
4672 #[doc = "Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
4673 #[allow(clippy::needless_lifetimes)]
4674 pub fn photo(mut self, photo: FileData) -> Self {
4675 self.photo = photo;
4676 self
4677 }
4678 #[allow(clippy::needless_lifetimes)]
4679 pub fn get_photo(&'a self) -> &'a FileData {
4680 &self.photo
4681 }
4682 #[allow(rustdoc::invalid_html_tags)]
4683 #[doc = "Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing"]
4684 #[allow(clippy::needless_lifetimes)]
4685 pub fn caption(mut self, caption: &'a str) -> Self {
4686 self.caption = Some(caption);
4687 self
4688 }
4689 #[allow(clippy::needless_lifetimes)]
4690 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
4691 &self.caption
4692 }
4693 #[allow(rustdoc::invalid_html_tags)]
4694 #[doc = "Mode for parsing entities in the photo caption. See formatting options for more details."]
4695 #[allow(clippy::needless_lifetimes)]
4696 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
4697 self.parse_mode = Some(parse_mode);
4698 self
4699 }
4700 #[allow(clippy::needless_lifetimes)]
4701 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
4702 &self.parse_mode
4703 }
4704 #[allow(rustdoc::invalid_html_tags)]
4705 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
4706 #[allow(clippy::needless_lifetimes)]
4707 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
4708 self.caption_entities = Some(caption_entities);
4709 self
4710 }
4711 #[allow(clippy::needless_lifetimes)]
4712 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
4713 &self.caption_entities
4714 }
4715 #[allow(rustdoc::invalid_html_tags)]
4716 #[doc = "Pass True, if the caption must be shown above the message media"]
4717 #[allow(clippy::needless_lifetimes)]
4718 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
4719 self.show_caption_above_media = Some(show_caption_above_media);
4720 self
4721 }
4722 #[allow(clippy::needless_lifetimes)]
4723 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
4724 &self.show_caption_above_media
4725 }
4726 #[allow(rustdoc::invalid_html_tags)]
4727 #[doc = "Pass True if the photo needs to be covered with a spoiler animation"]
4728 #[allow(clippy::needless_lifetimes)]
4729 pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
4730 self.has_spoiler = Some(has_spoiler);
4731 self
4732 }
4733 #[allow(clippy::needless_lifetimes)]
4734 pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
4735 &self.has_spoiler
4736 }
4737 #[allow(rustdoc::invalid_html_tags)]
4738 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
4739 #[allow(clippy::needless_lifetimes)]
4740 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
4741 self.disable_notification = Some(disable_notification);
4742 self
4743 }
4744 #[allow(clippy::needless_lifetimes)]
4745 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
4746 &self.disable_notification
4747 }
4748 #[allow(rustdoc::invalid_html_tags)]
4749 #[doc = "Protects the contents of the sent message from forwarding and saving"]
4750 #[allow(clippy::needless_lifetimes)]
4751 pub fn protect_content(mut self, protect_content: bool) -> Self {
4752 self.protect_content = Some(protect_content);
4753 self
4754 }
4755 #[allow(clippy::needless_lifetimes)]
4756 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
4757 &self.protect_content
4758 }
4759 #[allow(rustdoc::invalid_html_tags)]
4760 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
4761 #[allow(clippy::needless_lifetimes)]
4762 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
4763 self.allow_paid_broadcast = Some(allow_paid_broadcast);
4764 self
4765 }
4766 #[allow(clippy::needless_lifetimes)]
4767 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
4768 &self.allow_paid_broadcast
4769 }
4770 #[allow(rustdoc::invalid_html_tags)]
4771 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
4772 #[allow(clippy::needless_lifetimes)]
4773 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
4774 self.message_effect_id = Some(message_effect_id);
4775 self
4776 }
4777 #[allow(clippy::needless_lifetimes)]
4778 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
4779 &self.message_effect_id
4780 }
4781 #[allow(rustdoc::invalid_html_tags)]
4782 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
4783 #[allow(clippy::needless_lifetimes)]
4784 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
4785 where
4786 T: Into<&'a SuggestedPostParameters>,
4787 {
4788 self.suggested_post_parameters = Some(suggested_post_parameters.into());
4789 self
4790 }
4791 #[allow(clippy::needless_lifetimes)]
4792 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
4793 &self.suggested_post_parameters
4794 }
4795 #[allow(rustdoc::invalid_html_tags)]
4796 #[doc = "Description of the message to reply to"]
4797 #[allow(clippy::needless_lifetimes)]
4798 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
4799 where
4800 T: Into<&'a ReplyParameters>,
4801 {
4802 self.reply_parameters = Some(reply_parameters.into());
4803 self
4804 }
4805 #[allow(clippy::needless_lifetimes)]
4806 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
4807 &self.reply_parameters
4808 }
4809 #[allow(rustdoc::invalid_html_tags)]
4810 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
4811 #[allow(clippy::needless_lifetimes)]
4812 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
4813 where
4814 T: Into<&'a EReplyMarkup>,
4815 {
4816 self.reply_markup = Some(reply_markup.into());
4817 self
4818 }
4819 #[allow(clippy::needless_lifetimes)]
4820 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
4821 &self.reply_markup
4822 }
4823 pub async fn build(self) -> BotResult<Message> {
4824 self.bot
4825 .send_photo(
4826 self.business_connection_id,
4827 self.chat_id,
4828 self.message_thread_id,
4829 self.direct_messages_topic_id,
4830 self.photo,
4831 self.caption,
4832 self.parse_mode,
4833 self.caption_entities,
4834 self.show_caption_above_media,
4835 self.has_spoiler,
4836 self.disable_notification,
4837 self.protect_content,
4838 self.allow_paid_broadcast,
4839 self.message_effect_id,
4840 self.suggested_post_parameters,
4841 self.reply_parameters,
4842 self.reply_markup,
4843 )
4844 .await
4845 }
4846}
4847pub struct CallUpgradeGift<'a> {
4848 bot: &'a Bot,
4849 business_connection_id: &'a str,
4850 owned_gift_id: &'a str,
4851 keep_original_details: Option<bool>,
4852 star_count: Option<i64>,
4853}
4854impl<'a> CallUpgradeGift<'a> {
4855 #[allow(rustdoc::invalid_html_tags)]
4856 #[doc = "Unique identifier of the business connection"]
4857 #[allow(clippy::needless_lifetimes)]
4858 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
4859 self.business_connection_id = business_connection_id;
4860 self
4861 }
4862 #[allow(clippy::needless_lifetimes)]
4863 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
4864 &self.business_connection_id
4865 }
4866 #[allow(rustdoc::invalid_html_tags)]
4867 #[doc = "Unique identifier of the regular gift that should be upgraded to a unique one"]
4868 #[allow(clippy::needless_lifetimes)]
4869 pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
4870 self.owned_gift_id = owned_gift_id;
4871 self
4872 }
4873 #[allow(clippy::needless_lifetimes)]
4874 pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
4875 &self.owned_gift_id
4876 }
4877 #[allow(rustdoc::invalid_html_tags)]
4878 #[doc = "Pass True to keep the original gift text, sender and receiver in the upgraded gift"]
4879 #[allow(clippy::needless_lifetimes)]
4880 pub fn keep_original_details(mut self, keep_original_details: bool) -> Self {
4881 self.keep_original_details = Some(keep_original_details);
4882 self
4883 }
4884 #[allow(clippy::needless_lifetimes)]
4885 pub fn get_keep_original_details(&'a self) -> &'a Option<bool> {
4886 &self.keep_original_details
4887 }
4888 #[allow(rustdoc::invalid_html_tags)]
4889 #[doc = "The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed."]
4890 #[allow(clippy::needless_lifetimes)]
4891 pub fn star_count(mut self, star_count: i64) -> Self {
4892 self.star_count = Some(star_count);
4893 self
4894 }
4895 #[allow(clippy::needless_lifetimes)]
4896 pub fn get_star_count(&'a self) -> &'a Option<i64> {
4897 &self.star_count
4898 }
4899 pub async fn build(self) -> BotResult<bool> {
4900 self.bot
4901 .upgrade_gift(
4902 self.business_connection_id,
4903 self.owned_gift_id,
4904 self.keep_original_details,
4905 self.star_count,
4906 )
4907 .await
4908 }
4909}
4910pub struct CallDeleteMessage<'a, V> {
4911 bot: &'a Bot,
4912 chat_id: V,
4913 message_id: i64,
4914}
4915impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteMessage<'a, V> {
4916 #[allow(rustdoc::invalid_html_tags)]
4917 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
4918 #[allow(clippy::needless_lifetimes)]
4919 pub fn chat_id(mut self, chat_id: V) -> Self {
4920 self.chat_id = chat_id;
4921 self
4922 }
4923 #[allow(clippy::needless_lifetimes)]
4924 pub fn get_chat_id(&'a self) -> &'a V {
4925 &self.chat_id
4926 }
4927 #[allow(rustdoc::invalid_html_tags)]
4928 #[doc = "Identifier of the message to delete"]
4929 #[allow(clippy::needless_lifetimes)]
4930 pub fn message_id(mut self, message_id: i64) -> Self {
4931 self.message_id = message_id;
4932 self
4933 }
4934 #[allow(clippy::needless_lifetimes)]
4935 pub fn get_message_id(&'a self) -> &'a i64 {
4936 &self.message_id
4937 }
4938 pub async fn build(self) -> BotResult<bool> {
4939 self.bot.delete_message(self.chat_id, self.message_id).await
4940 }
4941}
4942pub struct CallGetUserChatBoosts<'a, V> {
4943 bot: &'a Bot,
4944 chat_id: V,
4945 user_id: i64,
4946}
4947impl<'a, V: Into<ChatHandle> + Serialize> CallGetUserChatBoosts<'a, V> {
4948 #[allow(rustdoc::invalid_html_tags)]
4949 #[doc = "Unique identifier for the chat or username of the channel (in the format @channelusername)"]
4950 #[allow(clippy::needless_lifetimes)]
4951 pub fn chat_id(mut self, chat_id: V) -> Self {
4952 self.chat_id = chat_id;
4953 self
4954 }
4955 #[allow(clippy::needless_lifetimes)]
4956 pub fn get_chat_id(&'a self) -> &'a V {
4957 &self.chat_id
4958 }
4959 #[allow(rustdoc::invalid_html_tags)]
4960 #[doc = "Unique identifier of the target user"]
4961 #[allow(clippy::needless_lifetimes)]
4962 pub fn user_id(mut self, user_id: i64) -> Self {
4963 self.user_id = user_id;
4964 self
4965 }
4966 #[allow(clippy::needless_lifetimes)]
4967 pub fn get_user_id(&'a self) -> &'a i64 {
4968 &self.user_id
4969 }
4970 pub async fn build(self) -> BotResult<UserChatBoosts> {
4971 self.bot
4972 .get_user_chat_boosts(self.chat_id, self.user_id)
4973 .await
4974 }
4975}
4976pub struct CallGiftPremiumSubscription<'a> {
4977 bot: &'a Bot,
4978 user_id: i64,
4979 month_count: i64,
4980 star_count: i64,
4981 text: Option<&'a str>,
4982 text_parse_mode: Option<&'a str>,
4983 text_entities: Option<&'a Vec<MessageEntity>>,
4984}
4985impl<'a> CallGiftPremiumSubscription<'a> {
4986 #[allow(rustdoc::invalid_html_tags)]
4987 #[doc = "Unique identifier of the target user who will receive a Telegram Premium subscription"]
4988 #[allow(clippy::needless_lifetimes)]
4989 pub fn user_id(mut self, user_id: i64) -> Self {
4990 self.user_id = user_id;
4991 self
4992 }
4993 #[allow(clippy::needless_lifetimes)]
4994 pub fn get_user_id(&'a self) -> &'a i64 {
4995 &self.user_id
4996 }
4997 #[allow(rustdoc::invalid_html_tags)]
4998 #[doc = "Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12"]
4999 #[allow(clippy::needless_lifetimes)]
5000 pub fn month_count(mut self, month_count: i64) -> Self {
5001 self.month_count = month_count;
5002 self
5003 }
5004 #[allow(clippy::needless_lifetimes)]
5005 pub fn get_month_count(&'a self) -> &'a i64 {
5006 &self.month_count
5007 }
5008 #[allow(rustdoc::invalid_html_tags)]
5009 #[doc = "Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months"]
5010 #[allow(clippy::needless_lifetimes)]
5011 pub fn star_count(mut self, star_count: i64) -> Self {
5012 self.star_count = star_count;
5013 self
5014 }
5015 #[allow(clippy::needless_lifetimes)]
5016 pub fn get_star_count(&'a self) -> &'a i64 {
5017 &self.star_count
5018 }
5019 #[allow(rustdoc::invalid_html_tags)]
5020 #[doc = "Text that will be shown along with the service message about the subscription; 0-128 characters"]
5021 #[allow(clippy::needless_lifetimes)]
5022 pub fn text(mut self, text: &'a str) -> Self {
5023 self.text = Some(text);
5024 self
5025 }
5026 #[allow(clippy::needless_lifetimes)]
5027 pub fn get_text(&'a self) -> &'a Option<&'a str> {
5028 &self.text
5029 }
5030 #[allow(rustdoc::invalid_html_tags)]
5031 #[doc = "Mode for parsing entities in the text. See formatting options for more details. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", and \"custom_emoji\" are ignored."]
5032 #[allow(clippy::needless_lifetimes)]
5033 pub fn text_parse_mode(mut self, text_parse_mode: &'a str) -> Self {
5034 self.text_parse_mode = Some(text_parse_mode);
5035 self
5036 }
5037 #[allow(clippy::needless_lifetimes)]
5038 pub fn get_text_parse_mode(&'a self) -> &'a Option<&'a str> {
5039 &self.text_parse_mode
5040 }
5041 #[allow(rustdoc::invalid_html_tags)]
5042 #[doc = "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", and \"custom_emoji\" are ignored."]
5043 #[allow(clippy::needless_lifetimes)]
5044 pub fn text_entities(mut self, text_entities: &'a Vec<MessageEntity>) -> Self {
5045 self.text_entities = Some(text_entities);
5046 self
5047 }
5048 #[allow(clippy::needless_lifetimes)]
5049 pub fn get_text_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
5050 &self.text_entities
5051 }
5052 pub async fn build(self) -> BotResult<bool> {
5053 self.bot
5054 .gift_premium_subscription(
5055 self.user_id,
5056 self.month_count,
5057 self.star_count,
5058 self.text,
5059 self.text_parse_mode,
5060 self.text_entities,
5061 )
5062 .await
5063 }
5064}
5065pub struct CallLogOut<'a> {
5066 bot: &'a Bot,
5067}
5068impl<'a> CallLogOut<'a> {
5069 pub async fn build(self) -> BotResult<bool> {
5070 self.bot.log_out().await
5071 }
5072}
5073pub struct CallConvertGiftToStars<'a> {
5074 bot: &'a Bot,
5075 business_connection_id: &'a str,
5076 owned_gift_id: &'a str,
5077}
5078impl<'a> CallConvertGiftToStars<'a> {
5079 #[allow(rustdoc::invalid_html_tags)]
5080 #[doc = "Unique identifier of the business connection"]
5081 #[allow(clippy::needless_lifetimes)]
5082 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
5083 self.business_connection_id = business_connection_id;
5084 self
5085 }
5086 #[allow(clippy::needless_lifetimes)]
5087 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
5088 &self.business_connection_id
5089 }
5090 #[allow(rustdoc::invalid_html_tags)]
5091 #[doc = "Unique identifier of the regular gift that should be converted to Telegram Stars"]
5092 #[allow(clippy::needless_lifetimes)]
5093 pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
5094 self.owned_gift_id = owned_gift_id;
5095 self
5096 }
5097 #[allow(clippy::needless_lifetimes)]
5098 pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
5099 &self.owned_gift_id
5100 }
5101 pub async fn build(self) -> BotResult<bool> {
5102 self.bot
5103 .convert_gift_to_stars(self.business_connection_id, self.owned_gift_id)
5104 .await
5105 }
5106}
5107pub struct CallCopyMessage<'a, V> {
5108 bot: &'a Bot,
5109 chat_id: V,
5110 message_thread_id: Option<i64>,
5111 direct_messages_topic_id: Option<i64>,
5112 from_chat_id: V,
5113 message_id: i64,
5114 video_start_timestamp: Option<i64>,
5115 caption: Option<&'a str>,
5116 parse_mode: Option<&'a str>,
5117 caption_entities: Option<&'a Vec<MessageEntity>>,
5118 show_caption_above_media: Option<bool>,
5119 disable_notification: Option<bool>,
5120 protect_content: Option<bool>,
5121 allow_paid_broadcast: Option<bool>,
5122 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
5123 reply_parameters: Option<&'a ReplyParameters>,
5124 reply_markup: Option<&'a EReplyMarkup>,
5125}
5126impl<'a, V: Into<ChatHandle> + Serialize> CallCopyMessage<'a, V> {
5127 #[allow(rustdoc::invalid_html_tags)]
5128 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
5129 #[allow(clippy::needless_lifetimes)]
5130 pub fn chat_id(mut self, chat_id: V) -> Self {
5131 self.chat_id = chat_id;
5132 self
5133 }
5134 #[allow(clippy::needless_lifetimes)]
5135 pub fn get_chat_id(&'a self) -> &'a V {
5136 &self.chat_id
5137 }
5138 #[allow(rustdoc::invalid_html_tags)]
5139 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
5140 #[allow(clippy::needless_lifetimes)]
5141 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
5142 self.message_thread_id = Some(message_thread_id);
5143 self
5144 }
5145 #[allow(clippy::needless_lifetimes)]
5146 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
5147 &self.message_thread_id
5148 }
5149 #[allow(rustdoc::invalid_html_tags)]
5150 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
5151 #[allow(clippy::needless_lifetimes)]
5152 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
5153 self.direct_messages_topic_id = Some(direct_messages_topic_id);
5154 self
5155 }
5156 #[allow(clippy::needless_lifetimes)]
5157 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
5158 &self.direct_messages_topic_id
5159 }
5160 #[allow(rustdoc::invalid_html_tags)]
5161 #[doc = "Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)"]
5162 #[allow(clippy::needless_lifetimes)]
5163 pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
5164 self.from_chat_id = from_chat_id;
5165 self
5166 }
5167 #[allow(clippy::needless_lifetimes)]
5168 pub fn get_from_chat_id(&'a self) -> &'a V {
5169 &self.from_chat_id
5170 }
5171 #[allow(rustdoc::invalid_html_tags)]
5172 #[doc = "Message identifier in the chat specified in from_chat_id"]
5173 #[allow(clippy::needless_lifetimes)]
5174 pub fn message_id(mut self, message_id: i64) -> Self {
5175 self.message_id = message_id;
5176 self
5177 }
5178 #[allow(clippy::needless_lifetimes)]
5179 pub fn get_message_id(&'a self) -> &'a i64 {
5180 &self.message_id
5181 }
5182 #[allow(rustdoc::invalid_html_tags)]
5183 #[doc = "New start timestamp for the copied video in the message"]
5184 #[allow(clippy::needless_lifetimes)]
5185 pub fn video_start_timestamp(mut self, video_start_timestamp: i64) -> Self {
5186 self.video_start_timestamp = Some(video_start_timestamp);
5187 self
5188 }
5189 #[allow(clippy::needless_lifetimes)]
5190 pub fn get_video_start_timestamp(&'a self) -> &'a Option<i64> {
5191 &self.video_start_timestamp
5192 }
5193 #[allow(rustdoc::invalid_html_tags)]
5194 #[doc = "New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"]
5195 #[allow(clippy::needless_lifetimes)]
5196 pub fn caption(mut self, caption: &'a str) -> Self {
5197 self.caption = Some(caption);
5198 self
5199 }
5200 #[allow(clippy::needless_lifetimes)]
5201 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
5202 &self.caption
5203 }
5204 #[allow(rustdoc::invalid_html_tags)]
5205 #[doc = "Mode for parsing entities in the new caption. See formatting options for more details."]
5206 #[allow(clippy::needless_lifetimes)]
5207 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
5208 self.parse_mode = Some(parse_mode);
5209 self
5210 }
5211 #[allow(clippy::needless_lifetimes)]
5212 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
5213 &self.parse_mode
5214 }
5215 #[allow(rustdoc::invalid_html_tags)]
5216 #[doc = "A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode"]
5217 #[allow(clippy::needless_lifetimes)]
5218 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
5219 self.caption_entities = Some(caption_entities);
5220 self
5221 }
5222 #[allow(clippy::needless_lifetimes)]
5223 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
5224 &self.caption_entities
5225 }
5226 #[allow(rustdoc::invalid_html_tags)]
5227 #[doc = "Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified."]
5228 #[allow(clippy::needless_lifetimes)]
5229 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
5230 self.show_caption_above_media = Some(show_caption_above_media);
5231 self
5232 }
5233 #[allow(clippy::needless_lifetimes)]
5234 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
5235 &self.show_caption_above_media
5236 }
5237 #[allow(rustdoc::invalid_html_tags)]
5238 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
5239 #[allow(clippy::needless_lifetimes)]
5240 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
5241 self.disable_notification = Some(disable_notification);
5242 self
5243 }
5244 #[allow(clippy::needless_lifetimes)]
5245 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
5246 &self.disable_notification
5247 }
5248 #[allow(rustdoc::invalid_html_tags)]
5249 #[doc = "Protects the contents of the sent message from forwarding and saving"]
5250 #[allow(clippy::needless_lifetimes)]
5251 pub fn protect_content(mut self, protect_content: bool) -> Self {
5252 self.protect_content = Some(protect_content);
5253 self
5254 }
5255 #[allow(clippy::needless_lifetimes)]
5256 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
5257 &self.protect_content
5258 }
5259 #[allow(rustdoc::invalid_html_tags)]
5260 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
5261 #[allow(clippy::needless_lifetimes)]
5262 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
5263 self.allow_paid_broadcast = Some(allow_paid_broadcast);
5264 self
5265 }
5266 #[allow(clippy::needless_lifetimes)]
5267 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
5268 &self.allow_paid_broadcast
5269 }
5270 #[allow(rustdoc::invalid_html_tags)]
5271 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
5272 #[allow(clippy::needless_lifetimes)]
5273 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
5274 where
5275 T: Into<&'a SuggestedPostParameters>,
5276 {
5277 self.suggested_post_parameters = Some(suggested_post_parameters.into());
5278 self
5279 }
5280 #[allow(clippy::needless_lifetimes)]
5281 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
5282 &self.suggested_post_parameters
5283 }
5284 #[allow(rustdoc::invalid_html_tags)]
5285 #[doc = "Description of the message to reply to"]
5286 #[allow(clippy::needless_lifetimes)]
5287 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
5288 where
5289 T: Into<&'a ReplyParameters>,
5290 {
5291 self.reply_parameters = Some(reply_parameters.into());
5292 self
5293 }
5294 #[allow(clippy::needless_lifetimes)]
5295 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
5296 &self.reply_parameters
5297 }
5298 #[allow(rustdoc::invalid_html_tags)]
5299 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
5300 #[allow(clippy::needless_lifetimes)]
5301 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
5302 where
5303 T: Into<&'a EReplyMarkup>,
5304 {
5305 self.reply_markup = Some(reply_markup.into());
5306 self
5307 }
5308 #[allow(clippy::needless_lifetimes)]
5309 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
5310 &self.reply_markup
5311 }
5312 pub async fn build(self) -> BotResult<MessageId> {
5313 self.bot
5314 .copy_message(
5315 self.chat_id,
5316 self.message_thread_id,
5317 self.direct_messages_topic_id,
5318 self.from_chat_id,
5319 self.message_id,
5320 self.video_start_timestamp,
5321 self.caption,
5322 self.parse_mode,
5323 self.caption_entities,
5324 self.show_caption_above_media,
5325 self.disable_notification,
5326 self.protect_content,
5327 self.allow_paid_broadcast,
5328 self.suggested_post_parameters,
5329 self.reply_parameters,
5330 self.reply_markup,
5331 )
5332 .await
5333 }
5334}
5335pub struct CallEditForumTopic<'a, V> {
5336 bot: &'a Bot,
5337 chat_id: V,
5338 message_thread_id: i64,
5339 name: Option<&'a str>,
5340 icon_custom_emoji_id: Option<&'a str>,
5341}
5342impl<'a, V: Into<ChatHandle> + Serialize> CallEditForumTopic<'a, V> {
5343 #[allow(rustdoc::invalid_html_tags)]
5344 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
5345 #[allow(clippy::needless_lifetimes)]
5346 pub fn chat_id(mut self, chat_id: V) -> Self {
5347 self.chat_id = chat_id;
5348 self
5349 }
5350 #[allow(clippy::needless_lifetimes)]
5351 pub fn get_chat_id(&'a self) -> &'a V {
5352 &self.chat_id
5353 }
5354 #[allow(rustdoc::invalid_html_tags)]
5355 #[doc = "Unique identifier for the target message thread of the forum topic"]
5356 #[allow(clippy::needless_lifetimes)]
5357 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
5358 self.message_thread_id = message_thread_id;
5359 self
5360 }
5361 #[allow(clippy::needless_lifetimes)]
5362 pub fn get_message_thread_id(&'a self) -> &'a i64 {
5363 &self.message_thread_id
5364 }
5365 #[allow(rustdoc::invalid_html_tags)]
5366 #[doc = "New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept"]
5367 #[allow(clippy::needless_lifetimes)]
5368 pub fn name(mut self, name: &'a str) -> Self {
5369 self.name = Some(name);
5370 self
5371 }
5372 #[allow(clippy::needless_lifetimes)]
5373 pub fn get_name(&'a self) -> &'a Option<&'a str> {
5374 &self.name
5375 }
5376 #[allow(rustdoc::invalid_html_tags)]
5377 #[doc = "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"]
5378 #[allow(clippy::needless_lifetimes)]
5379 pub fn icon_custom_emoji_id(mut self, icon_custom_emoji_id: &'a str) -> Self {
5380 self.icon_custom_emoji_id = Some(icon_custom_emoji_id);
5381 self
5382 }
5383 #[allow(clippy::needless_lifetimes)]
5384 pub fn get_icon_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
5385 &self.icon_custom_emoji_id
5386 }
5387 pub async fn build(self) -> BotResult<bool> {
5388 self.bot
5389 .edit_forum_topic(
5390 self.chat_id,
5391 self.message_thread_id,
5392 self.name,
5393 self.icon_custom_emoji_id,
5394 )
5395 .await
5396 }
5397}
5398pub struct CallSetBusinessAccountBio<'a> {
5399 bot: &'a Bot,
5400 business_connection_id: &'a str,
5401 bio: Option<&'a str>,
5402}
5403impl<'a> CallSetBusinessAccountBio<'a> {
5404 #[allow(rustdoc::invalid_html_tags)]
5405 #[doc = "Unique identifier of the business connection"]
5406 #[allow(clippy::needless_lifetimes)]
5407 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
5408 self.business_connection_id = business_connection_id;
5409 self
5410 }
5411 #[allow(clippy::needless_lifetimes)]
5412 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
5413 &self.business_connection_id
5414 }
5415 #[allow(rustdoc::invalid_html_tags)]
5416 #[doc = "The new value of the bio for the business account; 0-140 characters"]
5417 #[allow(clippy::needless_lifetimes)]
5418 pub fn bio(mut self, bio: &'a str) -> Self {
5419 self.bio = Some(bio);
5420 self
5421 }
5422 #[allow(clippy::needless_lifetimes)]
5423 pub fn get_bio(&'a self) -> &'a Option<&'a str> {
5424 &self.bio
5425 }
5426 pub async fn build(self) -> BotResult<bool> {
5427 self.bot
5428 .set_business_account_bio(self.business_connection_id, self.bio)
5429 .await
5430 }
5431}
5432pub struct CallGetChat<'a, V> {
5433 bot: &'a Bot,
5434 chat_id: V,
5435}
5436impl<'a, V: Into<ChatHandle> + Serialize> CallGetChat<'a, V> {
5437 #[allow(rustdoc::invalid_html_tags)]
5438 #[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
5439 #[allow(clippy::needless_lifetimes)]
5440 pub fn chat_id(mut self, chat_id: V) -> Self {
5441 self.chat_id = chat_id;
5442 self
5443 }
5444 #[allow(clippy::needless_lifetimes)]
5445 pub fn get_chat_id(&'a self) -> &'a V {
5446 &self.chat_id
5447 }
5448 pub async fn build(self) -> BotResult<ChatFullInfo> {
5449 self.bot.get_chat(self.chat_id).await
5450 }
5451}
5452pub struct CallEditMessageMedia<'a, V> {
5453 bot: &'a Bot,
5454 business_connection_id: Option<&'a str>,
5455 chat_id: Option<V>,
5456 message_id: Option<i64>,
5457 inline_message_id: Option<&'a str>,
5458 media: &'a InputMedia,
5459 reply_markup: Option<&'a InlineKeyboardMarkup>,
5460}
5461impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageMedia<'a, V> {
5462 #[allow(rustdoc::invalid_html_tags)]
5463 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
5464 #[allow(clippy::needless_lifetimes)]
5465 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
5466 self.business_connection_id = Some(business_connection_id);
5467 self
5468 }
5469 #[allow(clippy::needless_lifetimes)]
5470 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
5471 &self.business_connection_id
5472 }
5473 #[allow(rustdoc::invalid_html_tags)]
5474 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
5475 #[allow(clippy::needless_lifetimes)]
5476 pub fn chat_id(mut self, chat_id: V) -> Self {
5477 self.chat_id = Some(chat_id);
5478 self
5479 }
5480 #[allow(clippy::needless_lifetimes)]
5481 pub fn get_chat_id(&'a self) -> &'a Option<V> {
5482 &self.chat_id
5483 }
5484 #[allow(rustdoc::invalid_html_tags)]
5485 #[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
5486 #[allow(clippy::needless_lifetimes)]
5487 pub fn message_id(mut self, message_id: i64) -> Self {
5488 self.message_id = Some(message_id);
5489 self
5490 }
5491 #[allow(clippy::needless_lifetimes)]
5492 pub fn get_message_id(&'a self) -> &'a Option<i64> {
5493 &self.message_id
5494 }
5495 #[allow(rustdoc::invalid_html_tags)]
5496 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
5497 #[allow(clippy::needless_lifetimes)]
5498 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
5499 self.inline_message_id = Some(inline_message_id);
5500 self
5501 }
5502 #[allow(clippy::needless_lifetimes)]
5503 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
5504 &self.inline_message_id
5505 }
5506 #[allow(rustdoc::invalid_html_tags)]
5507 #[doc = "A JSON-serialized object for a new media content of the message"]
5508 #[allow(clippy::needless_lifetimes)]
5509 pub fn media<T>(mut self, media: T) -> Self
5510 where
5511 T: Into<&'a InputMedia>,
5512 {
5513 self.media = media.into();
5514 self
5515 }
5516 #[allow(clippy::needless_lifetimes)]
5517 pub fn get_media(&'a self) -> &'a &'a InputMedia {
5518 &self.media
5519 }
5520 #[allow(rustdoc::invalid_html_tags)]
5521 #[doc = "A JSON-serialized object for a new inline keyboard."]
5522 #[allow(clippy::needless_lifetimes)]
5523 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
5524 where
5525 T: Into<&'a InlineKeyboardMarkup>,
5526 {
5527 self.reply_markup = Some(reply_markup.into());
5528 self
5529 }
5530 #[allow(clippy::needless_lifetimes)]
5531 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
5532 &self.reply_markup
5533 }
5534 pub async fn build(self) -> BotResult<MessageBool> {
5535 self.bot
5536 .edit_message_media(
5537 self.business_connection_id,
5538 self.chat_id,
5539 self.message_id,
5540 self.inline_message_id,
5541 self.media,
5542 self.reply_markup,
5543 )
5544 .await
5545 }
5546}
5547pub struct CallSetGameScore<'a> {
5548 bot: &'a Bot,
5549 user_id: i64,
5550 score: i64,
5551 force: Option<bool>,
5552 disable_edit_message: Option<bool>,
5553 chat_id: Option<i64>,
5554 message_id: Option<i64>,
5555 inline_message_id: Option<&'a str>,
5556}
5557impl<'a> CallSetGameScore<'a> {
5558 #[allow(rustdoc::invalid_html_tags)]
5559 #[doc = "User identifier"]
5560 #[allow(clippy::needless_lifetimes)]
5561 pub fn user_id(mut self, user_id: i64) -> Self {
5562 self.user_id = user_id;
5563 self
5564 }
5565 #[allow(clippy::needless_lifetimes)]
5566 pub fn get_user_id(&'a self) -> &'a i64 {
5567 &self.user_id
5568 }
5569 #[allow(rustdoc::invalid_html_tags)]
5570 #[doc = "New score, must be non-negative"]
5571 #[allow(clippy::needless_lifetimes)]
5572 pub fn score(mut self, score: i64) -> Self {
5573 self.score = score;
5574 self
5575 }
5576 #[allow(clippy::needless_lifetimes)]
5577 pub fn get_score(&'a self) -> &'a i64 {
5578 &self.score
5579 }
5580 #[allow(rustdoc::invalid_html_tags)]
5581 #[doc = "Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"]
5582 #[allow(clippy::needless_lifetimes)]
5583 pub fn force(mut self, force: bool) -> Self {
5584 self.force = Some(force);
5585 self
5586 }
5587 #[allow(clippy::needless_lifetimes)]
5588 pub fn get_force(&'a self) -> &'a Option<bool> {
5589 &self.force
5590 }
5591 #[allow(rustdoc::invalid_html_tags)]
5592 #[doc = "Pass True if the game message should not be automatically edited to include the current scoreboard"]
5593 #[allow(clippy::needless_lifetimes)]
5594 pub fn disable_edit_message(mut self, disable_edit_message: bool) -> Self {
5595 self.disable_edit_message = Some(disable_edit_message);
5596 self
5597 }
5598 #[allow(clippy::needless_lifetimes)]
5599 pub fn get_disable_edit_message(&'a self) -> &'a Option<bool> {
5600 &self.disable_edit_message
5601 }
5602 #[allow(rustdoc::invalid_html_tags)]
5603 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat"]
5604 #[allow(clippy::needless_lifetimes)]
5605 pub fn chat_id(mut self, chat_id: i64) -> Self {
5606 self.chat_id = Some(chat_id);
5607 self
5608 }
5609 #[allow(clippy::needless_lifetimes)]
5610 pub fn get_chat_id(&'a self) -> &'a Option<i64> {
5611 &self.chat_id
5612 }
5613 #[allow(rustdoc::invalid_html_tags)]
5614 #[doc = "Required if inline_message_id is not specified. Identifier of the sent message"]
5615 #[allow(clippy::needless_lifetimes)]
5616 pub fn message_id(mut self, message_id: i64) -> Self {
5617 self.message_id = Some(message_id);
5618 self
5619 }
5620 #[allow(clippy::needless_lifetimes)]
5621 pub fn get_message_id(&'a self) -> &'a Option<i64> {
5622 &self.message_id
5623 }
5624 #[allow(rustdoc::invalid_html_tags)]
5625 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
5626 #[allow(clippy::needless_lifetimes)]
5627 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
5628 self.inline_message_id = Some(inline_message_id);
5629 self
5630 }
5631 #[allow(clippy::needless_lifetimes)]
5632 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
5633 &self.inline_message_id
5634 }
5635 pub async fn build(self) -> BotResult<MessageBool> {
5636 self.bot
5637 .set_game_score(
5638 self.user_id,
5639 self.score,
5640 self.force,
5641 self.disable_edit_message,
5642 self.chat_id,
5643 self.message_id,
5644 self.inline_message_id,
5645 )
5646 .await
5647 }
5648}
5649pub struct CallGetCustomEmojiStickers<'a> {
5650 bot: &'a Bot,
5651 custom_emoji_ids: &'a Vec<String>,
5652}
5653impl<'a> CallGetCustomEmojiStickers<'a> {
5654 #[allow(rustdoc::invalid_html_tags)]
5655 #[doc = "A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."]
5656 #[allow(clippy::needless_lifetimes)]
5657 pub fn custom_emoji_ids(mut self, custom_emoji_ids: &'a Vec<String>) -> Self {
5658 self.custom_emoji_ids = custom_emoji_ids;
5659 self
5660 }
5661 #[allow(clippy::needless_lifetimes)]
5662 pub fn get_custom_emoji_ids(&'a self) -> &'a &'a Vec<String> {
5663 &self.custom_emoji_ids
5664 }
5665 pub async fn build(self) -> BotResult<Vec<Sticker>> {
5666 self.bot
5667 .get_custom_emoji_stickers(self.custom_emoji_ids)
5668 .await
5669 }
5670}
5671pub struct CallSetChatAdministratorCustomTitle<'a, V> {
5672 bot: &'a Bot,
5673 chat_id: V,
5674 user_id: i64,
5675 custom_title: &'a str,
5676}
5677impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatAdministratorCustomTitle<'a, V> {
5678 #[allow(rustdoc::invalid_html_tags)]
5679 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
5680 #[allow(clippy::needless_lifetimes)]
5681 pub fn chat_id(mut self, chat_id: V) -> Self {
5682 self.chat_id = chat_id;
5683 self
5684 }
5685 #[allow(clippy::needless_lifetimes)]
5686 pub fn get_chat_id(&'a self) -> &'a V {
5687 &self.chat_id
5688 }
5689 #[allow(rustdoc::invalid_html_tags)]
5690 #[doc = "Unique identifier of the target user"]
5691 #[allow(clippy::needless_lifetimes)]
5692 pub fn user_id(mut self, user_id: i64) -> Self {
5693 self.user_id = user_id;
5694 self
5695 }
5696 #[allow(clippy::needless_lifetimes)]
5697 pub fn get_user_id(&'a self) -> &'a i64 {
5698 &self.user_id
5699 }
5700 #[allow(rustdoc::invalid_html_tags)]
5701 #[doc = "New custom title for the administrator; 0-16 characters, emoji are not allowed"]
5702 #[allow(clippy::needless_lifetimes)]
5703 pub fn custom_title(mut self, custom_title: &'a str) -> Self {
5704 self.custom_title = custom_title;
5705 self
5706 }
5707 #[allow(clippy::needless_lifetimes)]
5708 pub fn get_custom_title(&'a self) -> &'a &'a str {
5709 &self.custom_title
5710 }
5711 pub async fn build(self) -> BotResult<bool> {
5712 self.bot
5713 .set_chat_administrator_custom_title(self.chat_id, self.user_id, self.custom_title)
5714 .await
5715 }
5716}
5717pub struct CallSendGift<'a, V> {
5718 bot: &'a Bot,
5719 user_id: Option<i64>,
5720 chat_id: Option<V>,
5721 gift_id: &'a str,
5722 pay_for_upgrade: Option<bool>,
5723 text: Option<&'a str>,
5724 text_parse_mode: Option<&'a str>,
5725 text_entities: Option<&'a Vec<MessageEntity>>,
5726}
5727impl<'a, V: Into<ChatHandle> + Serialize> CallSendGift<'a, V> {
5728 #[allow(rustdoc::invalid_html_tags)]
5729 #[doc = "Required if chat_id is not specified. Unique identifier of the target user who will receive the gift."]
5730 #[allow(clippy::needless_lifetimes)]
5731 pub fn user_id(mut self, user_id: i64) -> Self {
5732 self.user_id = Some(user_id);
5733 self
5734 }
5735 #[allow(clippy::needless_lifetimes)]
5736 pub fn get_user_id(&'a self) -> &'a Option<i64> {
5737 &self.user_id
5738 }
5739 #[allow(rustdoc::invalid_html_tags)]
5740 #[doc = "Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift."]
5741 #[allow(clippy::needless_lifetimes)]
5742 pub fn chat_id(mut self, chat_id: V) -> Self {
5743 self.chat_id = Some(chat_id);
5744 self
5745 }
5746 #[allow(clippy::needless_lifetimes)]
5747 pub fn get_chat_id(&'a self) -> &'a Option<V> {
5748 &self.chat_id
5749 }
5750 #[allow(rustdoc::invalid_html_tags)]
5751 #[doc = "Identifier of the gift"]
5752 #[allow(clippy::needless_lifetimes)]
5753 pub fn gift_id(mut self, gift_id: &'a str) -> Self {
5754 self.gift_id = gift_id;
5755 self
5756 }
5757 #[allow(clippy::needless_lifetimes)]
5758 pub fn get_gift_id(&'a self) -> &'a &'a str {
5759 &self.gift_id
5760 }
5761 #[allow(rustdoc::invalid_html_tags)]
5762 #[doc = "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"]
5763 #[allow(clippy::needless_lifetimes)]
5764 pub fn pay_for_upgrade(mut self, pay_for_upgrade: bool) -> Self {
5765 self.pay_for_upgrade = Some(pay_for_upgrade);
5766 self
5767 }
5768 #[allow(clippy::needless_lifetimes)]
5769 pub fn get_pay_for_upgrade(&'a self) -> &'a Option<bool> {
5770 &self.pay_for_upgrade
5771 }
5772 #[allow(rustdoc::invalid_html_tags)]
5773 #[doc = "Text that will be shown along with the gift; 0-128 characters"]
5774 #[allow(clippy::needless_lifetimes)]
5775 pub fn text(mut self, text: &'a str) -> Self {
5776 self.text = Some(text);
5777 self
5778 }
5779 #[allow(clippy::needless_lifetimes)]
5780 pub fn get_text(&'a self) -> &'a Option<&'a str> {
5781 &self.text
5782 }
5783 #[allow(rustdoc::invalid_html_tags)]
5784 #[doc = "Mode for parsing entities in the text. See formatting options for more details. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", and \"custom_emoji\" are ignored."]
5785 #[allow(clippy::needless_lifetimes)]
5786 pub fn text_parse_mode(mut self, text_parse_mode: &'a str) -> Self {
5787 self.text_parse_mode = Some(text_parse_mode);
5788 self
5789 }
5790 #[allow(clippy::needless_lifetimes)]
5791 pub fn get_text_parse_mode(&'a self) -> &'a Option<&'a str> {
5792 &self.text_parse_mode
5793 }
5794 #[allow(rustdoc::invalid_html_tags)]
5795 #[doc = "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", and \"custom_emoji\" are ignored."]
5796 #[allow(clippy::needless_lifetimes)]
5797 pub fn text_entities(mut self, text_entities: &'a Vec<MessageEntity>) -> Self {
5798 self.text_entities = Some(text_entities);
5799 self
5800 }
5801 #[allow(clippy::needless_lifetimes)]
5802 pub fn get_text_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
5803 &self.text_entities
5804 }
5805 pub async fn build(self) -> BotResult<bool> {
5806 self.bot
5807 .send_gift(
5808 self.user_id,
5809 self.chat_id,
5810 self.gift_id,
5811 self.pay_for_upgrade,
5812 self.text,
5813 self.text_parse_mode,
5814 self.text_entities,
5815 )
5816 .await
5817 }
5818}
5819pub struct CallSendDice<'a, V> {
5820 bot: &'a Bot,
5821 business_connection_id: Option<&'a str>,
5822 chat_id: V,
5823 message_thread_id: Option<i64>,
5824 direct_messages_topic_id: Option<i64>,
5825 emoji: Option<&'a str>,
5826 disable_notification: Option<bool>,
5827 protect_content: Option<bool>,
5828 allow_paid_broadcast: Option<bool>,
5829 message_effect_id: Option<&'a str>,
5830 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
5831 reply_parameters: Option<&'a ReplyParameters>,
5832 reply_markup: Option<&'a EReplyMarkup>,
5833}
5834impl<'a, V: Into<ChatHandle> + Serialize> CallSendDice<'a, V> {
5835 #[allow(rustdoc::invalid_html_tags)]
5836 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
5837 #[allow(clippy::needless_lifetimes)]
5838 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
5839 self.business_connection_id = Some(business_connection_id);
5840 self
5841 }
5842 #[allow(clippy::needless_lifetimes)]
5843 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
5844 &self.business_connection_id
5845 }
5846 #[allow(rustdoc::invalid_html_tags)]
5847 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
5848 #[allow(clippy::needless_lifetimes)]
5849 pub fn chat_id(mut self, chat_id: V) -> Self {
5850 self.chat_id = chat_id;
5851 self
5852 }
5853 #[allow(clippy::needless_lifetimes)]
5854 pub fn get_chat_id(&'a self) -> &'a V {
5855 &self.chat_id
5856 }
5857 #[allow(rustdoc::invalid_html_tags)]
5858 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
5859 #[allow(clippy::needless_lifetimes)]
5860 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
5861 self.message_thread_id = Some(message_thread_id);
5862 self
5863 }
5864 #[allow(clippy::needless_lifetimes)]
5865 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
5866 &self.message_thread_id
5867 }
5868 #[allow(rustdoc::invalid_html_tags)]
5869 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
5870 #[allow(clippy::needless_lifetimes)]
5871 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
5872 self.direct_messages_topic_id = Some(direct_messages_topic_id);
5873 self
5874 }
5875 #[allow(clippy::needless_lifetimes)]
5876 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
5877 &self.direct_messages_topic_id
5878 }
5879 #[allow(rustdoc::invalid_html_tags)]
5880 #[doc = "Emoji on which the dice throw animation is based. Currently, must be one of \"🎲\", \"🎯\", \"🏀\", \"⚽\", \"🎳\", or \"🎰\". Dice can have values 1-6 for \"🎲\", \"🎯\" and \"🎳\", values 1-5 for \"🏀\" and \"⚽\", and values 1-64 for \"🎰\". Defaults to \"🎲\""]
5881 #[allow(clippy::needless_lifetimes)]
5882 pub fn emoji(mut self, emoji: &'a str) -> Self {
5883 self.emoji = Some(emoji);
5884 self
5885 }
5886 #[allow(clippy::needless_lifetimes)]
5887 pub fn get_emoji(&'a self) -> &'a Option<&'a str> {
5888 &self.emoji
5889 }
5890 #[allow(rustdoc::invalid_html_tags)]
5891 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
5892 #[allow(clippy::needless_lifetimes)]
5893 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
5894 self.disable_notification = Some(disable_notification);
5895 self
5896 }
5897 #[allow(clippy::needless_lifetimes)]
5898 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
5899 &self.disable_notification
5900 }
5901 #[allow(rustdoc::invalid_html_tags)]
5902 #[doc = "Protects the contents of the sent message from forwarding"]
5903 #[allow(clippy::needless_lifetimes)]
5904 pub fn protect_content(mut self, protect_content: bool) -> Self {
5905 self.protect_content = Some(protect_content);
5906 self
5907 }
5908 #[allow(clippy::needless_lifetimes)]
5909 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
5910 &self.protect_content
5911 }
5912 #[allow(rustdoc::invalid_html_tags)]
5913 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
5914 #[allow(clippy::needless_lifetimes)]
5915 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
5916 self.allow_paid_broadcast = Some(allow_paid_broadcast);
5917 self
5918 }
5919 #[allow(clippy::needless_lifetimes)]
5920 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
5921 &self.allow_paid_broadcast
5922 }
5923 #[allow(rustdoc::invalid_html_tags)]
5924 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
5925 #[allow(clippy::needless_lifetimes)]
5926 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
5927 self.message_effect_id = Some(message_effect_id);
5928 self
5929 }
5930 #[allow(clippy::needless_lifetimes)]
5931 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
5932 &self.message_effect_id
5933 }
5934 #[allow(rustdoc::invalid_html_tags)]
5935 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
5936 #[allow(clippy::needless_lifetimes)]
5937 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
5938 where
5939 T: Into<&'a SuggestedPostParameters>,
5940 {
5941 self.suggested_post_parameters = Some(suggested_post_parameters.into());
5942 self
5943 }
5944 #[allow(clippy::needless_lifetimes)]
5945 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
5946 &self.suggested_post_parameters
5947 }
5948 #[allow(rustdoc::invalid_html_tags)]
5949 #[doc = "Description of the message to reply to"]
5950 #[allow(clippy::needless_lifetimes)]
5951 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
5952 where
5953 T: Into<&'a ReplyParameters>,
5954 {
5955 self.reply_parameters = Some(reply_parameters.into());
5956 self
5957 }
5958 #[allow(clippy::needless_lifetimes)]
5959 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
5960 &self.reply_parameters
5961 }
5962 #[allow(rustdoc::invalid_html_tags)]
5963 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
5964 #[allow(clippy::needless_lifetimes)]
5965 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
5966 where
5967 T: Into<&'a EReplyMarkup>,
5968 {
5969 self.reply_markup = Some(reply_markup.into());
5970 self
5971 }
5972 #[allow(clippy::needless_lifetimes)]
5973 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
5974 &self.reply_markup
5975 }
5976 pub async fn build(self) -> BotResult<Message> {
5977 self.bot
5978 .send_dice(
5979 self.business_connection_id,
5980 self.chat_id,
5981 self.message_thread_id,
5982 self.direct_messages_topic_id,
5983 self.emoji,
5984 self.disable_notification,
5985 self.protect_content,
5986 self.allow_paid_broadcast,
5987 self.message_effect_id,
5988 self.suggested_post_parameters,
5989 self.reply_parameters,
5990 self.reply_markup,
5991 )
5992 .await
5993 }
5994}
5995pub struct CallUnpinAllGeneralForumTopicMessages<'a, V> {
5996 bot: &'a Bot,
5997 chat_id: V,
5998}
5999impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllGeneralForumTopicMessages<'a, V> {
6000 #[allow(rustdoc::invalid_html_tags)]
6001 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
6002 #[allow(clippy::needless_lifetimes)]
6003 pub fn chat_id(mut self, chat_id: V) -> Self {
6004 self.chat_id = chat_id;
6005 self
6006 }
6007 #[allow(clippy::needless_lifetimes)]
6008 pub fn get_chat_id(&'a self) -> &'a V {
6009 &self.chat_id
6010 }
6011 pub async fn build(self) -> BotResult<bool> {
6012 self.bot
6013 .unpin_all_general_forum_topic_messages(self.chat_id)
6014 .await
6015 }
6016}
6017pub struct CallGetMyCommands<'a> {
6018 bot: &'a Bot,
6019 scope: Option<&'a BotCommandScope>,
6020 language_code: Option<&'a str>,
6021}
6022impl<'a> CallGetMyCommands<'a> {
6023 #[allow(rustdoc::invalid_html_tags)]
6024 #[doc = "A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault."]
6025 #[allow(clippy::needless_lifetimes)]
6026 pub fn scope<T>(mut self, scope: T) -> Self
6027 where
6028 T: Into<&'a BotCommandScope>,
6029 {
6030 self.scope = Some(scope.into());
6031 self
6032 }
6033 #[allow(clippy::needless_lifetimes)]
6034 pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
6035 &self.scope
6036 }
6037 #[allow(rustdoc::invalid_html_tags)]
6038 #[doc = "A two-letter ISO 639-1 language code or an empty string"]
6039 #[allow(clippy::needless_lifetimes)]
6040 pub fn language_code(mut self, language_code: &'a str) -> Self {
6041 self.language_code = Some(language_code);
6042 self
6043 }
6044 #[allow(clippy::needless_lifetimes)]
6045 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
6046 &self.language_code
6047 }
6048 pub async fn build(self) -> BotResult<Vec<BotCommand>> {
6049 self.bot
6050 .get_my_commands(self.scope, self.language_code)
6051 .await
6052 }
6053}
6054pub struct CallSetBusinessAccountProfilePhoto<'a> {
6055 bot: &'a Bot,
6056 business_connection_id: &'a str,
6057 photo: &'a InputProfilePhoto,
6058 is_public: Option<bool>,
6059}
6060impl<'a> CallSetBusinessAccountProfilePhoto<'a> {
6061 #[allow(rustdoc::invalid_html_tags)]
6062 #[doc = "Unique identifier of the business connection"]
6063 #[allow(clippy::needless_lifetimes)]
6064 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
6065 self.business_connection_id = business_connection_id;
6066 self
6067 }
6068 #[allow(clippy::needless_lifetimes)]
6069 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
6070 &self.business_connection_id
6071 }
6072 #[allow(rustdoc::invalid_html_tags)]
6073 #[doc = "The new profile photo to set"]
6074 #[allow(clippy::needless_lifetimes)]
6075 pub fn photo<T>(mut self, photo: T) -> Self
6076 where
6077 T: Into<&'a InputProfilePhoto>,
6078 {
6079 self.photo = photo.into();
6080 self
6081 }
6082 #[allow(clippy::needless_lifetimes)]
6083 pub fn get_photo(&'a self) -> &'a &'a InputProfilePhoto {
6084 &self.photo
6085 }
6086 #[allow(rustdoc::invalid_html_tags)]
6087 #[doc = "Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo."]
6088 #[allow(clippy::needless_lifetimes)]
6089 pub fn is_public(mut self, is_public: bool) -> Self {
6090 self.is_public = Some(is_public);
6091 self
6092 }
6093 #[allow(clippy::needless_lifetimes)]
6094 pub fn get_is_public(&'a self) -> &'a Option<bool> {
6095 &self.is_public
6096 }
6097 pub async fn build(self) -> BotResult<bool> {
6098 self.bot
6099 .set_business_account_profile_photo(
6100 self.business_connection_id,
6101 self.photo,
6102 self.is_public,
6103 )
6104 .await
6105 }
6106}
6107pub struct CallCreateChatInviteLink<'a, V> {
6108 bot: &'a Bot,
6109 chat_id: V,
6110 name: Option<&'a str>,
6111 expire_date: Option<i64>,
6112 member_limit: Option<i64>,
6113 creates_join_request: Option<bool>,
6114}
6115impl<'a, V: Into<ChatHandle> + Serialize> CallCreateChatInviteLink<'a, V> {
6116 #[allow(rustdoc::invalid_html_tags)]
6117 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6118 #[allow(clippy::needless_lifetimes)]
6119 pub fn chat_id(mut self, chat_id: V) -> Self {
6120 self.chat_id = chat_id;
6121 self
6122 }
6123 #[allow(clippy::needless_lifetimes)]
6124 pub fn get_chat_id(&'a self) -> &'a V {
6125 &self.chat_id
6126 }
6127 #[allow(rustdoc::invalid_html_tags)]
6128 #[doc = "Invite link name; 0-32 characters"]
6129 #[allow(clippy::needless_lifetimes)]
6130 pub fn name(mut self, name: &'a str) -> Self {
6131 self.name = Some(name);
6132 self
6133 }
6134 #[allow(clippy::needless_lifetimes)]
6135 pub fn get_name(&'a self) -> &'a Option<&'a str> {
6136 &self.name
6137 }
6138 #[allow(rustdoc::invalid_html_tags)]
6139 #[doc = "Point in time (Unix timestamp) when the link will expire"]
6140 #[allow(clippy::needless_lifetimes)]
6141 pub fn expire_date(mut self, expire_date: i64) -> Self {
6142 self.expire_date = Some(expire_date);
6143 self
6144 }
6145 #[allow(clippy::needless_lifetimes)]
6146 pub fn get_expire_date(&'a self) -> &'a Option<i64> {
6147 &self.expire_date
6148 }
6149 #[allow(rustdoc::invalid_html_tags)]
6150 #[doc = "The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"]
6151 #[allow(clippy::needless_lifetimes)]
6152 pub fn member_limit(mut self, member_limit: i64) -> Self {
6153 self.member_limit = Some(member_limit);
6154 self
6155 }
6156 #[allow(clippy::needless_lifetimes)]
6157 pub fn get_member_limit(&'a self) -> &'a Option<i64> {
6158 &self.member_limit
6159 }
6160 #[allow(rustdoc::invalid_html_tags)]
6161 #[doc = "True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified"]
6162 #[allow(clippy::needless_lifetimes)]
6163 pub fn creates_join_request(mut self, creates_join_request: bool) -> Self {
6164 self.creates_join_request = Some(creates_join_request);
6165 self
6166 }
6167 #[allow(clippy::needless_lifetimes)]
6168 pub fn get_creates_join_request(&'a self) -> &'a Option<bool> {
6169 &self.creates_join_request
6170 }
6171 pub async fn build(self) -> BotResult<ChatInviteLink> {
6172 self.bot
6173 .create_chat_invite_link(
6174 self.chat_id,
6175 self.name,
6176 self.expire_date,
6177 self.member_limit,
6178 self.creates_join_request,
6179 )
6180 .await
6181 }
6182}
6183pub struct CallDeleteStickerFromSet<'a> {
6184 bot: &'a Bot,
6185 sticker: &'a str,
6186}
6187impl<'a> CallDeleteStickerFromSet<'a> {
6188 #[allow(rustdoc::invalid_html_tags)]
6189 #[doc = "File identifier of the sticker"]
6190 #[allow(clippy::needless_lifetimes)]
6191 pub fn sticker(mut self, sticker: &'a str) -> Self {
6192 self.sticker = sticker;
6193 self
6194 }
6195 #[allow(clippy::needless_lifetimes)]
6196 pub fn get_sticker(&'a self) -> &'a &'a str {
6197 &self.sticker
6198 }
6199 pub async fn build(self) -> BotResult<bool> {
6200 self.bot.delete_sticker_from_set(self.sticker).await
6201 }
6202}
6203pub struct CallGetMyDescription<'a> {
6204 bot: &'a Bot,
6205 language_code: Option<&'a str>,
6206}
6207impl<'a> CallGetMyDescription<'a> {
6208 #[allow(rustdoc::invalid_html_tags)]
6209 #[doc = "A two-letter ISO 639-1 language code or an empty string"]
6210 #[allow(clippy::needless_lifetimes)]
6211 pub fn language_code(mut self, language_code: &'a str) -> Self {
6212 self.language_code = Some(language_code);
6213 self
6214 }
6215 #[allow(clippy::needless_lifetimes)]
6216 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
6217 &self.language_code
6218 }
6219 pub async fn build(self) -> BotResult<BotDescription> {
6220 self.bot.get_my_description(self.language_code).await
6221 }
6222}
6223pub struct CallGetMyStarBalance<'a> {
6224 bot: &'a Bot,
6225}
6226impl<'a> CallGetMyStarBalance<'a> {
6227 pub async fn build(self) -> BotResult<StarAmount> {
6228 self.bot.get_my_star_balance().await
6229 }
6230}
6231pub struct CallSendMediaGroup<'a, V> {
6232 bot: &'a Bot,
6233 business_connection_id: Option<&'a str>,
6234 chat_id: V,
6235 message_thread_id: Option<i64>,
6236 direct_messages_topic_id: Option<i64>,
6237 media: &'a Vec<EMedia>,
6238 disable_notification: Option<bool>,
6239 protect_content: Option<bool>,
6240 allow_paid_broadcast: Option<bool>,
6241 message_effect_id: Option<&'a str>,
6242 reply_parameters: Option<&'a ReplyParameters>,
6243}
6244impl<'a, V: Into<ChatHandle> + Serialize> CallSendMediaGroup<'a, V> {
6245 #[allow(rustdoc::invalid_html_tags)]
6246 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
6247 #[allow(clippy::needless_lifetimes)]
6248 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
6249 self.business_connection_id = Some(business_connection_id);
6250 self
6251 }
6252 #[allow(clippy::needless_lifetimes)]
6253 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
6254 &self.business_connection_id
6255 }
6256 #[allow(rustdoc::invalid_html_tags)]
6257 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6258 #[allow(clippy::needless_lifetimes)]
6259 pub fn chat_id(mut self, chat_id: V) -> Self {
6260 self.chat_id = chat_id;
6261 self
6262 }
6263 #[allow(clippy::needless_lifetimes)]
6264 pub fn get_chat_id(&'a self) -> &'a V {
6265 &self.chat_id
6266 }
6267 #[allow(rustdoc::invalid_html_tags)]
6268 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
6269 #[allow(clippy::needless_lifetimes)]
6270 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
6271 self.message_thread_id = Some(message_thread_id);
6272 self
6273 }
6274 #[allow(clippy::needless_lifetimes)]
6275 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
6276 &self.message_thread_id
6277 }
6278 #[allow(rustdoc::invalid_html_tags)]
6279 #[doc = "Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"]
6280 #[allow(clippy::needless_lifetimes)]
6281 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
6282 self.direct_messages_topic_id = Some(direct_messages_topic_id);
6283 self
6284 }
6285 #[allow(clippy::needless_lifetimes)]
6286 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
6287 &self.direct_messages_topic_id
6288 }
6289 #[allow(rustdoc::invalid_html_tags)]
6290 #[doc = "A JSON-serialized array describing messages to be sent, must include 2-10 items"]
6291 #[allow(clippy::needless_lifetimes)]
6292 pub fn media(mut self, media: &'a Vec<EMedia>) -> Self {
6293 self.media = media;
6294 self
6295 }
6296 #[allow(clippy::needless_lifetimes)]
6297 pub fn get_media(&'a self) -> &'a &'a Vec<EMedia> {
6298 &self.media
6299 }
6300 #[allow(rustdoc::invalid_html_tags)]
6301 #[doc = "Sends messages silently. Users will receive a notification with no sound."]
6302 #[allow(clippy::needless_lifetimes)]
6303 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
6304 self.disable_notification = Some(disable_notification);
6305 self
6306 }
6307 #[allow(clippy::needless_lifetimes)]
6308 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
6309 &self.disable_notification
6310 }
6311 #[allow(rustdoc::invalid_html_tags)]
6312 #[doc = "Protects the contents of the sent messages from forwarding and saving"]
6313 #[allow(clippy::needless_lifetimes)]
6314 pub fn protect_content(mut self, protect_content: bool) -> Self {
6315 self.protect_content = Some(protect_content);
6316 self
6317 }
6318 #[allow(clippy::needless_lifetimes)]
6319 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
6320 &self.protect_content
6321 }
6322 #[allow(rustdoc::invalid_html_tags)]
6323 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
6324 #[allow(clippy::needless_lifetimes)]
6325 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
6326 self.allow_paid_broadcast = Some(allow_paid_broadcast);
6327 self
6328 }
6329 #[allow(clippy::needless_lifetimes)]
6330 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
6331 &self.allow_paid_broadcast
6332 }
6333 #[allow(rustdoc::invalid_html_tags)]
6334 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
6335 #[allow(clippy::needless_lifetimes)]
6336 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
6337 self.message_effect_id = Some(message_effect_id);
6338 self
6339 }
6340 #[allow(clippy::needless_lifetimes)]
6341 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
6342 &self.message_effect_id
6343 }
6344 #[allow(rustdoc::invalid_html_tags)]
6345 #[doc = "Description of the message to reply to"]
6346 #[allow(clippy::needless_lifetimes)]
6347 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
6348 where
6349 T: Into<&'a ReplyParameters>,
6350 {
6351 self.reply_parameters = Some(reply_parameters.into());
6352 self
6353 }
6354 #[allow(clippy::needless_lifetimes)]
6355 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
6356 &self.reply_parameters
6357 }
6358 pub async fn build(self) -> BotResult<Vec<Message>> {
6359 self.bot
6360 .send_media_group(
6361 self.business_connection_id,
6362 self.chat_id,
6363 self.message_thread_id,
6364 self.direct_messages_topic_id,
6365 self.media,
6366 self.disable_notification,
6367 self.protect_content,
6368 self.allow_paid_broadcast,
6369 self.message_effect_id,
6370 self.reply_parameters,
6371 )
6372 .await
6373 }
6374}
6375pub struct CallGetWebhookInfo<'a> {
6376 bot: &'a Bot,
6377}
6378impl<'a> CallGetWebhookInfo<'a> {
6379 pub async fn build(self) -> BotResult<WebhookInfo> {
6380 self.bot.get_webhook_info().await
6381 }
6382}
6383pub struct CallGetChatMemberCount<'a, V> {
6384 bot: &'a Bot,
6385 chat_id: V,
6386}
6387impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatMemberCount<'a, V> {
6388 #[allow(rustdoc::invalid_html_tags)]
6389 #[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
6390 #[allow(clippy::needless_lifetimes)]
6391 pub fn chat_id(mut self, chat_id: V) -> Self {
6392 self.chat_id = chat_id;
6393 self
6394 }
6395 #[allow(clippy::needless_lifetimes)]
6396 pub fn get_chat_id(&'a self) -> &'a V {
6397 &self.chat_id
6398 }
6399 pub async fn build(self) -> BotResult<i64> {
6400 self.bot.get_chat_member_count(self.chat_id).await
6401 }
6402}
6403pub struct CallAnswerPreCheckoutQuery<'a> {
6404 bot: &'a Bot,
6405 pre_checkout_query_id: &'a str,
6406 ok: bool,
6407 error_message: Option<&'a str>,
6408}
6409impl<'a> CallAnswerPreCheckoutQuery<'a> {
6410 #[allow(rustdoc::invalid_html_tags)]
6411 #[doc = "Unique identifier for the query to be answered"]
6412 #[allow(clippy::needless_lifetimes)]
6413 pub fn pre_checkout_query_id(mut self, pre_checkout_query_id: &'a str) -> Self {
6414 self.pre_checkout_query_id = pre_checkout_query_id;
6415 self
6416 }
6417 #[allow(clippy::needless_lifetimes)]
6418 pub fn get_pre_checkout_query_id(&'a self) -> &'a &'a str {
6419 &self.pre_checkout_query_id
6420 }
6421 #[allow(rustdoc::invalid_html_tags)]
6422 #[doc = "Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems."]
6423 #[allow(clippy::needless_lifetimes)]
6424 pub fn ok(mut self, ok: bool) -> Self {
6425 self.ok = ok;
6426 self
6427 }
6428 #[allow(clippy::needless_lifetimes)]
6429 pub fn get_ok(&'a self) -> &'a bool {
6430 &self.ok
6431 }
6432 #[allow(rustdoc::invalid_html_tags)]
6433 #[doc = "Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. \"Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!\"). Telegram will display this message to the user."]
6434 #[allow(clippy::needless_lifetimes)]
6435 pub fn error_message(mut self, error_message: &'a str) -> Self {
6436 self.error_message = Some(error_message);
6437 self
6438 }
6439 #[allow(clippy::needless_lifetimes)]
6440 pub fn get_error_message(&'a self) -> &'a Option<&'a str> {
6441 &self.error_message
6442 }
6443 pub async fn build(self) -> BotResult<bool> {
6444 self.bot
6445 .answer_pre_checkout_query(self.pre_checkout_query_id, self.ok, self.error_message)
6446 .await
6447 }
6448}
6449pub struct CallRemoveChatVerification<'a, V> {
6450 bot: &'a Bot,
6451 chat_id: V,
6452}
6453impl<'a, V: Into<ChatHandle> + Serialize> CallRemoveChatVerification<'a, V> {
6454 #[allow(rustdoc::invalid_html_tags)]
6455 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6456 #[allow(clippy::needless_lifetimes)]
6457 pub fn chat_id(mut self, chat_id: V) -> Self {
6458 self.chat_id = chat_id;
6459 self
6460 }
6461 #[allow(clippy::needless_lifetimes)]
6462 pub fn get_chat_id(&'a self) -> &'a V {
6463 &self.chat_id
6464 }
6465 pub async fn build(self) -> BotResult<bool> {
6466 self.bot.remove_chat_verification(self.chat_id).await
6467 }
6468}
6469pub struct CallCopyMessages<'a, V> {
6470 bot: &'a Bot,
6471 chat_id: V,
6472 message_thread_id: Option<i64>,
6473 direct_messages_topic_id: Option<i64>,
6474 from_chat_id: V,
6475 message_ids: &'a Vec<i64>,
6476 disable_notification: Option<bool>,
6477 protect_content: Option<bool>,
6478 remove_caption: Option<bool>,
6479}
6480impl<'a, V: Into<ChatHandle> + Serialize> CallCopyMessages<'a, V> {
6481 #[allow(rustdoc::invalid_html_tags)]
6482 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6483 #[allow(clippy::needless_lifetimes)]
6484 pub fn chat_id(mut self, chat_id: V) -> Self {
6485 self.chat_id = chat_id;
6486 self
6487 }
6488 #[allow(clippy::needless_lifetimes)]
6489 pub fn get_chat_id(&'a self) -> &'a V {
6490 &self.chat_id
6491 }
6492 #[allow(rustdoc::invalid_html_tags)]
6493 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
6494 #[allow(clippy::needless_lifetimes)]
6495 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
6496 self.message_thread_id = Some(message_thread_id);
6497 self
6498 }
6499 #[allow(clippy::needless_lifetimes)]
6500 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
6501 &self.message_thread_id
6502 }
6503 #[allow(rustdoc::invalid_html_tags)]
6504 #[doc = "Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"]
6505 #[allow(clippy::needless_lifetimes)]
6506 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
6507 self.direct_messages_topic_id = Some(direct_messages_topic_id);
6508 self
6509 }
6510 #[allow(clippy::needless_lifetimes)]
6511 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
6512 &self.direct_messages_topic_id
6513 }
6514 #[allow(rustdoc::invalid_html_tags)]
6515 #[doc = "Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)"]
6516 #[allow(clippy::needless_lifetimes)]
6517 pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
6518 self.from_chat_id = from_chat_id;
6519 self
6520 }
6521 #[allow(clippy::needless_lifetimes)]
6522 pub fn get_from_chat_id(&'a self) -> &'a V {
6523 &self.from_chat_id
6524 }
6525 #[allow(rustdoc::invalid_html_tags)]
6526 #[doc = "A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order."]
6527 #[allow(clippy::needless_lifetimes)]
6528 pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
6529 self.message_ids = message_ids;
6530 self
6531 }
6532 #[allow(clippy::needless_lifetimes)]
6533 pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
6534 &self.message_ids
6535 }
6536 #[allow(rustdoc::invalid_html_tags)]
6537 #[doc = "Sends the messages silently. Users will receive a notification with no sound."]
6538 #[allow(clippy::needless_lifetimes)]
6539 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
6540 self.disable_notification = Some(disable_notification);
6541 self
6542 }
6543 #[allow(clippy::needless_lifetimes)]
6544 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
6545 &self.disable_notification
6546 }
6547 #[allow(rustdoc::invalid_html_tags)]
6548 #[doc = "Protects the contents of the sent messages from forwarding and saving"]
6549 #[allow(clippy::needless_lifetimes)]
6550 pub fn protect_content(mut self, protect_content: bool) -> Self {
6551 self.protect_content = Some(protect_content);
6552 self
6553 }
6554 #[allow(clippy::needless_lifetimes)]
6555 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
6556 &self.protect_content
6557 }
6558 #[allow(rustdoc::invalid_html_tags)]
6559 #[doc = "Pass True to copy the messages without their captions"]
6560 #[allow(clippy::needless_lifetimes)]
6561 pub fn remove_caption(mut self, remove_caption: bool) -> Self {
6562 self.remove_caption = Some(remove_caption);
6563 self
6564 }
6565 #[allow(clippy::needless_lifetimes)]
6566 pub fn get_remove_caption(&'a self) -> &'a Option<bool> {
6567 &self.remove_caption
6568 }
6569 pub async fn build(self) -> BotResult<Vec<MessageId>> {
6570 self.bot
6571 .copy_messages(
6572 self.chat_id,
6573 self.message_thread_id,
6574 self.direct_messages_topic_id,
6575 self.from_chat_id,
6576 self.message_ids,
6577 self.disable_notification,
6578 self.protect_content,
6579 self.remove_caption,
6580 )
6581 .await
6582 }
6583}
6584pub struct CallSetStickerSetThumbnail<'a> {
6585 bot: &'a Bot,
6586 name: &'a str,
6587 user_id: i64,
6588 thumbnail: Option<FileData>,
6589 format: &'a str,
6590}
6591impl<'a> CallSetStickerSetThumbnail<'a> {
6592 #[allow(rustdoc::invalid_html_tags)]
6593 #[doc = "Sticker set name"]
6594 #[allow(clippy::needless_lifetimes)]
6595 pub fn name(mut self, name: &'a str) -> Self {
6596 self.name = name;
6597 self
6598 }
6599 #[allow(clippy::needless_lifetimes)]
6600 pub fn get_name(&'a self) -> &'a &'a str {
6601 &self.name
6602 }
6603 #[allow(rustdoc::invalid_html_tags)]
6604 #[doc = "User identifier of the sticker set owner"]
6605 #[allow(clippy::needless_lifetimes)]
6606 pub fn user_id(mut self, user_id: i64) -> Self {
6607 self.user_id = user_id;
6608 self
6609 }
6610 #[allow(clippy::needless_lifetimes)]
6611 pub fn get_user_id(&'a self) -> &'a i64 {
6612 &self.user_id
6613 }
6614 #[allow(rustdoc::invalid_html_tags)]
6615 #[doc = "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."]
6616 #[allow(clippy::needless_lifetimes)]
6617 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
6618 self.thumbnail = Some(thumbnail);
6619 self
6620 }
6621 #[allow(clippy::needless_lifetimes)]
6622 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
6623 &self.thumbnail
6624 }
6625 #[allow(rustdoc::invalid_html_tags)]
6626 #[doc = "Format of the thumbnail, must be one of \"static\" for a .WEBP or .PNG image, \"animated\" for a .TGS animation, or \"video\" for a .WEBM video"]
6627 #[allow(clippy::needless_lifetimes)]
6628 pub fn format(mut self, format: &'a str) -> Self {
6629 self.format = format;
6630 self
6631 }
6632 #[allow(clippy::needless_lifetimes)]
6633 pub fn get_format(&'a self) -> &'a &'a str {
6634 &self.format
6635 }
6636 pub async fn build(self) -> BotResult<bool> {
6637 self.bot
6638 .set_sticker_set_thumbnail(self.name, self.user_id, self.thumbnail, self.format)
6639 .await
6640 }
6641}
6642pub struct CallDeleteMyCommands<'a> {
6643 bot: &'a Bot,
6644 scope: Option<&'a BotCommandScope>,
6645 language_code: Option<&'a str>,
6646}
6647impl<'a> CallDeleteMyCommands<'a> {
6648 #[allow(rustdoc::invalid_html_tags)]
6649 #[doc = "A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault."]
6650 #[allow(clippy::needless_lifetimes)]
6651 pub fn scope<T>(mut self, scope: T) -> Self
6652 where
6653 T: Into<&'a BotCommandScope>,
6654 {
6655 self.scope = Some(scope.into());
6656 self
6657 }
6658 #[allow(clippy::needless_lifetimes)]
6659 pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
6660 &self.scope
6661 }
6662 #[allow(rustdoc::invalid_html_tags)]
6663 #[doc = "A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"]
6664 #[allow(clippy::needless_lifetimes)]
6665 pub fn language_code(mut self, language_code: &'a str) -> Self {
6666 self.language_code = Some(language_code);
6667 self
6668 }
6669 #[allow(clippy::needless_lifetimes)]
6670 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
6671 &self.language_code
6672 }
6673 pub async fn build(self) -> BotResult<bool> {
6674 self.bot
6675 .delete_my_commands(self.scope, self.language_code)
6676 .await
6677 }
6678}
6679pub struct CallDeleteStickerSet<'a> {
6680 bot: &'a Bot,
6681 name: &'a str,
6682}
6683impl<'a> CallDeleteStickerSet<'a> {
6684 #[allow(rustdoc::invalid_html_tags)]
6685 #[doc = "Sticker set name"]
6686 #[allow(clippy::needless_lifetimes)]
6687 pub fn name(mut self, name: &'a str) -> Self {
6688 self.name = name;
6689 self
6690 }
6691 #[allow(clippy::needless_lifetimes)]
6692 pub fn get_name(&'a self) -> &'a &'a str {
6693 &self.name
6694 }
6695 pub async fn build(self) -> BotResult<bool> {
6696 self.bot.delete_sticker_set(self.name).await
6697 }
6698}
6699pub struct CallSetChatDescription<'a, V> {
6700 bot: &'a Bot,
6701 chat_id: V,
6702 description: Option<&'a str>,
6703}
6704impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatDescription<'a, V> {
6705 #[allow(rustdoc::invalid_html_tags)]
6706 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6707 #[allow(clippy::needless_lifetimes)]
6708 pub fn chat_id(mut self, chat_id: V) -> Self {
6709 self.chat_id = chat_id;
6710 self
6711 }
6712 #[allow(clippy::needless_lifetimes)]
6713 pub fn get_chat_id(&'a self) -> &'a V {
6714 &self.chat_id
6715 }
6716 #[allow(rustdoc::invalid_html_tags)]
6717 #[doc = "New chat description, 0-255 characters"]
6718 #[allow(clippy::needless_lifetimes)]
6719 pub fn description(mut self, description: &'a str) -> Self {
6720 self.description = Some(description);
6721 self
6722 }
6723 #[allow(clippy::needless_lifetimes)]
6724 pub fn get_description(&'a self) -> &'a Option<&'a str> {
6725 &self.description
6726 }
6727 pub async fn build(self) -> BotResult<bool> {
6728 self.bot
6729 .set_chat_description(self.chat_id, self.description)
6730 .await
6731 }
6732}
6733pub struct CallSetStickerEmojiList<'a> {
6734 bot: &'a Bot,
6735 sticker: &'a str,
6736 emoji_list: &'a Vec<String>,
6737}
6738impl<'a> CallSetStickerEmojiList<'a> {
6739 #[allow(rustdoc::invalid_html_tags)]
6740 #[doc = "File identifier of the sticker"]
6741 #[allow(clippy::needless_lifetimes)]
6742 pub fn sticker(mut self, sticker: &'a str) -> Self {
6743 self.sticker = sticker;
6744 self
6745 }
6746 #[allow(clippy::needless_lifetimes)]
6747 pub fn get_sticker(&'a self) -> &'a &'a str {
6748 &self.sticker
6749 }
6750 #[allow(rustdoc::invalid_html_tags)]
6751 #[doc = "A JSON-serialized list of 1-20 emoji associated with the sticker"]
6752 #[allow(clippy::needless_lifetimes)]
6753 pub fn emoji_list(mut self, emoji_list: &'a Vec<String>) -> Self {
6754 self.emoji_list = emoji_list;
6755 self
6756 }
6757 #[allow(clippy::needless_lifetimes)]
6758 pub fn get_emoji_list(&'a self) -> &'a &'a Vec<String> {
6759 &self.emoji_list
6760 }
6761 pub async fn build(self) -> BotResult<bool> {
6762 self.bot
6763 .set_sticker_emoji_list(self.sticker, self.emoji_list)
6764 .await
6765 }
6766}
6767pub struct CallSendLocation<'a, V> {
6768 bot: &'a Bot,
6769 business_connection_id: Option<&'a str>,
6770 chat_id: V,
6771 message_thread_id: Option<i64>,
6772 direct_messages_topic_id: Option<i64>,
6773 latitude: ::ordered_float::OrderedFloat<f64>,
6774 longitude: ::ordered_float::OrderedFloat<f64>,
6775 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
6776 live_period: Option<i64>,
6777 heading: Option<i64>,
6778 proximity_alert_radius: Option<i64>,
6779 disable_notification: Option<bool>,
6780 protect_content: Option<bool>,
6781 allow_paid_broadcast: Option<bool>,
6782 message_effect_id: Option<&'a str>,
6783 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
6784 reply_parameters: Option<&'a ReplyParameters>,
6785 reply_markup: Option<&'a EReplyMarkup>,
6786}
6787impl<'a, V: Into<ChatHandle> + Serialize> CallSendLocation<'a, V> {
6788 #[allow(rustdoc::invalid_html_tags)]
6789 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
6790 #[allow(clippy::needless_lifetimes)]
6791 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
6792 self.business_connection_id = Some(business_connection_id);
6793 self
6794 }
6795 #[allow(clippy::needless_lifetimes)]
6796 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
6797 &self.business_connection_id
6798 }
6799 #[allow(rustdoc::invalid_html_tags)]
6800 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
6801 #[allow(clippy::needless_lifetimes)]
6802 pub fn chat_id(mut self, chat_id: V) -> Self {
6803 self.chat_id = chat_id;
6804 self
6805 }
6806 #[allow(clippy::needless_lifetimes)]
6807 pub fn get_chat_id(&'a self) -> &'a V {
6808 &self.chat_id
6809 }
6810 #[allow(rustdoc::invalid_html_tags)]
6811 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
6812 #[allow(clippy::needless_lifetimes)]
6813 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
6814 self.message_thread_id = Some(message_thread_id);
6815 self
6816 }
6817 #[allow(clippy::needless_lifetimes)]
6818 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
6819 &self.message_thread_id
6820 }
6821 #[allow(rustdoc::invalid_html_tags)]
6822 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
6823 #[allow(clippy::needless_lifetimes)]
6824 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
6825 self.direct_messages_topic_id = Some(direct_messages_topic_id);
6826 self
6827 }
6828 #[allow(clippy::needless_lifetimes)]
6829 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
6830 &self.direct_messages_topic_id
6831 }
6832 #[allow(rustdoc::invalid_html_tags)]
6833 #[doc = "Latitude of the location"]
6834 #[allow(clippy::needless_lifetimes)]
6835 pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
6836 self.latitude = latitude;
6837 self
6838 }
6839 #[allow(clippy::needless_lifetimes)]
6840 pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
6841 &self.latitude
6842 }
6843 #[allow(rustdoc::invalid_html_tags)]
6844 #[doc = "Longitude of the location"]
6845 #[allow(clippy::needless_lifetimes)]
6846 pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
6847 self.longitude = longitude;
6848 self
6849 }
6850 #[allow(clippy::needless_lifetimes)]
6851 pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
6852 &self.longitude
6853 }
6854 #[allow(rustdoc::invalid_html_tags)]
6855 #[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
6856 #[allow(clippy::needless_lifetimes)]
6857 pub fn horizontal_accuracy(
6858 mut self,
6859 horizontal_accuracy: ::ordered_float::OrderedFloat<f64>,
6860 ) -> Self {
6861 self.horizontal_accuracy = Some(horizontal_accuracy);
6862 self
6863 }
6864 #[allow(clippy::needless_lifetimes)]
6865 pub fn get_horizontal_accuracy(&'a self) -> &'a Option<::ordered_float::OrderedFloat<f64>> {
6866 &self.horizontal_accuracy
6867 }
6868 #[allow(rustdoc::invalid_html_tags)]
6869 #[doc = "Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely."]
6870 #[allow(clippy::needless_lifetimes)]
6871 pub fn live_period(mut self, live_period: i64) -> Self {
6872 self.live_period = Some(live_period);
6873 self
6874 }
6875 #[allow(clippy::needless_lifetimes)]
6876 pub fn get_live_period(&'a self) -> &'a Option<i64> {
6877 &self.live_period
6878 }
6879 #[allow(rustdoc::invalid_html_tags)]
6880 #[doc = "For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
6881 #[allow(clippy::needless_lifetimes)]
6882 pub fn heading(mut self, heading: i64) -> Self {
6883 self.heading = Some(heading);
6884 self
6885 }
6886 #[allow(clippy::needless_lifetimes)]
6887 pub fn get_heading(&'a self) -> &'a Option<i64> {
6888 &self.heading
6889 }
6890 #[allow(rustdoc::invalid_html_tags)]
6891 #[doc = "For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
6892 #[allow(clippy::needless_lifetimes)]
6893 pub fn proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
6894 self.proximity_alert_radius = Some(proximity_alert_radius);
6895 self
6896 }
6897 #[allow(clippy::needless_lifetimes)]
6898 pub fn get_proximity_alert_radius(&'a self) -> &'a Option<i64> {
6899 &self.proximity_alert_radius
6900 }
6901 #[allow(rustdoc::invalid_html_tags)]
6902 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
6903 #[allow(clippy::needless_lifetimes)]
6904 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
6905 self.disable_notification = Some(disable_notification);
6906 self
6907 }
6908 #[allow(clippy::needless_lifetimes)]
6909 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
6910 &self.disable_notification
6911 }
6912 #[allow(rustdoc::invalid_html_tags)]
6913 #[doc = "Protects the contents of the sent message from forwarding and saving"]
6914 #[allow(clippy::needless_lifetimes)]
6915 pub fn protect_content(mut self, protect_content: bool) -> Self {
6916 self.protect_content = Some(protect_content);
6917 self
6918 }
6919 #[allow(clippy::needless_lifetimes)]
6920 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
6921 &self.protect_content
6922 }
6923 #[allow(rustdoc::invalid_html_tags)]
6924 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
6925 #[allow(clippy::needless_lifetimes)]
6926 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
6927 self.allow_paid_broadcast = Some(allow_paid_broadcast);
6928 self
6929 }
6930 #[allow(clippy::needless_lifetimes)]
6931 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
6932 &self.allow_paid_broadcast
6933 }
6934 #[allow(rustdoc::invalid_html_tags)]
6935 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
6936 #[allow(clippy::needless_lifetimes)]
6937 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
6938 self.message_effect_id = Some(message_effect_id);
6939 self
6940 }
6941 #[allow(clippy::needless_lifetimes)]
6942 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
6943 &self.message_effect_id
6944 }
6945 #[allow(rustdoc::invalid_html_tags)]
6946 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
6947 #[allow(clippy::needless_lifetimes)]
6948 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
6949 where
6950 T: Into<&'a SuggestedPostParameters>,
6951 {
6952 self.suggested_post_parameters = Some(suggested_post_parameters.into());
6953 self
6954 }
6955 #[allow(clippy::needless_lifetimes)]
6956 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
6957 &self.suggested_post_parameters
6958 }
6959 #[allow(rustdoc::invalid_html_tags)]
6960 #[doc = "Description of the message to reply to"]
6961 #[allow(clippy::needless_lifetimes)]
6962 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
6963 where
6964 T: Into<&'a ReplyParameters>,
6965 {
6966 self.reply_parameters = Some(reply_parameters.into());
6967 self
6968 }
6969 #[allow(clippy::needless_lifetimes)]
6970 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
6971 &self.reply_parameters
6972 }
6973 #[allow(rustdoc::invalid_html_tags)]
6974 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
6975 #[allow(clippy::needless_lifetimes)]
6976 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
6977 where
6978 T: Into<&'a EReplyMarkup>,
6979 {
6980 self.reply_markup = Some(reply_markup.into());
6981 self
6982 }
6983 #[allow(clippy::needless_lifetimes)]
6984 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
6985 &self.reply_markup
6986 }
6987 pub async fn build(self) -> BotResult<Message> {
6988 self.bot
6989 .send_location(
6990 self.business_connection_id,
6991 self.chat_id,
6992 self.message_thread_id,
6993 self.direct_messages_topic_id,
6994 self.latitude,
6995 self.longitude,
6996 self.horizontal_accuracy,
6997 self.live_period,
6998 self.heading,
6999 self.proximity_alert_radius,
7000 self.disable_notification,
7001 self.protect_content,
7002 self.allow_paid_broadcast,
7003 self.message_effect_id,
7004 self.suggested_post_parameters,
7005 self.reply_parameters,
7006 self.reply_markup,
7007 )
7008 .await
7009 }
7010}
7011pub struct CallSetChatTitle<'a, V> {
7012 bot: &'a Bot,
7013 chat_id: V,
7014 title: &'a str,
7015}
7016impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatTitle<'a, V> {
7017 #[allow(rustdoc::invalid_html_tags)]
7018 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
7019 #[allow(clippy::needless_lifetimes)]
7020 pub fn chat_id(mut self, chat_id: V) -> Self {
7021 self.chat_id = chat_id;
7022 self
7023 }
7024 #[allow(clippy::needless_lifetimes)]
7025 pub fn get_chat_id(&'a self) -> &'a V {
7026 &self.chat_id
7027 }
7028 #[allow(rustdoc::invalid_html_tags)]
7029 #[doc = "New chat title, 1-128 characters"]
7030 #[allow(clippy::needless_lifetimes)]
7031 pub fn title(mut self, title: &'a str) -> Self {
7032 self.title = title;
7033 self
7034 }
7035 #[allow(clippy::needless_lifetimes)]
7036 pub fn get_title(&'a self) -> &'a &'a str {
7037 &self.title
7038 }
7039 pub async fn build(self) -> BotResult<bool> {
7040 self.bot.set_chat_title(self.chat_id, self.title).await
7041 }
7042}
7043pub struct CallReplaceStickerInSet<'a> {
7044 bot: &'a Bot,
7045 user_id: i64,
7046 name: &'a str,
7047 old_sticker: &'a str,
7048 sticker: &'a InputSticker,
7049}
7050impl<'a> CallReplaceStickerInSet<'a> {
7051 #[allow(rustdoc::invalid_html_tags)]
7052 #[doc = "User identifier of the sticker set owner"]
7053 #[allow(clippy::needless_lifetimes)]
7054 pub fn user_id(mut self, user_id: i64) -> Self {
7055 self.user_id = user_id;
7056 self
7057 }
7058 #[allow(clippy::needless_lifetimes)]
7059 pub fn get_user_id(&'a self) -> &'a i64 {
7060 &self.user_id
7061 }
7062 #[allow(rustdoc::invalid_html_tags)]
7063 #[doc = "Sticker set name"]
7064 #[allow(clippy::needless_lifetimes)]
7065 pub fn name(mut self, name: &'a str) -> Self {
7066 self.name = name;
7067 self
7068 }
7069 #[allow(clippy::needless_lifetimes)]
7070 pub fn get_name(&'a self) -> &'a &'a str {
7071 &self.name
7072 }
7073 #[allow(rustdoc::invalid_html_tags)]
7074 #[doc = "File identifier of the replaced sticker"]
7075 #[allow(clippy::needless_lifetimes)]
7076 pub fn old_sticker(mut self, old_sticker: &'a str) -> Self {
7077 self.old_sticker = old_sticker;
7078 self
7079 }
7080 #[allow(clippy::needless_lifetimes)]
7081 pub fn get_old_sticker(&'a self) -> &'a &'a str {
7082 &self.old_sticker
7083 }
7084 #[allow(rustdoc::invalid_html_tags)]
7085 #[doc = "A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged."]
7086 #[allow(clippy::needless_lifetimes)]
7087 pub fn sticker<T>(mut self, sticker: T) -> Self
7088 where
7089 T: Into<&'a InputSticker>,
7090 {
7091 self.sticker = sticker.into();
7092 self
7093 }
7094 #[allow(clippy::needless_lifetimes)]
7095 pub fn get_sticker(&'a self) -> &'a &'a InputSticker {
7096 &self.sticker
7097 }
7098 pub async fn build(self) -> BotResult<bool> {
7099 self.bot
7100 .replace_sticker_in_set(self.user_id, self.name, self.old_sticker, self.sticker)
7101 .await
7102 }
7103}
7104pub struct CallDeclineSuggestedPost<'a> {
7105 bot: &'a Bot,
7106 chat_id: i64,
7107 message_id: i64,
7108 comment: Option<&'a str>,
7109}
7110impl<'a> CallDeclineSuggestedPost<'a> {
7111 #[allow(rustdoc::invalid_html_tags)]
7112 #[doc = "Unique identifier for the target direct messages chat"]
7113 #[allow(clippy::needless_lifetimes)]
7114 pub fn chat_id(mut self, chat_id: i64) -> Self {
7115 self.chat_id = chat_id;
7116 self
7117 }
7118 #[allow(clippy::needless_lifetimes)]
7119 pub fn get_chat_id(&'a self) -> &'a i64 {
7120 &self.chat_id
7121 }
7122 #[allow(rustdoc::invalid_html_tags)]
7123 #[doc = "Identifier of a suggested post message to decline"]
7124 #[allow(clippy::needless_lifetimes)]
7125 pub fn message_id(mut self, message_id: i64) -> Self {
7126 self.message_id = message_id;
7127 self
7128 }
7129 #[allow(clippy::needless_lifetimes)]
7130 pub fn get_message_id(&'a self) -> &'a i64 {
7131 &self.message_id
7132 }
7133 #[allow(rustdoc::invalid_html_tags)]
7134 #[doc = "Comment for the creator of the suggested post; 0-128 characters"]
7135 #[allow(clippy::needless_lifetimes)]
7136 pub fn comment(mut self, comment: &'a str) -> Self {
7137 self.comment = Some(comment);
7138 self
7139 }
7140 #[allow(clippy::needless_lifetimes)]
7141 pub fn get_comment(&'a self) -> &'a Option<&'a str> {
7142 &self.comment
7143 }
7144 pub async fn build(self) -> BotResult<bool> {
7145 self.bot
7146 .decline_suggested_post(self.chat_id, self.message_id, self.comment)
7147 .await
7148 }
7149}
7150pub struct CallSetMyShortDescription<'a> {
7151 bot: &'a Bot,
7152 short_description: Option<&'a str>,
7153 language_code: Option<&'a str>,
7154}
7155impl<'a> CallSetMyShortDescription<'a> {
7156 #[allow(rustdoc::invalid_html_tags)]
7157 #[doc = "New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language."]
7158 #[allow(clippy::needless_lifetimes)]
7159 pub fn short_description(mut self, short_description: &'a str) -> Self {
7160 self.short_description = Some(short_description);
7161 self
7162 }
7163 #[allow(clippy::needless_lifetimes)]
7164 pub fn get_short_description(&'a self) -> &'a Option<&'a str> {
7165 &self.short_description
7166 }
7167 #[allow(rustdoc::invalid_html_tags)]
7168 #[doc = "A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description."]
7169 #[allow(clippy::needless_lifetimes)]
7170 pub fn language_code(mut self, language_code: &'a str) -> Self {
7171 self.language_code = Some(language_code);
7172 self
7173 }
7174 #[allow(clippy::needless_lifetimes)]
7175 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
7176 &self.language_code
7177 }
7178 pub async fn build(self) -> BotResult<bool> {
7179 self.bot
7180 .set_my_short_description(self.short_description, self.language_code)
7181 .await
7182 }
7183}
7184pub struct CallGetMyDefaultAdministratorRights<'a> {
7185 bot: &'a Bot,
7186 for_channels: Option<bool>,
7187}
7188impl<'a> CallGetMyDefaultAdministratorRights<'a> {
7189 #[allow(rustdoc::invalid_html_tags)]
7190 #[doc = "Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned."]
7191 #[allow(clippy::needless_lifetimes)]
7192 pub fn for_channels(mut self, for_channels: bool) -> Self {
7193 self.for_channels = Some(for_channels);
7194 self
7195 }
7196 #[allow(clippy::needless_lifetimes)]
7197 pub fn get_for_channels(&'a self) -> &'a Option<bool> {
7198 &self.for_channels
7199 }
7200 pub async fn build(self) -> BotResult<ChatAdministratorRights> {
7201 self.bot
7202 .get_my_default_administrator_rights(self.for_channels)
7203 .await
7204 }
7205}
7206pub struct CallGetBusinessAccountStarBalance<'a> {
7207 bot: &'a Bot,
7208 business_connection_id: &'a str,
7209}
7210impl<'a> CallGetBusinessAccountStarBalance<'a> {
7211 #[allow(rustdoc::invalid_html_tags)]
7212 #[doc = "Unique identifier of the business connection"]
7213 #[allow(clippy::needless_lifetimes)]
7214 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
7215 self.business_connection_id = business_connection_id;
7216 self
7217 }
7218 #[allow(clippy::needless_lifetimes)]
7219 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
7220 &self.business_connection_id
7221 }
7222 pub async fn build(self) -> BotResult<StarAmount> {
7223 self.bot
7224 .get_business_account_star_balance(self.business_connection_id)
7225 .await
7226 }
7227}
7228pub struct CallDeleteChatStickerSet<'a, V> {
7229 bot: &'a Bot,
7230 chat_id: V,
7231}
7232impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteChatStickerSet<'a, V> {
7233 #[allow(rustdoc::invalid_html_tags)]
7234 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
7235 #[allow(clippy::needless_lifetimes)]
7236 pub fn chat_id(mut self, chat_id: V) -> Self {
7237 self.chat_id = chat_id;
7238 self
7239 }
7240 #[allow(clippy::needless_lifetimes)]
7241 pub fn get_chat_id(&'a self) -> &'a V {
7242 &self.chat_id
7243 }
7244 pub async fn build(self) -> BotResult<bool> {
7245 self.bot.delete_chat_sticker_set(self.chat_id).await
7246 }
7247}
7248pub struct CallSendAnimation<'a, V> {
7249 bot: &'a Bot,
7250 business_connection_id: Option<&'a str>,
7251 chat_id: V,
7252 message_thread_id: Option<i64>,
7253 direct_messages_topic_id: Option<i64>,
7254 animation: FileData,
7255 duration: Option<i64>,
7256 width: Option<i64>,
7257 height: Option<i64>,
7258 thumbnail: Option<FileData>,
7259 caption: Option<&'a str>,
7260 parse_mode: Option<&'a str>,
7261 caption_entities: Option<&'a Vec<MessageEntity>>,
7262 show_caption_above_media: Option<bool>,
7263 has_spoiler: Option<bool>,
7264 disable_notification: Option<bool>,
7265 protect_content: Option<bool>,
7266 allow_paid_broadcast: Option<bool>,
7267 message_effect_id: Option<&'a str>,
7268 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
7269 reply_parameters: Option<&'a ReplyParameters>,
7270 reply_markup: Option<&'a EReplyMarkup>,
7271}
7272impl<'a, V: Into<ChatHandle> + Serialize> CallSendAnimation<'a, V> {
7273 #[allow(rustdoc::invalid_html_tags)]
7274 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
7275 #[allow(clippy::needless_lifetimes)]
7276 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
7277 self.business_connection_id = Some(business_connection_id);
7278 self
7279 }
7280 #[allow(clippy::needless_lifetimes)]
7281 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
7282 &self.business_connection_id
7283 }
7284 #[allow(rustdoc::invalid_html_tags)]
7285 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
7286 #[allow(clippy::needless_lifetimes)]
7287 pub fn chat_id(mut self, chat_id: V) -> Self {
7288 self.chat_id = chat_id;
7289 self
7290 }
7291 #[allow(clippy::needless_lifetimes)]
7292 pub fn get_chat_id(&'a self) -> &'a V {
7293 &self.chat_id
7294 }
7295 #[allow(rustdoc::invalid_html_tags)]
7296 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
7297 #[allow(clippy::needless_lifetimes)]
7298 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
7299 self.message_thread_id = Some(message_thread_id);
7300 self
7301 }
7302 #[allow(clippy::needless_lifetimes)]
7303 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
7304 &self.message_thread_id
7305 }
7306 #[allow(rustdoc::invalid_html_tags)]
7307 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
7308 #[allow(clippy::needless_lifetimes)]
7309 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
7310 self.direct_messages_topic_id = Some(direct_messages_topic_id);
7311 self
7312 }
7313 #[allow(clippy::needless_lifetimes)]
7314 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
7315 &self.direct_messages_topic_id
7316 }
7317 #[allow(rustdoc::invalid_html_tags)]
7318 #[doc = "Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
7319 #[allow(clippy::needless_lifetimes)]
7320 pub fn animation(mut self, animation: FileData) -> Self {
7321 self.animation = animation;
7322 self
7323 }
7324 #[allow(clippy::needless_lifetimes)]
7325 pub fn get_animation(&'a self) -> &'a FileData {
7326 &self.animation
7327 }
7328 #[allow(rustdoc::invalid_html_tags)]
7329 #[doc = "Duration of sent animation in seconds"]
7330 #[allow(clippy::needless_lifetimes)]
7331 pub fn duration(mut self, duration: i64) -> Self {
7332 self.duration = Some(duration);
7333 self
7334 }
7335 #[allow(clippy::needless_lifetimes)]
7336 pub fn get_duration(&'a self) -> &'a Option<i64> {
7337 &self.duration
7338 }
7339 #[allow(rustdoc::invalid_html_tags)]
7340 #[doc = "Animation width"]
7341 #[allow(clippy::needless_lifetimes)]
7342 pub fn width(mut self, width: i64) -> Self {
7343 self.width = Some(width);
7344 self
7345 }
7346 #[allow(clippy::needless_lifetimes)]
7347 pub fn get_width(&'a self) -> &'a Option<i64> {
7348 &self.width
7349 }
7350 #[allow(rustdoc::invalid_html_tags)]
7351 #[doc = "Animation height"]
7352 #[allow(clippy::needless_lifetimes)]
7353 pub fn height(mut self, height: i64) -> Self {
7354 self.height = Some(height);
7355 self
7356 }
7357 #[allow(clippy::needless_lifetimes)]
7358 pub fn get_height(&'a self) -> &'a Option<i64> {
7359 &self.height
7360 }
7361 #[allow(rustdoc::invalid_html_tags)]
7362 #[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
7363 #[allow(clippy::needless_lifetimes)]
7364 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
7365 self.thumbnail = Some(thumbnail);
7366 self
7367 }
7368 #[allow(clippy::needless_lifetimes)]
7369 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
7370 &self.thumbnail
7371 }
7372 #[allow(rustdoc::invalid_html_tags)]
7373 #[doc = "Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing"]
7374 #[allow(clippy::needless_lifetimes)]
7375 pub fn caption(mut self, caption: &'a str) -> Self {
7376 self.caption = Some(caption);
7377 self
7378 }
7379 #[allow(clippy::needless_lifetimes)]
7380 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
7381 &self.caption
7382 }
7383 #[allow(rustdoc::invalid_html_tags)]
7384 #[doc = "Mode for parsing entities in the animation caption. See formatting options for more details."]
7385 #[allow(clippy::needless_lifetimes)]
7386 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
7387 self.parse_mode = Some(parse_mode);
7388 self
7389 }
7390 #[allow(clippy::needless_lifetimes)]
7391 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
7392 &self.parse_mode
7393 }
7394 #[allow(rustdoc::invalid_html_tags)]
7395 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
7396 #[allow(clippy::needless_lifetimes)]
7397 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
7398 self.caption_entities = Some(caption_entities);
7399 self
7400 }
7401 #[allow(clippy::needless_lifetimes)]
7402 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
7403 &self.caption_entities
7404 }
7405 #[allow(rustdoc::invalid_html_tags)]
7406 #[doc = "Pass True, if the caption must be shown above the message media"]
7407 #[allow(clippy::needless_lifetimes)]
7408 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
7409 self.show_caption_above_media = Some(show_caption_above_media);
7410 self
7411 }
7412 #[allow(clippy::needless_lifetimes)]
7413 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
7414 &self.show_caption_above_media
7415 }
7416 #[allow(rustdoc::invalid_html_tags)]
7417 #[doc = "Pass True if the animation needs to be covered with a spoiler animation"]
7418 #[allow(clippy::needless_lifetimes)]
7419 pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
7420 self.has_spoiler = Some(has_spoiler);
7421 self
7422 }
7423 #[allow(clippy::needless_lifetimes)]
7424 pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
7425 &self.has_spoiler
7426 }
7427 #[allow(rustdoc::invalid_html_tags)]
7428 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
7429 #[allow(clippy::needless_lifetimes)]
7430 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
7431 self.disable_notification = Some(disable_notification);
7432 self
7433 }
7434 #[allow(clippy::needless_lifetimes)]
7435 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
7436 &self.disable_notification
7437 }
7438 #[allow(rustdoc::invalid_html_tags)]
7439 #[doc = "Protects the contents of the sent message from forwarding and saving"]
7440 #[allow(clippy::needless_lifetimes)]
7441 pub fn protect_content(mut self, protect_content: bool) -> Self {
7442 self.protect_content = Some(protect_content);
7443 self
7444 }
7445 #[allow(clippy::needless_lifetimes)]
7446 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
7447 &self.protect_content
7448 }
7449 #[allow(rustdoc::invalid_html_tags)]
7450 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
7451 #[allow(clippy::needless_lifetimes)]
7452 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
7453 self.allow_paid_broadcast = Some(allow_paid_broadcast);
7454 self
7455 }
7456 #[allow(clippy::needless_lifetimes)]
7457 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
7458 &self.allow_paid_broadcast
7459 }
7460 #[allow(rustdoc::invalid_html_tags)]
7461 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
7462 #[allow(clippy::needless_lifetimes)]
7463 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
7464 self.message_effect_id = Some(message_effect_id);
7465 self
7466 }
7467 #[allow(clippy::needless_lifetimes)]
7468 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
7469 &self.message_effect_id
7470 }
7471 #[allow(rustdoc::invalid_html_tags)]
7472 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
7473 #[allow(clippy::needless_lifetimes)]
7474 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
7475 where
7476 T: Into<&'a SuggestedPostParameters>,
7477 {
7478 self.suggested_post_parameters = Some(suggested_post_parameters.into());
7479 self
7480 }
7481 #[allow(clippy::needless_lifetimes)]
7482 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
7483 &self.suggested_post_parameters
7484 }
7485 #[allow(rustdoc::invalid_html_tags)]
7486 #[doc = "Description of the message to reply to"]
7487 #[allow(clippy::needless_lifetimes)]
7488 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
7489 where
7490 T: Into<&'a ReplyParameters>,
7491 {
7492 self.reply_parameters = Some(reply_parameters.into());
7493 self
7494 }
7495 #[allow(clippy::needless_lifetimes)]
7496 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
7497 &self.reply_parameters
7498 }
7499 #[allow(rustdoc::invalid_html_tags)]
7500 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
7501 #[allow(clippy::needless_lifetimes)]
7502 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
7503 where
7504 T: Into<&'a EReplyMarkup>,
7505 {
7506 self.reply_markup = Some(reply_markup.into());
7507 self
7508 }
7509 #[allow(clippy::needless_lifetimes)]
7510 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
7511 &self.reply_markup
7512 }
7513 pub async fn build(self) -> BotResult<Message> {
7514 self.bot
7515 .send_animation(
7516 self.business_connection_id,
7517 self.chat_id,
7518 self.message_thread_id,
7519 self.direct_messages_topic_id,
7520 self.animation,
7521 self.duration,
7522 self.width,
7523 self.height,
7524 self.thumbnail,
7525 self.caption,
7526 self.parse_mode,
7527 self.caption_entities,
7528 self.show_caption_above_media,
7529 self.has_spoiler,
7530 self.disable_notification,
7531 self.protect_content,
7532 self.allow_paid_broadcast,
7533 self.message_effect_id,
7534 self.suggested_post_parameters,
7535 self.reply_parameters,
7536 self.reply_markup,
7537 )
7538 .await
7539 }
7540}
7541pub struct CallAddStickerToSet<'a> {
7542 bot: &'a Bot,
7543 user_id: i64,
7544 name: &'a str,
7545 sticker: &'a InputSticker,
7546}
7547impl<'a> CallAddStickerToSet<'a> {
7548 #[allow(rustdoc::invalid_html_tags)]
7549 #[doc = "User identifier of sticker set owner"]
7550 #[allow(clippy::needless_lifetimes)]
7551 pub fn user_id(mut self, user_id: i64) -> Self {
7552 self.user_id = user_id;
7553 self
7554 }
7555 #[allow(clippy::needless_lifetimes)]
7556 pub fn get_user_id(&'a self) -> &'a i64 {
7557 &self.user_id
7558 }
7559 #[allow(rustdoc::invalid_html_tags)]
7560 #[doc = "Sticker set name"]
7561 #[allow(clippy::needless_lifetimes)]
7562 pub fn name(mut self, name: &'a str) -> Self {
7563 self.name = name;
7564 self
7565 }
7566 #[allow(clippy::needless_lifetimes)]
7567 pub fn get_name(&'a self) -> &'a &'a str {
7568 &self.name
7569 }
7570 #[allow(rustdoc::invalid_html_tags)]
7571 #[doc = "A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed."]
7572 #[allow(clippy::needless_lifetimes)]
7573 pub fn sticker<T>(mut self, sticker: T) -> Self
7574 where
7575 T: Into<&'a InputSticker>,
7576 {
7577 self.sticker = sticker.into();
7578 self
7579 }
7580 #[allow(clippy::needless_lifetimes)]
7581 pub fn get_sticker(&'a self) -> &'a &'a InputSticker {
7582 &self.sticker
7583 }
7584 pub async fn build(self) -> BotResult<bool> {
7585 self.bot
7586 .add_sticker_to_set(self.user_id, self.name, self.sticker)
7587 .await
7588 }
7589}
7590pub struct CallDeleteWebhook<'a> {
7591 bot: &'a Bot,
7592 drop_pending_updates: Option<bool>,
7593}
7594impl<'a> CallDeleteWebhook<'a> {
7595 #[allow(rustdoc::invalid_html_tags)]
7596 #[doc = "Pass True to drop all pending updates"]
7597 #[allow(clippy::needless_lifetimes)]
7598 pub fn drop_pending_updates(mut self, drop_pending_updates: bool) -> Self {
7599 self.drop_pending_updates = Some(drop_pending_updates);
7600 self
7601 }
7602 #[allow(clippy::needless_lifetimes)]
7603 pub fn get_drop_pending_updates(&'a self) -> &'a Option<bool> {
7604 &self.drop_pending_updates
7605 }
7606 pub async fn build(self) -> BotResult<bool> {
7607 self.bot.delete_webhook(self.drop_pending_updates).await
7608 }
7609}
7610pub struct CallUnpinAllChatMessages<'a, V> {
7611 bot: &'a Bot,
7612 chat_id: V,
7613}
7614impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllChatMessages<'a, V> {
7615 #[allow(rustdoc::invalid_html_tags)]
7616 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
7617 #[allow(clippy::needless_lifetimes)]
7618 pub fn chat_id(mut self, chat_id: V) -> Self {
7619 self.chat_id = chat_id;
7620 self
7621 }
7622 #[allow(clippy::needless_lifetimes)]
7623 pub fn get_chat_id(&'a self) -> &'a V {
7624 &self.chat_id
7625 }
7626 pub async fn build(self) -> BotResult<bool> {
7627 self.bot.unpin_all_chat_messages(self.chat_id).await
7628 }
7629}
7630pub struct CallDeclineChatJoinRequest<'a, V> {
7631 bot: &'a Bot,
7632 chat_id: V,
7633 user_id: i64,
7634}
7635impl<'a, V: Into<ChatHandle> + Serialize> CallDeclineChatJoinRequest<'a, V> {
7636 #[allow(rustdoc::invalid_html_tags)]
7637 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
7638 #[allow(clippy::needless_lifetimes)]
7639 pub fn chat_id(mut self, chat_id: V) -> Self {
7640 self.chat_id = chat_id;
7641 self
7642 }
7643 #[allow(clippy::needless_lifetimes)]
7644 pub fn get_chat_id(&'a self) -> &'a V {
7645 &self.chat_id
7646 }
7647 #[allow(rustdoc::invalid_html_tags)]
7648 #[doc = "Unique identifier of the target user"]
7649 #[allow(clippy::needless_lifetimes)]
7650 pub fn user_id(mut self, user_id: i64) -> Self {
7651 self.user_id = user_id;
7652 self
7653 }
7654 #[allow(clippy::needless_lifetimes)]
7655 pub fn get_user_id(&'a self) -> &'a i64 {
7656 &self.user_id
7657 }
7658 pub async fn build(self) -> BotResult<bool> {
7659 self.bot
7660 .decline_chat_join_request(self.chat_id, self.user_id)
7661 .await
7662 }
7663}
7664pub struct CallReadBusinessMessage<'a> {
7665 bot: &'a Bot,
7666 business_connection_id: &'a str,
7667 chat_id: i64,
7668 message_id: i64,
7669}
7670impl<'a> CallReadBusinessMessage<'a> {
7671 #[allow(rustdoc::invalid_html_tags)]
7672 #[doc = "Unique identifier of the business connection on behalf of which to read the message"]
7673 #[allow(clippy::needless_lifetimes)]
7674 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
7675 self.business_connection_id = business_connection_id;
7676 self
7677 }
7678 #[allow(clippy::needless_lifetimes)]
7679 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
7680 &self.business_connection_id
7681 }
7682 #[allow(rustdoc::invalid_html_tags)]
7683 #[doc = "Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours."]
7684 #[allow(clippy::needless_lifetimes)]
7685 pub fn chat_id(mut self, chat_id: i64) -> Self {
7686 self.chat_id = chat_id;
7687 self
7688 }
7689 #[allow(clippy::needless_lifetimes)]
7690 pub fn get_chat_id(&'a self) -> &'a i64 {
7691 &self.chat_id
7692 }
7693 #[allow(rustdoc::invalid_html_tags)]
7694 #[doc = "Unique identifier of the message to mark as read"]
7695 #[allow(clippy::needless_lifetimes)]
7696 pub fn message_id(mut self, message_id: i64) -> Self {
7697 self.message_id = message_id;
7698 self
7699 }
7700 #[allow(clippy::needless_lifetimes)]
7701 pub fn get_message_id(&'a self) -> &'a i64 {
7702 &self.message_id
7703 }
7704 pub async fn build(self) -> BotResult<bool> {
7705 self.bot
7706 .read_business_message(self.business_connection_id, self.chat_id, self.message_id)
7707 .await
7708 }
7709}
7710pub struct CallSetStickerMaskPosition<'a> {
7711 bot: &'a Bot,
7712 sticker: &'a str,
7713 mask_position: Option<&'a MaskPosition>,
7714}
7715impl<'a> CallSetStickerMaskPosition<'a> {
7716 #[allow(rustdoc::invalid_html_tags)]
7717 #[doc = "File identifier of the sticker"]
7718 #[allow(clippy::needless_lifetimes)]
7719 pub fn sticker(mut self, sticker: &'a str) -> Self {
7720 self.sticker = sticker;
7721 self
7722 }
7723 #[allow(clippy::needless_lifetimes)]
7724 pub fn get_sticker(&'a self) -> &'a &'a str {
7725 &self.sticker
7726 }
7727 #[allow(rustdoc::invalid_html_tags)]
7728 #[doc = "A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."]
7729 #[allow(clippy::needless_lifetimes)]
7730 pub fn mask_position<T>(mut self, mask_position: T) -> Self
7731 where
7732 T: Into<&'a MaskPosition>,
7733 {
7734 self.mask_position = Some(mask_position.into());
7735 self
7736 }
7737 #[allow(clippy::needless_lifetimes)]
7738 pub fn get_mask_position(&'a self) -> &'a Option<&'a MaskPosition> {
7739 &self.mask_position
7740 }
7741 pub async fn build(self) -> BotResult<bool> {
7742 self.bot
7743 .set_sticker_mask_position(self.sticker, self.mask_position)
7744 .await
7745 }
7746}
7747pub struct CallSetMyDefaultAdministratorRights<'a> {
7748 bot: &'a Bot,
7749 rights: Option<&'a ChatAdministratorRights>,
7750 for_channels: Option<bool>,
7751}
7752impl<'a> CallSetMyDefaultAdministratorRights<'a> {
7753 #[allow(rustdoc::invalid_html_tags)]
7754 #[doc = "A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared."]
7755 #[allow(clippy::needless_lifetimes)]
7756 pub fn rights<T>(mut self, rights: T) -> Self
7757 where
7758 T: Into<&'a ChatAdministratorRights>,
7759 {
7760 self.rights = Some(rights.into());
7761 self
7762 }
7763 #[allow(clippy::needless_lifetimes)]
7764 pub fn get_rights(&'a self) -> &'a Option<&'a ChatAdministratorRights> {
7765 &self.rights
7766 }
7767 #[allow(rustdoc::invalid_html_tags)]
7768 #[doc = "Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed."]
7769 #[allow(clippy::needless_lifetimes)]
7770 pub fn for_channels(mut self, for_channels: bool) -> Self {
7771 self.for_channels = Some(for_channels);
7772 self
7773 }
7774 #[allow(clippy::needless_lifetimes)]
7775 pub fn get_for_channels(&'a self) -> &'a Option<bool> {
7776 &self.for_channels
7777 }
7778 pub async fn build(self) -> BotResult<bool> {
7779 self.bot
7780 .set_my_default_administrator_rights(self.rights, self.for_channels)
7781 .await
7782 }
7783}
7784pub struct CallEditUserStarSubscription<'a> {
7785 bot: &'a Bot,
7786 user_id: i64,
7787 telegram_payment_charge_id: &'a str,
7788 is_canceled: bool,
7789}
7790impl<'a> CallEditUserStarSubscription<'a> {
7791 #[allow(rustdoc::invalid_html_tags)]
7792 #[doc = "Identifier of the user whose subscription will be edited"]
7793 #[allow(clippy::needless_lifetimes)]
7794 pub fn user_id(mut self, user_id: i64) -> Self {
7795 self.user_id = user_id;
7796 self
7797 }
7798 #[allow(clippy::needless_lifetimes)]
7799 pub fn get_user_id(&'a self) -> &'a i64 {
7800 &self.user_id
7801 }
7802 #[allow(rustdoc::invalid_html_tags)]
7803 #[doc = "Telegram payment identifier for the subscription"]
7804 #[allow(clippy::needless_lifetimes)]
7805 pub fn telegram_payment_charge_id(mut self, telegram_payment_charge_id: &'a str) -> Self {
7806 self.telegram_payment_charge_id = telegram_payment_charge_id;
7807 self
7808 }
7809 #[allow(clippy::needless_lifetimes)]
7810 pub fn get_telegram_payment_charge_id(&'a self) -> &'a &'a str {
7811 &self.telegram_payment_charge_id
7812 }
7813 #[allow(rustdoc::invalid_html_tags)]
7814 #[doc = "Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot."]
7815 #[allow(clippy::needless_lifetimes)]
7816 pub fn is_canceled(mut self, is_canceled: bool) -> Self {
7817 self.is_canceled = is_canceled;
7818 self
7819 }
7820 #[allow(clippy::needless_lifetimes)]
7821 pub fn get_is_canceled(&'a self) -> &'a bool {
7822 &self.is_canceled
7823 }
7824 pub async fn build(self) -> BotResult<bool> {
7825 self.bot
7826 .edit_user_star_subscription(
7827 self.user_id,
7828 self.telegram_payment_charge_id,
7829 self.is_canceled,
7830 )
7831 .await
7832 }
7833}
7834pub struct CallGetGameHighScores<'a> {
7835 bot: &'a Bot,
7836 user_id: i64,
7837 chat_id: Option<i64>,
7838 message_id: Option<i64>,
7839 inline_message_id: Option<&'a str>,
7840}
7841impl<'a> CallGetGameHighScores<'a> {
7842 #[allow(rustdoc::invalid_html_tags)]
7843 #[doc = "Target user id"]
7844 #[allow(clippy::needless_lifetimes)]
7845 pub fn user_id(mut self, user_id: i64) -> Self {
7846 self.user_id = user_id;
7847 self
7848 }
7849 #[allow(clippy::needless_lifetimes)]
7850 pub fn get_user_id(&'a self) -> &'a i64 {
7851 &self.user_id
7852 }
7853 #[allow(rustdoc::invalid_html_tags)]
7854 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat"]
7855 #[allow(clippy::needless_lifetimes)]
7856 pub fn chat_id(mut self, chat_id: i64) -> Self {
7857 self.chat_id = Some(chat_id);
7858 self
7859 }
7860 #[allow(clippy::needless_lifetimes)]
7861 pub fn get_chat_id(&'a self) -> &'a Option<i64> {
7862 &self.chat_id
7863 }
7864 #[allow(rustdoc::invalid_html_tags)]
7865 #[doc = "Required if inline_message_id is not specified. Identifier of the sent message"]
7866 #[allow(clippy::needless_lifetimes)]
7867 pub fn message_id(mut self, message_id: i64) -> Self {
7868 self.message_id = Some(message_id);
7869 self
7870 }
7871 #[allow(clippy::needless_lifetimes)]
7872 pub fn get_message_id(&'a self) -> &'a Option<i64> {
7873 &self.message_id
7874 }
7875 #[allow(rustdoc::invalid_html_tags)]
7876 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
7877 #[allow(clippy::needless_lifetimes)]
7878 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
7879 self.inline_message_id = Some(inline_message_id);
7880 self
7881 }
7882 #[allow(clippy::needless_lifetimes)]
7883 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
7884 &self.inline_message_id
7885 }
7886 pub async fn build(self) -> BotResult<Vec<GameHighScore>> {
7887 self.bot
7888 .get_game_high_scores(
7889 self.user_id,
7890 self.chat_id,
7891 self.message_id,
7892 self.inline_message_id,
7893 )
7894 .await
7895 }
7896}
7897pub struct CallSendChatAction<'a, V> {
7898 bot: &'a Bot,
7899 business_connection_id: Option<&'a str>,
7900 chat_id: V,
7901 message_thread_id: Option<i64>,
7902 action: &'a str,
7903}
7904impl<'a, V: Into<ChatHandle> + Serialize> CallSendChatAction<'a, V> {
7905 #[allow(rustdoc::invalid_html_tags)]
7906 #[doc = "Unique identifier of the business connection on behalf of which the action will be sent"]
7907 #[allow(clippy::needless_lifetimes)]
7908 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
7909 self.business_connection_id = Some(business_connection_id);
7910 self
7911 }
7912 #[allow(clippy::needless_lifetimes)]
7913 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
7914 &self.business_connection_id
7915 }
7916 #[allow(rustdoc::invalid_html_tags)]
7917 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel chats and channel direct messages chats aren't supported."]
7918 #[allow(clippy::needless_lifetimes)]
7919 pub fn chat_id(mut self, chat_id: V) -> Self {
7920 self.chat_id = chat_id;
7921 self
7922 }
7923 #[allow(clippy::needless_lifetimes)]
7924 pub fn get_chat_id(&'a self) -> &'a V {
7925 &self.chat_id
7926 }
7927 #[allow(rustdoc::invalid_html_tags)]
7928 #[doc = "Unique identifier for the target message thread; for supergroups only"]
7929 #[allow(clippy::needless_lifetimes)]
7930 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
7931 self.message_thread_id = Some(message_thread_id);
7932 self
7933 }
7934 #[allow(clippy::needless_lifetimes)]
7935 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
7936 &self.message_thread_id
7937 }
7938 #[allow(rustdoc::invalid_html_tags)]
7939 #[doc = "Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes."]
7940 #[allow(clippy::needless_lifetimes)]
7941 pub fn action(mut self, action: &'a str) -> Self {
7942 self.action = action;
7943 self
7944 }
7945 #[allow(clippy::needless_lifetimes)]
7946 pub fn get_action(&'a self) -> &'a &'a str {
7947 &self.action
7948 }
7949 pub async fn build(self) -> BotResult<bool> {
7950 self.bot
7951 .send_chat_action(
7952 self.business_connection_id,
7953 self.chat_id,
7954 self.message_thread_id,
7955 self.action,
7956 )
7957 .await
7958 }
7959}
7960pub struct CallGetMyName<'a> {
7961 bot: &'a Bot,
7962 language_code: Option<&'a str>,
7963}
7964impl<'a> CallGetMyName<'a> {
7965 #[allow(rustdoc::invalid_html_tags)]
7966 #[doc = "A two-letter ISO 639-1 language code or an empty string"]
7967 #[allow(clippy::needless_lifetimes)]
7968 pub fn language_code(mut self, language_code: &'a str) -> Self {
7969 self.language_code = Some(language_code);
7970 self
7971 }
7972 #[allow(clippy::needless_lifetimes)]
7973 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
7974 &self.language_code
7975 }
7976 pub async fn build(self) -> BotResult<BotName> {
7977 self.bot.get_my_name(self.language_code).await
7978 }
7979}
7980pub struct CallSetChatStickerSet<'a, V> {
7981 bot: &'a Bot,
7982 chat_id: V,
7983 sticker_set_name: &'a str,
7984}
7985impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatStickerSet<'a, V> {
7986 #[allow(rustdoc::invalid_html_tags)]
7987 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
7988 #[allow(clippy::needless_lifetimes)]
7989 pub fn chat_id(mut self, chat_id: V) -> Self {
7990 self.chat_id = chat_id;
7991 self
7992 }
7993 #[allow(clippy::needless_lifetimes)]
7994 pub fn get_chat_id(&'a self) -> &'a V {
7995 &self.chat_id
7996 }
7997 #[allow(rustdoc::invalid_html_tags)]
7998 #[doc = "Name of the sticker set to be set as the group sticker set"]
7999 #[allow(clippy::needless_lifetimes)]
8000 pub fn sticker_set_name(mut self, sticker_set_name: &'a str) -> Self {
8001 self.sticker_set_name = sticker_set_name;
8002 self
8003 }
8004 #[allow(clippy::needless_lifetimes)]
8005 pub fn get_sticker_set_name(&'a self) -> &'a &'a str {
8006 &self.sticker_set_name
8007 }
8008 pub async fn build(self) -> BotResult<bool> {
8009 self.bot
8010 .set_chat_sticker_set(self.chat_id, self.sticker_set_name)
8011 .await
8012 }
8013}
8014pub struct CallSetWebhook<'a> {
8015 bot: &'a Bot,
8016 url: &'a str,
8017 certificate: Option<FileData>,
8018 ip_address: Option<&'a str>,
8019 max_connections: Option<i64>,
8020 allowed_updates: Option<&'a Vec<String>>,
8021 drop_pending_updates: Option<bool>,
8022 secret_token: Option<&'a str>,
8023}
8024impl<'a> CallSetWebhook<'a> {
8025 #[allow(rustdoc::invalid_html_tags)]
8026 #[doc = "HTTPS URL to send updates to. Use an empty string to remove webhook integration"]
8027 #[allow(clippy::needless_lifetimes)]
8028 pub fn url(mut self, url: &'a str) -> Self {
8029 self.url = url;
8030 self
8031 }
8032 #[allow(clippy::needless_lifetimes)]
8033 pub fn get_url(&'a self) -> &'a &'a str {
8034 &self.url
8035 }
8036 #[allow(rustdoc::invalid_html_tags)]
8037 #[doc = "Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details."]
8038 #[allow(clippy::needless_lifetimes)]
8039 pub fn certificate(mut self, certificate: FileData) -> Self {
8040 self.certificate = Some(certificate);
8041 self
8042 }
8043 #[allow(clippy::needless_lifetimes)]
8044 pub fn get_certificate(&'a self) -> &'a Option<FileData> {
8045 &self.certificate
8046 }
8047 #[allow(rustdoc::invalid_html_tags)]
8048 #[doc = "The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS"]
8049 #[allow(clippy::needless_lifetimes)]
8050 pub fn ip_address(mut self, ip_address: &'a str) -> Self {
8051 self.ip_address = Some(ip_address);
8052 self
8053 }
8054 #[allow(clippy::needless_lifetimes)]
8055 pub fn get_ip_address(&'a self) -> &'a Option<&'a str> {
8056 &self.ip_address
8057 }
8058 #[allow(rustdoc::invalid_html_tags)]
8059 #[doc = "The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput."]
8060 #[allow(clippy::needless_lifetimes)]
8061 pub fn max_connections(mut self, max_connections: i64) -> Self {
8062 self.max_connections = Some(max_connections);
8063 self
8064 }
8065 #[allow(clippy::needless_lifetimes)]
8066 pub fn get_max_connections(&'a self) -> &'a Option<i64> {
8067 &self.max_connections
8068 }
8069 #[allow(rustdoc::invalid_html_tags)]
8070 #[doc = "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time."]
8071 #[allow(clippy::needless_lifetimes)]
8072 pub fn allowed_updates(mut self, allowed_updates: &'a Vec<String>) -> Self {
8073 self.allowed_updates = Some(allowed_updates);
8074 self
8075 }
8076 #[allow(clippy::needless_lifetimes)]
8077 pub fn get_allowed_updates(&'a self) -> &'a Option<&'a Vec<String>> {
8078 &self.allowed_updates
8079 }
8080 #[allow(rustdoc::invalid_html_tags)]
8081 #[doc = "Pass True to drop all pending updates"]
8082 #[allow(clippy::needless_lifetimes)]
8083 pub fn drop_pending_updates(mut self, drop_pending_updates: bool) -> Self {
8084 self.drop_pending_updates = Some(drop_pending_updates);
8085 self
8086 }
8087 #[allow(clippy::needless_lifetimes)]
8088 pub fn get_drop_pending_updates(&'a self) -> &'a Option<bool> {
8089 &self.drop_pending_updates
8090 }
8091 #[allow(rustdoc::invalid_html_tags)]
8092 #[doc = "A secret token to be sent in a header \"X-Telegram-Bot-Api-Secret-Token\" in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you."]
8093 #[allow(clippy::needless_lifetimes)]
8094 pub fn secret_token(mut self, secret_token: &'a str) -> Self {
8095 self.secret_token = Some(secret_token);
8096 self
8097 }
8098 #[allow(clippy::needless_lifetimes)]
8099 pub fn get_secret_token(&'a self) -> &'a Option<&'a str> {
8100 &self.secret_token
8101 }
8102 pub async fn build(self) -> BotResult<bool> {
8103 self.bot
8104 .set_webhook(
8105 self.url,
8106 self.certificate,
8107 self.ip_address,
8108 self.max_connections,
8109 self.allowed_updates,
8110 self.drop_pending_updates,
8111 self.secret_token,
8112 )
8113 .await
8114 }
8115}
8116pub struct CallVerifyChat<'a, V> {
8117 bot: &'a Bot,
8118 chat_id: V,
8119 custom_description: Option<&'a str>,
8120}
8121impl<'a, V: Into<ChatHandle> + Serialize> CallVerifyChat<'a, V> {
8122 #[allow(rustdoc::invalid_html_tags)]
8123 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). Channel direct messages chats can't be verified."]
8124 #[allow(clippy::needless_lifetimes)]
8125 pub fn chat_id(mut self, chat_id: V) -> Self {
8126 self.chat_id = chat_id;
8127 self
8128 }
8129 #[allow(clippy::needless_lifetimes)]
8130 pub fn get_chat_id(&'a self) -> &'a V {
8131 &self.chat_id
8132 }
8133 #[allow(rustdoc::invalid_html_tags)]
8134 #[doc = "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."]
8135 #[allow(clippy::needless_lifetimes)]
8136 pub fn custom_description(mut self, custom_description: &'a str) -> Self {
8137 self.custom_description = Some(custom_description);
8138 self
8139 }
8140 #[allow(clippy::needless_lifetimes)]
8141 pub fn get_custom_description(&'a self) -> &'a Option<&'a str> {
8142 &self.custom_description
8143 }
8144 pub async fn build(self) -> BotResult<bool> {
8145 self.bot
8146 .verify_chat(self.chat_id, self.custom_description)
8147 .await
8148 }
8149}
8150pub struct CallClose<'a> {
8151 bot: &'a Bot,
8152}
8153impl<'a> CallClose<'a> {
8154 pub async fn build(self) -> BotResult<bool> {
8155 self.bot.close().await
8156 }
8157}
8158pub struct CallAnswerWebAppQuery<'a> {
8159 bot: &'a Bot,
8160 web_app_query_id: &'a str,
8161 result: &'a InlineQueryResult,
8162}
8163impl<'a> CallAnswerWebAppQuery<'a> {
8164 #[allow(rustdoc::invalid_html_tags)]
8165 #[doc = "Unique identifier for the query to be answered"]
8166 #[allow(clippy::needless_lifetimes)]
8167 pub fn web_app_query_id(mut self, web_app_query_id: &'a str) -> Self {
8168 self.web_app_query_id = web_app_query_id;
8169 self
8170 }
8171 #[allow(clippy::needless_lifetimes)]
8172 pub fn get_web_app_query_id(&'a self) -> &'a &'a str {
8173 &self.web_app_query_id
8174 }
8175 #[allow(rustdoc::invalid_html_tags)]
8176 #[doc = "A JSON-serialized object describing the message to be sent"]
8177 #[allow(clippy::needless_lifetimes)]
8178 pub fn result<T>(mut self, result: T) -> Self
8179 where
8180 T: Into<&'a InlineQueryResult>,
8181 {
8182 self.result = result.into();
8183 self
8184 }
8185 #[allow(clippy::needless_lifetimes)]
8186 pub fn get_result(&'a self) -> &'a &'a InlineQueryResult {
8187 &self.result
8188 }
8189 pub async fn build(self) -> BotResult<SentWebAppMessage> {
8190 self.bot
8191 .answer_web_app_query(self.web_app_query_id, self.result)
8192 .await
8193 }
8194}
8195pub struct CallLeaveChat<'a, V> {
8196 bot: &'a Bot,
8197 chat_id: V,
8198}
8199impl<'a, V: Into<ChatHandle> + Serialize> CallLeaveChat<'a, V> {
8200 #[allow(rustdoc::invalid_html_tags)]
8201 #[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername). Channel direct messages chats aren't supported; leave the corresponding channel instead."]
8202 #[allow(clippy::needless_lifetimes)]
8203 pub fn chat_id(mut self, chat_id: V) -> Self {
8204 self.chat_id = chat_id;
8205 self
8206 }
8207 #[allow(clippy::needless_lifetimes)]
8208 pub fn get_chat_id(&'a self) -> &'a V {
8209 &self.chat_id
8210 }
8211 pub async fn build(self) -> BotResult<bool> {
8212 self.bot.leave_chat(self.chat_id).await
8213 }
8214}
8215pub struct CallSendVoice<'a, V> {
8216 bot: &'a Bot,
8217 business_connection_id: Option<&'a str>,
8218 chat_id: V,
8219 message_thread_id: Option<i64>,
8220 direct_messages_topic_id: Option<i64>,
8221 voice: FileData,
8222 caption: Option<&'a str>,
8223 parse_mode: Option<&'a str>,
8224 caption_entities: Option<&'a Vec<MessageEntity>>,
8225 duration: Option<i64>,
8226 disable_notification: Option<bool>,
8227 protect_content: Option<bool>,
8228 allow_paid_broadcast: Option<bool>,
8229 message_effect_id: Option<&'a str>,
8230 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
8231 reply_parameters: Option<&'a ReplyParameters>,
8232 reply_markup: Option<&'a EReplyMarkup>,
8233}
8234impl<'a, V: Into<ChatHandle> + Serialize> CallSendVoice<'a, V> {
8235 #[allow(rustdoc::invalid_html_tags)]
8236 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
8237 #[allow(clippy::needless_lifetimes)]
8238 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
8239 self.business_connection_id = Some(business_connection_id);
8240 self
8241 }
8242 #[allow(clippy::needless_lifetimes)]
8243 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
8244 &self.business_connection_id
8245 }
8246 #[allow(rustdoc::invalid_html_tags)]
8247 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
8248 #[allow(clippy::needless_lifetimes)]
8249 pub fn chat_id(mut self, chat_id: V) -> Self {
8250 self.chat_id = chat_id;
8251 self
8252 }
8253 #[allow(clippy::needless_lifetimes)]
8254 pub fn get_chat_id(&'a self) -> &'a V {
8255 &self.chat_id
8256 }
8257 #[allow(rustdoc::invalid_html_tags)]
8258 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
8259 #[allow(clippy::needless_lifetimes)]
8260 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
8261 self.message_thread_id = Some(message_thread_id);
8262 self
8263 }
8264 #[allow(clippy::needless_lifetimes)]
8265 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
8266 &self.message_thread_id
8267 }
8268 #[allow(rustdoc::invalid_html_tags)]
8269 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
8270 #[allow(clippy::needless_lifetimes)]
8271 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
8272 self.direct_messages_topic_id = Some(direct_messages_topic_id);
8273 self
8274 }
8275 #[allow(clippy::needless_lifetimes)]
8276 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
8277 &self.direct_messages_topic_id
8278 }
8279 #[allow(rustdoc::invalid_html_tags)]
8280 #[doc = "Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
8281 #[allow(clippy::needless_lifetimes)]
8282 pub fn voice(mut self, voice: FileData) -> Self {
8283 self.voice = voice;
8284 self
8285 }
8286 #[allow(clippy::needless_lifetimes)]
8287 pub fn get_voice(&'a self) -> &'a FileData {
8288 &self.voice
8289 }
8290 #[allow(rustdoc::invalid_html_tags)]
8291 #[doc = "Voice message caption, 0-1024 characters after entities parsing"]
8292 #[allow(clippy::needless_lifetimes)]
8293 pub fn caption(mut self, caption: &'a str) -> Self {
8294 self.caption = Some(caption);
8295 self
8296 }
8297 #[allow(clippy::needless_lifetimes)]
8298 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
8299 &self.caption
8300 }
8301 #[allow(rustdoc::invalid_html_tags)]
8302 #[doc = "Mode for parsing entities in the voice message caption. See formatting options for more details."]
8303 #[allow(clippy::needless_lifetimes)]
8304 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
8305 self.parse_mode = Some(parse_mode);
8306 self
8307 }
8308 #[allow(clippy::needless_lifetimes)]
8309 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
8310 &self.parse_mode
8311 }
8312 #[allow(rustdoc::invalid_html_tags)]
8313 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
8314 #[allow(clippy::needless_lifetimes)]
8315 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
8316 self.caption_entities = Some(caption_entities);
8317 self
8318 }
8319 #[allow(clippy::needless_lifetimes)]
8320 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
8321 &self.caption_entities
8322 }
8323 #[allow(rustdoc::invalid_html_tags)]
8324 #[doc = "Duration of the voice message in seconds"]
8325 #[allow(clippy::needless_lifetimes)]
8326 pub fn duration(mut self, duration: i64) -> Self {
8327 self.duration = Some(duration);
8328 self
8329 }
8330 #[allow(clippy::needless_lifetimes)]
8331 pub fn get_duration(&'a self) -> &'a Option<i64> {
8332 &self.duration
8333 }
8334 #[allow(rustdoc::invalid_html_tags)]
8335 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
8336 #[allow(clippy::needless_lifetimes)]
8337 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
8338 self.disable_notification = Some(disable_notification);
8339 self
8340 }
8341 #[allow(clippy::needless_lifetimes)]
8342 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
8343 &self.disable_notification
8344 }
8345 #[allow(rustdoc::invalid_html_tags)]
8346 #[doc = "Protects the contents of the sent message from forwarding and saving"]
8347 #[allow(clippy::needless_lifetimes)]
8348 pub fn protect_content(mut self, protect_content: bool) -> Self {
8349 self.protect_content = Some(protect_content);
8350 self
8351 }
8352 #[allow(clippy::needless_lifetimes)]
8353 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
8354 &self.protect_content
8355 }
8356 #[allow(rustdoc::invalid_html_tags)]
8357 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
8358 #[allow(clippy::needless_lifetimes)]
8359 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
8360 self.allow_paid_broadcast = Some(allow_paid_broadcast);
8361 self
8362 }
8363 #[allow(clippy::needless_lifetimes)]
8364 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
8365 &self.allow_paid_broadcast
8366 }
8367 #[allow(rustdoc::invalid_html_tags)]
8368 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
8369 #[allow(clippy::needless_lifetimes)]
8370 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
8371 self.message_effect_id = Some(message_effect_id);
8372 self
8373 }
8374 #[allow(clippy::needless_lifetimes)]
8375 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
8376 &self.message_effect_id
8377 }
8378 #[allow(rustdoc::invalid_html_tags)]
8379 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
8380 #[allow(clippy::needless_lifetimes)]
8381 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
8382 where
8383 T: Into<&'a SuggestedPostParameters>,
8384 {
8385 self.suggested_post_parameters = Some(suggested_post_parameters.into());
8386 self
8387 }
8388 #[allow(clippy::needless_lifetimes)]
8389 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
8390 &self.suggested_post_parameters
8391 }
8392 #[allow(rustdoc::invalid_html_tags)]
8393 #[doc = "Description of the message to reply to"]
8394 #[allow(clippy::needless_lifetimes)]
8395 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
8396 where
8397 T: Into<&'a ReplyParameters>,
8398 {
8399 self.reply_parameters = Some(reply_parameters.into());
8400 self
8401 }
8402 #[allow(clippy::needless_lifetimes)]
8403 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
8404 &self.reply_parameters
8405 }
8406 #[allow(rustdoc::invalid_html_tags)]
8407 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
8408 #[allow(clippy::needless_lifetimes)]
8409 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
8410 where
8411 T: Into<&'a EReplyMarkup>,
8412 {
8413 self.reply_markup = Some(reply_markup.into());
8414 self
8415 }
8416 #[allow(clippy::needless_lifetimes)]
8417 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
8418 &self.reply_markup
8419 }
8420 pub async fn build(self) -> BotResult<Message> {
8421 self.bot
8422 .send_voice(
8423 self.business_connection_id,
8424 self.chat_id,
8425 self.message_thread_id,
8426 self.direct_messages_topic_id,
8427 self.voice,
8428 self.caption,
8429 self.parse_mode,
8430 self.caption_entities,
8431 self.duration,
8432 self.disable_notification,
8433 self.protect_content,
8434 self.allow_paid_broadcast,
8435 self.message_effect_id,
8436 self.suggested_post_parameters,
8437 self.reply_parameters,
8438 self.reply_markup,
8439 )
8440 .await
8441 }
8442}
8443pub struct CallEditGeneralForumTopic<'a, V> {
8444 bot: &'a Bot,
8445 chat_id: V,
8446 name: &'a str,
8447}
8448impl<'a, V: Into<ChatHandle> + Serialize> CallEditGeneralForumTopic<'a, V> {
8449 #[allow(rustdoc::invalid_html_tags)]
8450 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
8451 #[allow(clippy::needless_lifetimes)]
8452 pub fn chat_id(mut self, chat_id: V) -> Self {
8453 self.chat_id = chat_id;
8454 self
8455 }
8456 #[allow(clippy::needless_lifetimes)]
8457 pub fn get_chat_id(&'a self) -> &'a V {
8458 &self.chat_id
8459 }
8460 #[allow(rustdoc::invalid_html_tags)]
8461 #[doc = "New topic name, 1-128 characters"]
8462 #[allow(clippy::needless_lifetimes)]
8463 pub fn name(mut self, name: &'a str) -> Self {
8464 self.name = name;
8465 self
8466 }
8467 #[allow(clippy::needless_lifetimes)]
8468 pub fn get_name(&'a self) -> &'a &'a str {
8469 &self.name
8470 }
8471 pub async fn build(self) -> BotResult<bool> {
8472 self.bot
8473 .edit_general_forum_topic(self.chat_id, self.name)
8474 .await
8475 }
8476}
8477pub struct CallSavePreparedInlineMessage<'a> {
8478 bot: &'a Bot,
8479 user_id: i64,
8480 result: &'a InlineQueryResult,
8481 allow_user_chats: Option<bool>,
8482 allow_bot_chats: Option<bool>,
8483 allow_group_chats: Option<bool>,
8484 allow_channel_chats: Option<bool>,
8485}
8486impl<'a> CallSavePreparedInlineMessage<'a> {
8487 #[allow(rustdoc::invalid_html_tags)]
8488 #[doc = "Unique identifier of the target user that can use the prepared message"]
8489 #[allow(clippy::needless_lifetimes)]
8490 pub fn user_id(mut self, user_id: i64) -> Self {
8491 self.user_id = user_id;
8492 self
8493 }
8494 #[allow(clippy::needless_lifetimes)]
8495 pub fn get_user_id(&'a self) -> &'a i64 {
8496 &self.user_id
8497 }
8498 #[allow(rustdoc::invalid_html_tags)]
8499 #[doc = "A JSON-serialized object describing the message to be sent"]
8500 #[allow(clippy::needless_lifetimes)]
8501 pub fn result<T>(mut self, result: T) -> Self
8502 where
8503 T: Into<&'a InlineQueryResult>,
8504 {
8505 self.result = result.into();
8506 self
8507 }
8508 #[allow(clippy::needless_lifetimes)]
8509 pub fn get_result(&'a self) -> &'a &'a InlineQueryResult {
8510 &self.result
8511 }
8512 #[allow(rustdoc::invalid_html_tags)]
8513 #[doc = "Pass True if the message can be sent to private chats with users"]
8514 #[allow(clippy::needless_lifetimes)]
8515 pub fn allow_user_chats(mut self, allow_user_chats: bool) -> Self {
8516 self.allow_user_chats = Some(allow_user_chats);
8517 self
8518 }
8519 #[allow(clippy::needless_lifetimes)]
8520 pub fn get_allow_user_chats(&'a self) -> &'a Option<bool> {
8521 &self.allow_user_chats
8522 }
8523 #[allow(rustdoc::invalid_html_tags)]
8524 #[doc = "Pass True if the message can be sent to private chats with bots"]
8525 #[allow(clippy::needless_lifetimes)]
8526 pub fn allow_bot_chats(mut self, allow_bot_chats: bool) -> Self {
8527 self.allow_bot_chats = Some(allow_bot_chats);
8528 self
8529 }
8530 #[allow(clippy::needless_lifetimes)]
8531 pub fn get_allow_bot_chats(&'a self) -> &'a Option<bool> {
8532 &self.allow_bot_chats
8533 }
8534 #[allow(rustdoc::invalid_html_tags)]
8535 #[doc = "Pass True if the message can be sent to group and supergroup chats"]
8536 #[allow(clippy::needless_lifetimes)]
8537 pub fn allow_group_chats(mut self, allow_group_chats: bool) -> Self {
8538 self.allow_group_chats = Some(allow_group_chats);
8539 self
8540 }
8541 #[allow(clippy::needless_lifetimes)]
8542 pub fn get_allow_group_chats(&'a self) -> &'a Option<bool> {
8543 &self.allow_group_chats
8544 }
8545 #[allow(rustdoc::invalid_html_tags)]
8546 #[doc = "Pass True if the message can be sent to channel chats"]
8547 #[allow(clippy::needless_lifetimes)]
8548 pub fn allow_channel_chats(mut self, allow_channel_chats: bool) -> Self {
8549 self.allow_channel_chats = Some(allow_channel_chats);
8550 self
8551 }
8552 #[allow(clippy::needless_lifetimes)]
8553 pub fn get_allow_channel_chats(&'a self) -> &'a Option<bool> {
8554 &self.allow_channel_chats
8555 }
8556 pub async fn build(self) -> BotResult<PreparedInlineMessage> {
8557 self.bot
8558 .save_prepared_inline_message(
8559 self.user_id,
8560 self.result,
8561 self.allow_user_chats,
8562 self.allow_bot_chats,
8563 self.allow_group_chats,
8564 self.allow_channel_chats,
8565 )
8566 .await
8567 }
8568}
8569pub struct CallTransferBusinessAccountStars<'a> {
8570 bot: &'a Bot,
8571 business_connection_id: &'a str,
8572 star_count: i64,
8573}
8574impl<'a> CallTransferBusinessAccountStars<'a> {
8575 #[allow(rustdoc::invalid_html_tags)]
8576 #[doc = "Unique identifier of the business connection"]
8577 #[allow(clippy::needless_lifetimes)]
8578 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
8579 self.business_connection_id = business_connection_id;
8580 self
8581 }
8582 #[allow(clippy::needless_lifetimes)]
8583 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
8584 &self.business_connection_id
8585 }
8586 #[allow(rustdoc::invalid_html_tags)]
8587 #[doc = "Number of Telegram Stars to transfer; 1-10000"]
8588 #[allow(clippy::needless_lifetimes)]
8589 pub fn star_count(mut self, star_count: i64) -> Self {
8590 self.star_count = star_count;
8591 self
8592 }
8593 #[allow(clippy::needless_lifetimes)]
8594 pub fn get_star_count(&'a self) -> &'a i64 {
8595 &self.star_count
8596 }
8597 pub async fn build(self) -> BotResult<bool> {
8598 self.bot
8599 .transfer_business_account_stars(self.business_connection_id, self.star_count)
8600 .await
8601 }
8602}
8603pub struct CallPromoteChatMember<'a, V> {
8604 bot: &'a Bot,
8605 chat_id: V,
8606 user_id: i64,
8607 is_anonymous: Option<bool>,
8608 can_manage_chat: Option<bool>,
8609 can_delete_messages: Option<bool>,
8610 can_manage_video_chats: Option<bool>,
8611 can_restrict_members: Option<bool>,
8612 can_promote_members: Option<bool>,
8613 can_change_info: Option<bool>,
8614 can_invite_users: Option<bool>,
8615 can_post_stories: Option<bool>,
8616 can_edit_stories: Option<bool>,
8617 can_delete_stories: Option<bool>,
8618 can_post_messages: Option<bool>,
8619 can_edit_messages: Option<bool>,
8620 can_pin_messages: Option<bool>,
8621 can_manage_topics: Option<bool>,
8622 can_manage_direct_messages: Option<bool>,
8623}
8624impl<'a, V: Into<ChatHandle> + Serialize> CallPromoteChatMember<'a, V> {
8625 #[allow(rustdoc::invalid_html_tags)]
8626 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
8627 #[allow(clippy::needless_lifetimes)]
8628 pub fn chat_id(mut self, chat_id: V) -> Self {
8629 self.chat_id = chat_id;
8630 self
8631 }
8632 #[allow(clippy::needless_lifetimes)]
8633 pub fn get_chat_id(&'a self) -> &'a V {
8634 &self.chat_id
8635 }
8636 #[allow(rustdoc::invalid_html_tags)]
8637 #[doc = "Unique identifier of the target user"]
8638 #[allow(clippy::needless_lifetimes)]
8639 pub fn user_id(mut self, user_id: i64) -> Self {
8640 self.user_id = user_id;
8641 self
8642 }
8643 #[allow(clippy::needless_lifetimes)]
8644 pub fn get_user_id(&'a self) -> &'a i64 {
8645 &self.user_id
8646 }
8647 #[allow(rustdoc::invalid_html_tags)]
8648 #[doc = "Pass True if the administrator's presence in the chat is hidden"]
8649 #[allow(clippy::needless_lifetimes)]
8650 pub fn is_anonymous(mut self, is_anonymous: bool) -> Self {
8651 self.is_anonymous = Some(is_anonymous);
8652 self
8653 }
8654 #[allow(clippy::needless_lifetimes)]
8655 pub fn get_is_anonymous(&'a self) -> &'a Option<bool> {
8656 &self.is_anonymous
8657 }
8658 #[allow(rustdoc::invalid_html_tags)]
8659 #[doc = "Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege."]
8660 #[allow(clippy::needless_lifetimes)]
8661 pub fn can_manage_chat(mut self, can_manage_chat: bool) -> Self {
8662 self.can_manage_chat = Some(can_manage_chat);
8663 self
8664 }
8665 #[allow(clippy::needless_lifetimes)]
8666 pub fn get_can_manage_chat(&'a self) -> &'a Option<bool> {
8667 &self.can_manage_chat
8668 }
8669 #[allow(rustdoc::invalid_html_tags)]
8670 #[doc = "Pass True if the administrator can delete messages of other users"]
8671 #[allow(clippy::needless_lifetimes)]
8672 pub fn can_delete_messages(mut self, can_delete_messages: bool) -> Self {
8673 self.can_delete_messages = Some(can_delete_messages);
8674 self
8675 }
8676 #[allow(clippy::needless_lifetimes)]
8677 pub fn get_can_delete_messages(&'a self) -> &'a Option<bool> {
8678 &self.can_delete_messages
8679 }
8680 #[allow(rustdoc::invalid_html_tags)]
8681 #[doc = "Pass True if the administrator can manage video chats"]
8682 #[allow(clippy::needless_lifetimes)]
8683 pub fn can_manage_video_chats(mut self, can_manage_video_chats: bool) -> Self {
8684 self.can_manage_video_chats = Some(can_manage_video_chats);
8685 self
8686 }
8687 #[allow(clippy::needless_lifetimes)]
8688 pub fn get_can_manage_video_chats(&'a self) -> &'a Option<bool> {
8689 &self.can_manage_video_chats
8690 }
8691 #[allow(rustdoc::invalid_html_tags)]
8692 #[doc = "Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics"]
8693 #[allow(clippy::needless_lifetimes)]
8694 pub fn can_restrict_members(mut self, can_restrict_members: bool) -> Self {
8695 self.can_restrict_members = Some(can_restrict_members);
8696 self
8697 }
8698 #[allow(clippy::needless_lifetimes)]
8699 pub fn get_can_restrict_members(&'a self) -> &'a Option<bool> {
8700 &self.can_restrict_members
8701 }
8702 #[allow(rustdoc::invalid_html_tags)]
8703 #[doc = "Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"]
8704 #[allow(clippy::needless_lifetimes)]
8705 pub fn can_promote_members(mut self, can_promote_members: bool) -> Self {
8706 self.can_promote_members = Some(can_promote_members);
8707 self
8708 }
8709 #[allow(clippy::needless_lifetimes)]
8710 pub fn get_can_promote_members(&'a self) -> &'a Option<bool> {
8711 &self.can_promote_members
8712 }
8713 #[allow(rustdoc::invalid_html_tags)]
8714 #[doc = "Pass True if the administrator can change chat title, photo and other settings"]
8715 #[allow(clippy::needless_lifetimes)]
8716 pub fn can_change_info(mut self, can_change_info: bool) -> Self {
8717 self.can_change_info = Some(can_change_info);
8718 self
8719 }
8720 #[allow(clippy::needless_lifetimes)]
8721 pub fn get_can_change_info(&'a self) -> &'a Option<bool> {
8722 &self.can_change_info
8723 }
8724 #[allow(rustdoc::invalid_html_tags)]
8725 #[doc = "Pass True if the administrator can invite new users to the chat"]
8726 #[allow(clippy::needless_lifetimes)]
8727 pub fn can_invite_users(mut self, can_invite_users: bool) -> Self {
8728 self.can_invite_users = Some(can_invite_users);
8729 self
8730 }
8731 #[allow(clippy::needless_lifetimes)]
8732 pub fn get_can_invite_users(&'a self) -> &'a Option<bool> {
8733 &self.can_invite_users
8734 }
8735 #[allow(rustdoc::invalid_html_tags)]
8736 #[doc = "Pass True if the administrator can post stories to the chat"]
8737 #[allow(clippy::needless_lifetimes)]
8738 pub fn can_post_stories(mut self, can_post_stories: bool) -> Self {
8739 self.can_post_stories = Some(can_post_stories);
8740 self
8741 }
8742 #[allow(clippy::needless_lifetimes)]
8743 pub fn get_can_post_stories(&'a self) -> &'a Option<bool> {
8744 &self.can_post_stories
8745 }
8746 #[allow(rustdoc::invalid_html_tags)]
8747 #[doc = "Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"]
8748 #[allow(clippy::needless_lifetimes)]
8749 pub fn can_edit_stories(mut self, can_edit_stories: bool) -> Self {
8750 self.can_edit_stories = Some(can_edit_stories);
8751 self
8752 }
8753 #[allow(clippy::needless_lifetimes)]
8754 pub fn get_can_edit_stories(&'a self) -> &'a Option<bool> {
8755 &self.can_edit_stories
8756 }
8757 #[allow(rustdoc::invalid_html_tags)]
8758 #[doc = "Pass True if the administrator can delete stories posted by other users"]
8759 #[allow(clippy::needless_lifetimes)]
8760 pub fn can_delete_stories(mut self, can_delete_stories: bool) -> Self {
8761 self.can_delete_stories = Some(can_delete_stories);
8762 self
8763 }
8764 #[allow(clippy::needless_lifetimes)]
8765 pub fn get_can_delete_stories(&'a self) -> &'a Option<bool> {
8766 &self.can_delete_stories
8767 }
8768 #[allow(rustdoc::invalid_html_tags)]
8769 #[doc = "Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only"]
8770 #[allow(clippy::needless_lifetimes)]
8771 pub fn can_post_messages(mut self, can_post_messages: bool) -> Self {
8772 self.can_post_messages = Some(can_post_messages);
8773 self
8774 }
8775 #[allow(clippy::needless_lifetimes)]
8776 pub fn get_can_post_messages(&'a self) -> &'a Option<bool> {
8777 &self.can_post_messages
8778 }
8779 #[allow(rustdoc::invalid_html_tags)]
8780 #[doc = "Pass True if the administrator can edit messages of other users and can pin messages; for channels only"]
8781 #[allow(clippy::needless_lifetimes)]
8782 pub fn can_edit_messages(mut self, can_edit_messages: bool) -> Self {
8783 self.can_edit_messages = Some(can_edit_messages);
8784 self
8785 }
8786 #[allow(clippy::needless_lifetimes)]
8787 pub fn get_can_edit_messages(&'a self) -> &'a Option<bool> {
8788 &self.can_edit_messages
8789 }
8790 #[allow(rustdoc::invalid_html_tags)]
8791 #[doc = "Pass True if the administrator can pin messages; for supergroups only"]
8792 #[allow(clippy::needless_lifetimes)]
8793 pub fn can_pin_messages(mut self, can_pin_messages: bool) -> Self {
8794 self.can_pin_messages = Some(can_pin_messages);
8795 self
8796 }
8797 #[allow(clippy::needless_lifetimes)]
8798 pub fn get_can_pin_messages(&'a self) -> &'a Option<bool> {
8799 &self.can_pin_messages
8800 }
8801 #[allow(rustdoc::invalid_html_tags)]
8802 #[doc = "Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"]
8803 #[allow(clippy::needless_lifetimes)]
8804 pub fn can_manage_topics(mut self, can_manage_topics: bool) -> Self {
8805 self.can_manage_topics = Some(can_manage_topics);
8806 self
8807 }
8808 #[allow(clippy::needless_lifetimes)]
8809 pub fn get_can_manage_topics(&'a self) -> &'a Option<bool> {
8810 &self.can_manage_topics
8811 }
8812 #[allow(rustdoc::invalid_html_tags)]
8813 #[doc = "Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only"]
8814 #[allow(clippy::needless_lifetimes)]
8815 pub fn can_manage_direct_messages(mut self, can_manage_direct_messages: bool) -> Self {
8816 self.can_manage_direct_messages = Some(can_manage_direct_messages);
8817 self
8818 }
8819 #[allow(clippy::needless_lifetimes)]
8820 pub fn get_can_manage_direct_messages(&'a self) -> &'a Option<bool> {
8821 &self.can_manage_direct_messages
8822 }
8823 pub async fn build(self) -> BotResult<bool> {
8824 self.bot
8825 .promote_chat_member(
8826 self.chat_id,
8827 self.user_id,
8828 self.is_anonymous,
8829 self.can_manage_chat,
8830 self.can_delete_messages,
8831 self.can_manage_video_chats,
8832 self.can_restrict_members,
8833 self.can_promote_members,
8834 self.can_change_info,
8835 self.can_invite_users,
8836 self.can_post_stories,
8837 self.can_edit_stories,
8838 self.can_delete_stories,
8839 self.can_post_messages,
8840 self.can_edit_messages,
8841 self.can_pin_messages,
8842 self.can_manage_topics,
8843 self.can_manage_direct_messages,
8844 )
8845 .await
8846 }
8847}
8848pub struct CallPinChatMessage<'a, V> {
8849 bot: &'a Bot,
8850 business_connection_id: Option<&'a str>,
8851 chat_id: V,
8852 message_id: i64,
8853 disable_notification: Option<bool>,
8854}
8855impl<'a, V: Into<ChatHandle> + Serialize> CallPinChatMessage<'a, V> {
8856 #[allow(rustdoc::invalid_html_tags)]
8857 #[doc = "Unique identifier of the business connection on behalf of which the message will be pinned"]
8858 #[allow(clippy::needless_lifetimes)]
8859 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
8860 self.business_connection_id = Some(business_connection_id);
8861 self
8862 }
8863 #[allow(clippy::needless_lifetimes)]
8864 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
8865 &self.business_connection_id
8866 }
8867 #[allow(rustdoc::invalid_html_tags)]
8868 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
8869 #[allow(clippy::needless_lifetimes)]
8870 pub fn chat_id(mut self, chat_id: V) -> Self {
8871 self.chat_id = chat_id;
8872 self
8873 }
8874 #[allow(clippy::needless_lifetimes)]
8875 pub fn get_chat_id(&'a self) -> &'a V {
8876 &self.chat_id
8877 }
8878 #[allow(rustdoc::invalid_html_tags)]
8879 #[doc = "Identifier of a message to pin"]
8880 #[allow(clippy::needless_lifetimes)]
8881 pub fn message_id(mut self, message_id: i64) -> Self {
8882 self.message_id = message_id;
8883 self
8884 }
8885 #[allow(clippy::needless_lifetimes)]
8886 pub fn get_message_id(&'a self) -> &'a i64 {
8887 &self.message_id
8888 }
8889 #[allow(rustdoc::invalid_html_tags)]
8890 #[doc = "Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."]
8891 #[allow(clippy::needless_lifetimes)]
8892 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
8893 self.disable_notification = Some(disable_notification);
8894 self
8895 }
8896 #[allow(clippy::needless_lifetimes)]
8897 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
8898 &self.disable_notification
8899 }
8900 pub async fn build(self) -> BotResult<bool> {
8901 self.bot
8902 .pin_chat_message(
8903 self.business_connection_id,
8904 self.chat_id,
8905 self.message_id,
8906 self.disable_notification,
8907 )
8908 .await
8909 }
8910}
8911pub struct CallGetMyShortDescription<'a> {
8912 bot: &'a Bot,
8913 language_code: Option<&'a str>,
8914}
8915impl<'a> CallGetMyShortDescription<'a> {
8916 #[allow(rustdoc::invalid_html_tags)]
8917 #[doc = "A two-letter ISO 639-1 language code or an empty string"]
8918 #[allow(clippy::needless_lifetimes)]
8919 pub fn language_code(mut self, language_code: &'a str) -> Self {
8920 self.language_code = Some(language_code);
8921 self
8922 }
8923 #[allow(clippy::needless_lifetimes)]
8924 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
8925 &self.language_code
8926 }
8927 pub async fn build(self) -> BotResult<BotShortDescription> {
8928 self.bot.get_my_short_description(self.language_code).await
8929 }
8930}
8931pub struct CallCreateInvoiceLink<'a> {
8932 bot: &'a Bot,
8933 business_connection_id: Option<&'a str>,
8934 title: &'a str,
8935 description: &'a str,
8936 payload: &'a str,
8937 provider_token: Option<&'a str>,
8938 currency: &'a str,
8939 prices: &'a Vec<LabeledPrice>,
8940 subscription_period: Option<i64>,
8941 max_tip_amount: Option<i64>,
8942 suggested_tip_amounts: Option<&'a Vec<i64>>,
8943 provider_data: Option<&'a str>,
8944 photo_url: Option<&'a str>,
8945 photo_size: Option<i64>,
8946 photo_width: Option<i64>,
8947 photo_height: Option<i64>,
8948 need_name: Option<bool>,
8949 need_phone_number: Option<bool>,
8950 need_email: Option<bool>,
8951 need_shipping_address: Option<bool>,
8952 send_phone_number_to_provider: Option<bool>,
8953 send_email_to_provider: Option<bool>,
8954 is_flexible: Option<bool>,
8955}
8956impl<'a> CallCreateInvoiceLink<'a> {
8957 #[allow(rustdoc::invalid_html_tags)]
8958 #[doc = "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only."]
8959 #[allow(clippy::needless_lifetimes)]
8960 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
8961 self.business_connection_id = Some(business_connection_id);
8962 self
8963 }
8964 #[allow(clippy::needless_lifetimes)]
8965 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
8966 &self.business_connection_id
8967 }
8968 #[allow(rustdoc::invalid_html_tags)]
8969 #[doc = "Product name, 1-32 characters"]
8970 #[allow(clippy::needless_lifetimes)]
8971 pub fn title(mut self, title: &'a str) -> Self {
8972 self.title = title;
8973 self
8974 }
8975 #[allow(clippy::needless_lifetimes)]
8976 pub fn get_title(&'a self) -> &'a &'a str {
8977 &self.title
8978 }
8979 #[allow(rustdoc::invalid_html_tags)]
8980 #[doc = "Product description, 1-255 characters"]
8981 #[allow(clippy::needless_lifetimes)]
8982 pub fn description(mut self, description: &'a str) -> Self {
8983 self.description = description;
8984 self
8985 }
8986 #[allow(clippy::needless_lifetimes)]
8987 pub fn get_description(&'a self) -> &'a &'a str {
8988 &self.description
8989 }
8990 #[allow(rustdoc::invalid_html_tags)]
8991 #[doc = "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."]
8992 #[allow(clippy::needless_lifetimes)]
8993 pub fn payload(mut self, payload: &'a str) -> Self {
8994 self.payload = payload;
8995 self
8996 }
8997 #[allow(clippy::needless_lifetimes)]
8998 pub fn get_payload(&'a self) -> &'a &'a str {
8999 &self.payload
9000 }
9001 #[allow(rustdoc::invalid_html_tags)]
9002 #[doc = "Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."]
9003 #[allow(clippy::needless_lifetimes)]
9004 pub fn provider_token(mut self, provider_token: &'a str) -> Self {
9005 self.provider_token = Some(provider_token);
9006 self
9007 }
9008 #[allow(clippy::needless_lifetimes)]
9009 pub fn get_provider_token(&'a self) -> &'a Option<&'a str> {
9010 &self.provider_token
9011 }
9012 #[allow(rustdoc::invalid_html_tags)]
9013 #[doc = "Three-letter ISO 4217 currency code, see more on currencies. Pass \"XTR\" for payments in Telegram Stars."]
9014 #[allow(clippy::needless_lifetimes)]
9015 pub fn currency(mut self, currency: &'a str) -> Self {
9016 self.currency = currency;
9017 self
9018 }
9019 #[allow(clippy::needless_lifetimes)]
9020 pub fn get_currency(&'a self) -> &'a &'a str {
9021 &self.currency
9022 }
9023 #[allow(rustdoc::invalid_html_tags)]
9024 #[doc = "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."]
9025 #[allow(clippy::needless_lifetimes)]
9026 pub fn prices(mut self, prices: &'a Vec<LabeledPrice>) -> Self {
9027 self.prices = prices;
9028 self
9029 }
9030 #[allow(clippy::needless_lifetimes)]
9031 pub fn get_prices(&'a self) -> &'a &'a Vec<LabeledPrice> {
9032 &self.prices
9033 }
9034 #[allow(rustdoc::invalid_html_tags)]
9035 #[doc = "The number of seconds the subscription will be active for before the next payment. The currency must be set to \"XTR\" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars."]
9036 #[allow(clippy::needless_lifetimes)]
9037 pub fn subscription_period(mut self, subscription_period: i64) -> Self {
9038 self.subscription_period = Some(subscription_period);
9039 self
9040 }
9041 #[allow(clippy::needless_lifetimes)]
9042 pub fn get_subscription_period(&'a self) -> &'a Option<i64> {
9043 &self.subscription_period
9044 }
9045 #[allow(rustdoc::invalid_html_tags)]
9046 #[doc = "The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."]
9047 #[allow(clippy::needless_lifetimes)]
9048 pub fn max_tip_amount(mut self, max_tip_amount: i64) -> Self {
9049 self.max_tip_amount = Some(max_tip_amount);
9050 self
9051 }
9052 #[allow(clippy::needless_lifetimes)]
9053 pub fn get_max_tip_amount(&'a self) -> &'a Option<i64> {
9054 &self.max_tip_amount
9055 }
9056 #[allow(rustdoc::invalid_html_tags)]
9057 #[doc = "A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount."]
9058 #[allow(clippy::needless_lifetimes)]
9059 pub fn suggested_tip_amounts(mut self, suggested_tip_amounts: &'a Vec<i64>) -> Self {
9060 self.suggested_tip_amounts = Some(suggested_tip_amounts);
9061 self
9062 }
9063 #[allow(clippy::needless_lifetimes)]
9064 pub fn get_suggested_tip_amounts(&'a self) -> &'a Option<&'a Vec<i64>> {
9065 &self.suggested_tip_amounts
9066 }
9067 #[allow(rustdoc::invalid_html_tags)]
9068 #[doc = "JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."]
9069 #[allow(clippy::needless_lifetimes)]
9070 pub fn provider_data(mut self, provider_data: &'a str) -> Self {
9071 self.provider_data = Some(provider_data);
9072 self
9073 }
9074 #[allow(clippy::needless_lifetimes)]
9075 pub fn get_provider_data(&'a self) -> &'a Option<&'a str> {
9076 &self.provider_data
9077 }
9078 #[allow(rustdoc::invalid_html_tags)]
9079 #[doc = "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."]
9080 #[allow(clippy::needless_lifetimes)]
9081 pub fn photo_url(mut self, photo_url: &'a str) -> Self {
9082 self.photo_url = Some(photo_url);
9083 self
9084 }
9085 #[allow(clippy::needless_lifetimes)]
9086 pub fn get_photo_url(&'a self) -> &'a Option<&'a str> {
9087 &self.photo_url
9088 }
9089 #[allow(rustdoc::invalid_html_tags)]
9090 #[doc = "Photo size in bytes"]
9091 #[allow(clippy::needless_lifetimes)]
9092 pub fn photo_size(mut self, photo_size: i64) -> Self {
9093 self.photo_size = Some(photo_size);
9094 self
9095 }
9096 #[allow(clippy::needless_lifetimes)]
9097 pub fn get_photo_size(&'a self) -> &'a Option<i64> {
9098 &self.photo_size
9099 }
9100 #[allow(rustdoc::invalid_html_tags)]
9101 #[doc = "Photo width"]
9102 #[allow(clippy::needless_lifetimes)]
9103 pub fn photo_width(mut self, photo_width: i64) -> Self {
9104 self.photo_width = Some(photo_width);
9105 self
9106 }
9107 #[allow(clippy::needless_lifetimes)]
9108 pub fn get_photo_width(&'a self) -> &'a Option<i64> {
9109 &self.photo_width
9110 }
9111 #[allow(rustdoc::invalid_html_tags)]
9112 #[doc = "Photo height"]
9113 #[allow(clippy::needless_lifetimes)]
9114 pub fn photo_height(mut self, photo_height: i64) -> Self {
9115 self.photo_height = Some(photo_height);
9116 self
9117 }
9118 #[allow(clippy::needless_lifetimes)]
9119 pub fn get_photo_height(&'a self) -> &'a Option<i64> {
9120 &self.photo_height
9121 }
9122 #[allow(rustdoc::invalid_html_tags)]
9123 #[doc = "Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."]
9124 #[allow(clippy::needless_lifetimes)]
9125 pub fn need_name(mut self, need_name: bool) -> Self {
9126 self.need_name = Some(need_name);
9127 self
9128 }
9129 #[allow(clippy::needless_lifetimes)]
9130 pub fn get_need_name(&'a self) -> &'a Option<bool> {
9131 &self.need_name
9132 }
9133 #[allow(rustdoc::invalid_html_tags)]
9134 #[doc = "Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."]
9135 #[allow(clippy::needless_lifetimes)]
9136 pub fn need_phone_number(mut self, need_phone_number: bool) -> Self {
9137 self.need_phone_number = Some(need_phone_number);
9138 self
9139 }
9140 #[allow(clippy::needless_lifetimes)]
9141 pub fn get_need_phone_number(&'a self) -> &'a Option<bool> {
9142 &self.need_phone_number
9143 }
9144 #[allow(rustdoc::invalid_html_tags)]
9145 #[doc = "Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."]
9146 #[allow(clippy::needless_lifetimes)]
9147 pub fn need_email(mut self, need_email: bool) -> Self {
9148 self.need_email = Some(need_email);
9149 self
9150 }
9151 #[allow(clippy::needless_lifetimes)]
9152 pub fn get_need_email(&'a self) -> &'a Option<bool> {
9153 &self.need_email
9154 }
9155 #[allow(rustdoc::invalid_html_tags)]
9156 #[doc = "Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."]
9157 #[allow(clippy::needless_lifetimes)]
9158 pub fn need_shipping_address(mut self, need_shipping_address: bool) -> Self {
9159 self.need_shipping_address = Some(need_shipping_address);
9160 self
9161 }
9162 #[allow(clippy::needless_lifetimes)]
9163 pub fn get_need_shipping_address(&'a self) -> &'a Option<bool> {
9164 &self.need_shipping_address
9165 }
9166 #[allow(rustdoc::invalid_html_tags)]
9167 #[doc = "Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."]
9168 #[allow(clippy::needless_lifetimes)]
9169 pub fn send_phone_number_to_provider(mut self, send_phone_number_to_provider: bool) -> Self {
9170 self.send_phone_number_to_provider = Some(send_phone_number_to_provider);
9171 self
9172 }
9173 #[allow(clippy::needless_lifetimes)]
9174 pub fn get_send_phone_number_to_provider(&'a self) -> &'a Option<bool> {
9175 &self.send_phone_number_to_provider
9176 }
9177 #[allow(rustdoc::invalid_html_tags)]
9178 #[doc = "Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."]
9179 #[allow(clippy::needless_lifetimes)]
9180 pub fn send_email_to_provider(mut self, send_email_to_provider: bool) -> Self {
9181 self.send_email_to_provider = Some(send_email_to_provider);
9182 self
9183 }
9184 #[allow(clippy::needless_lifetimes)]
9185 pub fn get_send_email_to_provider(&'a self) -> &'a Option<bool> {
9186 &self.send_email_to_provider
9187 }
9188 #[allow(rustdoc::invalid_html_tags)]
9189 #[doc = "Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."]
9190 #[allow(clippy::needless_lifetimes)]
9191 pub fn is_flexible(mut self, is_flexible: bool) -> Self {
9192 self.is_flexible = Some(is_flexible);
9193 self
9194 }
9195 #[allow(clippy::needless_lifetimes)]
9196 pub fn get_is_flexible(&'a self) -> &'a Option<bool> {
9197 &self.is_flexible
9198 }
9199 pub async fn build(self) -> BotResult<String> {
9200 self.bot
9201 .create_invoice_link(
9202 self.business_connection_id,
9203 self.title,
9204 self.description,
9205 self.payload,
9206 self.provider_token,
9207 self.currency,
9208 self.prices,
9209 self.subscription_period,
9210 self.max_tip_amount,
9211 self.suggested_tip_amounts,
9212 self.provider_data,
9213 self.photo_url,
9214 self.photo_size,
9215 self.photo_width,
9216 self.photo_height,
9217 self.need_name,
9218 self.need_phone_number,
9219 self.need_email,
9220 self.need_shipping_address,
9221 self.send_phone_number_to_provider,
9222 self.send_email_to_provider,
9223 self.is_flexible,
9224 )
9225 .await
9226 }
9227}
9228pub struct CallGetAvailableGifts<'a> {
9229 bot: &'a Bot,
9230}
9231impl<'a> CallGetAvailableGifts<'a> {
9232 pub async fn build(self) -> BotResult<Gifts> {
9233 self.bot.get_available_gifts().await
9234 }
9235}
9236pub struct CallSetChatPhoto<'a, V> {
9237 bot: &'a Bot,
9238 chat_id: V,
9239 photo: FileData,
9240}
9241impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatPhoto<'a, V> {
9242 #[allow(rustdoc::invalid_html_tags)]
9243 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
9244 #[allow(clippy::needless_lifetimes)]
9245 pub fn chat_id(mut self, chat_id: V) -> Self {
9246 self.chat_id = chat_id;
9247 self
9248 }
9249 #[allow(clippy::needless_lifetimes)]
9250 pub fn get_chat_id(&'a self) -> &'a V {
9251 &self.chat_id
9252 }
9253 #[allow(rustdoc::invalid_html_tags)]
9254 #[doc = "New chat photo, uploaded using multipart/form-data"]
9255 #[allow(clippy::needless_lifetimes)]
9256 pub fn photo(mut self, photo: FileData) -> Self {
9257 self.photo = photo;
9258 self
9259 }
9260 #[allow(clippy::needless_lifetimes)]
9261 pub fn get_photo(&'a self) -> &'a FileData {
9262 &self.photo
9263 }
9264 pub async fn build(self) -> BotResult<bool> {
9265 self.bot.set_chat_photo(self.chat_id, self.photo).await
9266 }
9267}
9268pub struct CallSetMyDescription<'a> {
9269 bot: &'a Bot,
9270 description: Option<&'a str>,
9271 language_code: Option<&'a str>,
9272}
9273impl<'a> CallSetMyDescription<'a> {
9274 #[allow(rustdoc::invalid_html_tags)]
9275 #[doc = "New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language."]
9276 #[allow(clippy::needless_lifetimes)]
9277 pub fn description(mut self, description: &'a str) -> Self {
9278 self.description = Some(description);
9279 self
9280 }
9281 #[allow(clippy::needless_lifetimes)]
9282 pub fn get_description(&'a self) -> &'a Option<&'a str> {
9283 &self.description
9284 }
9285 #[allow(rustdoc::invalid_html_tags)]
9286 #[doc = "A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description."]
9287 #[allow(clippy::needless_lifetimes)]
9288 pub fn language_code(mut self, language_code: &'a str) -> Self {
9289 self.language_code = Some(language_code);
9290 self
9291 }
9292 #[allow(clippy::needless_lifetimes)]
9293 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
9294 &self.language_code
9295 }
9296 pub async fn build(self) -> BotResult<bool> {
9297 self.bot
9298 .set_my_description(self.description, self.language_code)
9299 .await
9300 }
9301}
9302pub struct CallSetMyName<'a> {
9303 bot: &'a Bot,
9304 name: Option<&'a str>,
9305 language_code: Option<&'a str>,
9306}
9307impl<'a> CallSetMyName<'a> {
9308 #[allow(rustdoc::invalid_html_tags)]
9309 #[doc = "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language."]
9310 #[allow(clippy::needless_lifetimes)]
9311 pub fn name(mut self, name: &'a str) -> Self {
9312 self.name = Some(name);
9313 self
9314 }
9315 #[allow(clippy::needless_lifetimes)]
9316 pub fn get_name(&'a self) -> &'a Option<&'a str> {
9317 &self.name
9318 }
9319 #[allow(rustdoc::invalid_html_tags)]
9320 #[doc = "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name."]
9321 #[allow(clippy::needless_lifetimes)]
9322 pub fn language_code(mut self, language_code: &'a str) -> Self {
9323 self.language_code = Some(language_code);
9324 self
9325 }
9326 #[allow(clippy::needless_lifetimes)]
9327 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
9328 &self.language_code
9329 }
9330 pub async fn build(self) -> BotResult<bool> {
9331 self.bot.set_my_name(self.name, self.language_code).await
9332 }
9333}
9334pub struct CallSetMyCommands<'a> {
9335 bot: &'a Bot,
9336 commands: &'a Vec<BotCommand>,
9337 scope: Option<&'a BotCommandScope>,
9338 language_code: Option<&'a str>,
9339}
9340impl<'a> CallSetMyCommands<'a> {
9341 #[allow(rustdoc::invalid_html_tags)]
9342 #[doc = "A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."]
9343 #[allow(clippy::needless_lifetimes)]
9344 pub fn commands(mut self, commands: &'a Vec<BotCommand>) -> Self {
9345 self.commands = commands;
9346 self
9347 }
9348 #[allow(clippy::needless_lifetimes)]
9349 pub fn get_commands(&'a self) -> &'a &'a Vec<BotCommand> {
9350 &self.commands
9351 }
9352 #[allow(rustdoc::invalid_html_tags)]
9353 #[doc = "A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault."]
9354 #[allow(clippy::needless_lifetimes)]
9355 pub fn scope<T>(mut self, scope: T) -> Self
9356 where
9357 T: Into<&'a BotCommandScope>,
9358 {
9359 self.scope = Some(scope.into());
9360 self
9361 }
9362 #[allow(clippy::needless_lifetimes)]
9363 pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
9364 &self.scope
9365 }
9366 #[allow(rustdoc::invalid_html_tags)]
9367 #[doc = "A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"]
9368 #[allow(clippy::needless_lifetimes)]
9369 pub fn language_code(mut self, language_code: &'a str) -> Self {
9370 self.language_code = Some(language_code);
9371 self
9372 }
9373 #[allow(clippy::needless_lifetimes)]
9374 pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
9375 &self.language_code
9376 }
9377 pub async fn build(self) -> BotResult<bool> {
9378 self.bot
9379 .set_my_commands(self.commands, self.scope, self.language_code)
9380 .await
9381 }
9382}
9383pub struct CallEditMessageCaption<'a, V> {
9384 bot: &'a Bot,
9385 business_connection_id: Option<&'a str>,
9386 chat_id: Option<V>,
9387 message_id: Option<i64>,
9388 inline_message_id: Option<&'a str>,
9389 caption: Option<&'a str>,
9390 parse_mode: Option<&'a str>,
9391 caption_entities: Option<&'a Vec<MessageEntity>>,
9392 show_caption_above_media: Option<bool>,
9393 reply_markup: Option<&'a InlineKeyboardMarkup>,
9394}
9395impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageCaption<'a, V> {
9396 #[allow(rustdoc::invalid_html_tags)]
9397 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
9398 #[allow(clippy::needless_lifetimes)]
9399 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
9400 self.business_connection_id = Some(business_connection_id);
9401 self
9402 }
9403 #[allow(clippy::needless_lifetimes)]
9404 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
9405 &self.business_connection_id
9406 }
9407 #[allow(rustdoc::invalid_html_tags)]
9408 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
9409 #[allow(clippy::needless_lifetimes)]
9410 pub fn chat_id(mut self, chat_id: V) -> Self {
9411 self.chat_id = Some(chat_id);
9412 self
9413 }
9414 #[allow(clippy::needless_lifetimes)]
9415 pub fn get_chat_id(&'a self) -> &'a Option<V> {
9416 &self.chat_id
9417 }
9418 #[allow(rustdoc::invalid_html_tags)]
9419 #[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
9420 #[allow(clippy::needless_lifetimes)]
9421 pub fn message_id(mut self, message_id: i64) -> Self {
9422 self.message_id = Some(message_id);
9423 self
9424 }
9425 #[allow(clippy::needless_lifetimes)]
9426 pub fn get_message_id(&'a self) -> &'a Option<i64> {
9427 &self.message_id
9428 }
9429 #[allow(rustdoc::invalid_html_tags)]
9430 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
9431 #[allow(clippy::needless_lifetimes)]
9432 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
9433 self.inline_message_id = Some(inline_message_id);
9434 self
9435 }
9436 #[allow(clippy::needless_lifetimes)]
9437 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
9438 &self.inline_message_id
9439 }
9440 #[allow(rustdoc::invalid_html_tags)]
9441 #[doc = "New caption of the message, 0-1024 characters after entities parsing"]
9442 #[allow(clippy::needless_lifetimes)]
9443 pub fn caption(mut self, caption: &'a str) -> Self {
9444 self.caption = Some(caption);
9445 self
9446 }
9447 #[allow(clippy::needless_lifetimes)]
9448 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
9449 &self.caption
9450 }
9451 #[allow(rustdoc::invalid_html_tags)]
9452 #[doc = "Mode for parsing entities in the message caption. See formatting options for more details."]
9453 #[allow(clippy::needless_lifetimes)]
9454 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
9455 self.parse_mode = Some(parse_mode);
9456 self
9457 }
9458 #[allow(clippy::needless_lifetimes)]
9459 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
9460 &self.parse_mode
9461 }
9462 #[allow(rustdoc::invalid_html_tags)]
9463 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
9464 #[allow(clippy::needless_lifetimes)]
9465 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
9466 self.caption_entities = Some(caption_entities);
9467 self
9468 }
9469 #[allow(clippy::needless_lifetimes)]
9470 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
9471 &self.caption_entities
9472 }
9473 #[allow(rustdoc::invalid_html_tags)]
9474 #[doc = "Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages."]
9475 #[allow(clippy::needless_lifetimes)]
9476 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
9477 self.show_caption_above_media = Some(show_caption_above_media);
9478 self
9479 }
9480 #[allow(clippy::needless_lifetimes)]
9481 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
9482 &self.show_caption_above_media
9483 }
9484 #[allow(rustdoc::invalid_html_tags)]
9485 #[doc = "A JSON-serialized object for an inline keyboard."]
9486 #[allow(clippy::needless_lifetimes)]
9487 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
9488 where
9489 T: Into<&'a InlineKeyboardMarkup>,
9490 {
9491 self.reply_markup = Some(reply_markup.into());
9492 self
9493 }
9494 #[allow(clippy::needless_lifetimes)]
9495 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
9496 &self.reply_markup
9497 }
9498 pub async fn build(self) -> BotResult<MessageBool> {
9499 self.bot
9500 .edit_message_caption(
9501 self.business_connection_id,
9502 self.chat_id,
9503 self.message_id,
9504 self.inline_message_id,
9505 self.caption,
9506 self.parse_mode,
9507 self.caption_entities,
9508 self.show_caption_above_media,
9509 self.reply_markup,
9510 )
9511 .await
9512 }
9513}
9514pub struct CallDeleteStory<'a> {
9515 bot: &'a Bot,
9516 business_connection_id: &'a str,
9517 story_id: i64,
9518}
9519impl<'a> CallDeleteStory<'a> {
9520 #[allow(rustdoc::invalid_html_tags)]
9521 #[doc = "Unique identifier of the business connection"]
9522 #[allow(clippy::needless_lifetimes)]
9523 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
9524 self.business_connection_id = business_connection_id;
9525 self
9526 }
9527 #[allow(clippy::needless_lifetimes)]
9528 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
9529 &self.business_connection_id
9530 }
9531 #[allow(rustdoc::invalid_html_tags)]
9532 #[doc = "Unique identifier of the story to delete"]
9533 #[allow(clippy::needless_lifetimes)]
9534 pub fn story_id(mut self, story_id: i64) -> Self {
9535 self.story_id = story_id;
9536 self
9537 }
9538 #[allow(clippy::needless_lifetimes)]
9539 pub fn get_story_id(&'a self) -> &'a i64 {
9540 &self.story_id
9541 }
9542 pub async fn build(self) -> BotResult<bool> {
9543 self.bot
9544 .delete_story(self.business_connection_id, self.story_id)
9545 .await
9546 }
9547}
9548pub struct CallDeleteBusinessMessages<'a> {
9549 bot: &'a Bot,
9550 business_connection_id: &'a str,
9551 message_ids: &'a Vec<i64>,
9552}
9553impl<'a> CallDeleteBusinessMessages<'a> {
9554 #[allow(rustdoc::invalid_html_tags)]
9555 #[doc = "Unique identifier of the business connection on behalf of which to delete the messages"]
9556 #[allow(clippy::needless_lifetimes)]
9557 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
9558 self.business_connection_id = business_connection_id;
9559 self
9560 }
9561 #[allow(clippy::needless_lifetimes)]
9562 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
9563 &self.business_connection_id
9564 }
9565 #[allow(rustdoc::invalid_html_tags)]
9566 #[doc = "A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted"]
9567 #[allow(clippy::needless_lifetimes)]
9568 pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
9569 self.message_ids = message_ids;
9570 self
9571 }
9572 #[allow(clippy::needless_lifetimes)]
9573 pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
9574 &self.message_ids
9575 }
9576 pub async fn build(self) -> BotResult<bool> {
9577 self.bot
9578 .delete_business_messages(self.business_connection_id, self.message_ids)
9579 .await
9580 }
9581}
9582pub struct CallGetUserProfilePhotos<'a> {
9583 bot: &'a Bot,
9584 user_id: i64,
9585 offset: Option<i64>,
9586 limit: Option<i64>,
9587}
9588impl<'a> CallGetUserProfilePhotos<'a> {
9589 #[allow(rustdoc::invalid_html_tags)]
9590 #[doc = "Unique identifier of the target user"]
9591 #[allow(clippy::needless_lifetimes)]
9592 pub fn user_id(mut self, user_id: i64) -> Self {
9593 self.user_id = user_id;
9594 self
9595 }
9596 #[allow(clippy::needless_lifetimes)]
9597 pub fn get_user_id(&'a self) -> &'a i64 {
9598 &self.user_id
9599 }
9600 #[allow(rustdoc::invalid_html_tags)]
9601 #[doc = "Sequential number of the first photo to be returned. By default, all photos are returned."]
9602 #[allow(clippy::needless_lifetimes)]
9603 pub fn offset(mut self, offset: i64) -> Self {
9604 self.offset = Some(offset);
9605 self
9606 }
9607 #[allow(clippy::needless_lifetimes)]
9608 pub fn get_offset(&'a self) -> &'a Option<i64> {
9609 &self.offset
9610 }
9611 #[allow(rustdoc::invalid_html_tags)]
9612 #[doc = "Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
9613 #[allow(clippy::needless_lifetimes)]
9614 pub fn limit(mut self, limit: i64) -> Self {
9615 self.limit = Some(limit);
9616 self
9617 }
9618 #[allow(clippy::needless_lifetimes)]
9619 pub fn get_limit(&'a self) -> &'a Option<i64> {
9620 &self.limit
9621 }
9622 pub async fn build(self) -> BotResult<UserProfilePhotos> {
9623 self.bot
9624 .get_user_profile_photos(self.user_id, self.offset, self.limit)
9625 .await
9626 }
9627}
9628pub struct CallGetBusinessAccountGifts<'a> {
9629 bot: &'a Bot,
9630 business_connection_id: &'a str,
9631 exclude_unsaved: Option<bool>,
9632 exclude_saved: Option<bool>,
9633 exclude_unlimited: Option<bool>,
9634 exclude_limited: Option<bool>,
9635 exclude_unique: Option<bool>,
9636 sort_by_price: Option<bool>,
9637 offset: Option<&'a str>,
9638 limit: Option<i64>,
9639}
9640impl<'a> CallGetBusinessAccountGifts<'a> {
9641 #[allow(rustdoc::invalid_html_tags)]
9642 #[doc = "Unique identifier of the business connection"]
9643 #[allow(clippy::needless_lifetimes)]
9644 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
9645 self.business_connection_id = business_connection_id;
9646 self
9647 }
9648 #[allow(clippy::needless_lifetimes)]
9649 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
9650 &self.business_connection_id
9651 }
9652 #[allow(rustdoc::invalid_html_tags)]
9653 #[doc = "Pass True to exclude gifts that aren't saved to the account's profile page"]
9654 #[allow(clippy::needless_lifetimes)]
9655 pub fn exclude_unsaved(mut self, exclude_unsaved: bool) -> Self {
9656 self.exclude_unsaved = Some(exclude_unsaved);
9657 self
9658 }
9659 #[allow(clippy::needless_lifetimes)]
9660 pub fn get_exclude_unsaved(&'a self) -> &'a Option<bool> {
9661 &self.exclude_unsaved
9662 }
9663 #[allow(rustdoc::invalid_html_tags)]
9664 #[doc = "Pass True to exclude gifts that are saved to the account's profile page"]
9665 #[allow(clippy::needless_lifetimes)]
9666 pub fn exclude_saved(mut self, exclude_saved: bool) -> Self {
9667 self.exclude_saved = Some(exclude_saved);
9668 self
9669 }
9670 #[allow(clippy::needless_lifetimes)]
9671 pub fn get_exclude_saved(&'a self) -> &'a Option<bool> {
9672 &self.exclude_saved
9673 }
9674 #[allow(rustdoc::invalid_html_tags)]
9675 #[doc = "Pass True to exclude gifts that can be purchased an unlimited number of times"]
9676 #[allow(clippy::needless_lifetimes)]
9677 pub fn exclude_unlimited(mut self, exclude_unlimited: bool) -> Self {
9678 self.exclude_unlimited = Some(exclude_unlimited);
9679 self
9680 }
9681 #[allow(clippy::needless_lifetimes)]
9682 pub fn get_exclude_unlimited(&'a self) -> &'a Option<bool> {
9683 &self.exclude_unlimited
9684 }
9685 #[allow(rustdoc::invalid_html_tags)]
9686 #[doc = "Pass True to exclude gifts that can be purchased a limited number of times"]
9687 #[allow(clippy::needless_lifetimes)]
9688 pub fn exclude_limited(mut self, exclude_limited: bool) -> Self {
9689 self.exclude_limited = Some(exclude_limited);
9690 self
9691 }
9692 #[allow(clippy::needless_lifetimes)]
9693 pub fn get_exclude_limited(&'a self) -> &'a Option<bool> {
9694 &self.exclude_limited
9695 }
9696 #[allow(rustdoc::invalid_html_tags)]
9697 #[doc = "Pass True to exclude unique gifts"]
9698 #[allow(clippy::needless_lifetimes)]
9699 pub fn exclude_unique(mut self, exclude_unique: bool) -> Self {
9700 self.exclude_unique = Some(exclude_unique);
9701 self
9702 }
9703 #[allow(clippy::needless_lifetimes)]
9704 pub fn get_exclude_unique(&'a self) -> &'a Option<bool> {
9705 &self.exclude_unique
9706 }
9707 #[allow(rustdoc::invalid_html_tags)]
9708 #[doc = "Pass True to sort results by gift price instead of send date. Sorting is applied before pagination."]
9709 #[allow(clippy::needless_lifetimes)]
9710 pub fn sort_by_price(mut self, sort_by_price: bool) -> Self {
9711 self.sort_by_price = Some(sort_by_price);
9712 self
9713 }
9714 #[allow(clippy::needless_lifetimes)]
9715 pub fn get_sort_by_price(&'a self) -> &'a Option<bool> {
9716 &self.sort_by_price
9717 }
9718 #[allow(rustdoc::invalid_html_tags)]
9719 #[doc = "Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results"]
9720 #[allow(clippy::needless_lifetimes)]
9721 pub fn offset(mut self, offset: &'a str) -> Self {
9722 self.offset = Some(offset);
9723 self
9724 }
9725 #[allow(clippy::needless_lifetimes)]
9726 pub fn get_offset(&'a self) -> &'a Option<&'a str> {
9727 &self.offset
9728 }
9729 #[allow(rustdoc::invalid_html_tags)]
9730 #[doc = "The maximum number of gifts to be returned; 1-100. Defaults to 100"]
9731 #[allow(clippy::needless_lifetimes)]
9732 pub fn limit(mut self, limit: i64) -> Self {
9733 self.limit = Some(limit);
9734 self
9735 }
9736 #[allow(clippy::needless_lifetimes)]
9737 pub fn get_limit(&'a self) -> &'a Option<i64> {
9738 &self.limit
9739 }
9740 pub async fn build(self) -> BotResult<OwnedGifts> {
9741 self.bot
9742 .get_business_account_gifts(
9743 self.business_connection_id,
9744 self.exclude_unsaved,
9745 self.exclude_saved,
9746 self.exclude_unlimited,
9747 self.exclude_limited,
9748 self.exclude_unique,
9749 self.sort_by_price,
9750 self.offset,
9751 self.limit,
9752 )
9753 .await
9754 }
9755}
9756pub struct CallSetChatPermissions<'a, V> {
9757 bot: &'a Bot,
9758 chat_id: V,
9759 permissions: &'a ChatPermissions,
9760 use_independent_chat_permissions: Option<bool>,
9761}
9762impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatPermissions<'a, V> {
9763 #[allow(rustdoc::invalid_html_tags)]
9764 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
9765 #[allow(clippy::needless_lifetimes)]
9766 pub fn chat_id(mut self, chat_id: V) -> Self {
9767 self.chat_id = chat_id;
9768 self
9769 }
9770 #[allow(clippy::needless_lifetimes)]
9771 pub fn get_chat_id(&'a self) -> &'a V {
9772 &self.chat_id
9773 }
9774 #[allow(rustdoc::invalid_html_tags)]
9775 #[doc = "A JSON-serialized object for new default chat permissions"]
9776 #[allow(clippy::needless_lifetimes)]
9777 pub fn permissions<T>(mut self, permissions: T) -> Self
9778 where
9779 T: Into<&'a ChatPermissions>,
9780 {
9781 self.permissions = permissions.into();
9782 self
9783 }
9784 #[allow(clippy::needless_lifetimes)]
9785 pub fn get_permissions(&'a self) -> &'a &'a ChatPermissions {
9786 &self.permissions
9787 }
9788 #[allow(rustdoc::invalid_html_tags)]
9789 #[doc = "Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission."]
9790 #[allow(clippy::needless_lifetimes)]
9791 pub fn use_independent_chat_permissions(
9792 mut self,
9793 use_independent_chat_permissions: bool,
9794 ) -> Self {
9795 self.use_independent_chat_permissions = Some(use_independent_chat_permissions);
9796 self
9797 }
9798 #[allow(clippy::needless_lifetimes)]
9799 pub fn get_use_independent_chat_permissions(&'a self) -> &'a Option<bool> {
9800 &self.use_independent_chat_permissions
9801 }
9802 pub async fn build(self) -> BotResult<bool> {
9803 self.bot
9804 .set_chat_permissions(
9805 self.chat_id,
9806 self.permissions,
9807 self.use_independent_chat_permissions,
9808 )
9809 .await
9810 }
9811}
9812pub struct CallAnswerShippingQuery<'a> {
9813 bot: &'a Bot,
9814 shipping_query_id: &'a str,
9815 ok: bool,
9816 shipping_options: Option<&'a Vec<ShippingOption>>,
9817 error_message: Option<&'a str>,
9818}
9819impl<'a> CallAnswerShippingQuery<'a> {
9820 #[allow(rustdoc::invalid_html_tags)]
9821 #[doc = "Unique identifier for the query to be answered"]
9822 #[allow(clippy::needless_lifetimes)]
9823 pub fn shipping_query_id(mut self, shipping_query_id: &'a str) -> Self {
9824 self.shipping_query_id = shipping_query_id;
9825 self
9826 }
9827 #[allow(clippy::needless_lifetimes)]
9828 pub fn get_shipping_query_id(&'a self) -> &'a &'a str {
9829 &self.shipping_query_id
9830 }
9831 #[allow(rustdoc::invalid_html_tags)]
9832 #[doc = "Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)"]
9833 #[allow(clippy::needless_lifetimes)]
9834 pub fn ok(mut self, ok: bool) -> Self {
9835 self.ok = ok;
9836 self
9837 }
9838 #[allow(clippy::needless_lifetimes)]
9839 pub fn get_ok(&'a self) -> &'a bool {
9840 &self.ok
9841 }
9842 #[allow(rustdoc::invalid_html_tags)]
9843 #[doc = "Required if ok is True. A JSON-serialized array of available shipping options."]
9844 #[allow(clippy::needless_lifetimes)]
9845 pub fn shipping_options(mut self, shipping_options: &'a Vec<ShippingOption>) -> Self {
9846 self.shipping_options = Some(shipping_options);
9847 self
9848 }
9849 #[allow(clippy::needless_lifetimes)]
9850 pub fn get_shipping_options(&'a self) -> &'a Option<&'a Vec<ShippingOption>> {
9851 &self.shipping_options
9852 }
9853 #[allow(rustdoc::invalid_html_tags)]
9854 #[doc = "Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. \"Sorry, delivery to your desired address is unavailable\"). Telegram will display this message to the user."]
9855 #[allow(clippy::needless_lifetimes)]
9856 pub fn error_message(mut self, error_message: &'a str) -> Self {
9857 self.error_message = Some(error_message);
9858 self
9859 }
9860 #[allow(clippy::needless_lifetimes)]
9861 pub fn get_error_message(&'a self) -> &'a Option<&'a str> {
9862 &self.error_message
9863 }
9864 pub async fn build(self) -> BotResult<bool> {
9865 self.bot
9866 .answer_shipping_query(
9867 self.shipping_query_id,
9868 self.ok,
9869 self.shipping_options,
9870 self.error_message,
9871 )
9872 .await
9873 }
9874}
9875pub struct CallCreateChatSubscriptionInviteLink<'a, V> {
9876 bot: &'a Bot,
9877 chat_id: V,
9878 name: Option<&'a str>,
9879 subscription_period: i64,
9880 subscription_price: i64,
9881}
9882impl<'a, V: Into<ChatHandle> + Serialize> CallCreateChatSubscriptionInviteLink<'a, V> {
9883 #[allow(rustdoc::invalid_html_tags)]
9884 #[doc = "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)"]
9885 #[allow(clippy::needless_lifetimes)]
9886 pub fn chat_id(mut self, chat_id: V) -> Self {
9887 self.chat_id = chat_id;
9888 self
9889 }
9890 #[allow(clippy::needless_lifetimes)]
9891 pub fn get_chat_id(&'a self) -> &'a V {
9892 &self.chat_id
9893 }
9894 #[allow(rustdoc::invalid_html_tags)]
9895 #[doc = "Invite link name; 0-32 characters"]
9896 #[allow(clippy::needless_lifetimes)]
9897 pub fn name(mut self, name: &'a str) -> Self {
9898 self.name = Some(name);
9899 self
9900 }
9901 #[allow(clippy::needless_lifetimes)]
9902 pub fn get_name(&'a self) -> &'a Option<&'a str> {
9903 &self.name
9904 }
9905 #[allow(rustdoc::invalid_html_tags)]
9906 #[doc = "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."]
9907 #[allow(clippy::needless_lifetimes)]
9908 pub fn subscription_period(mut self, subscription_period: i64) -> Self {
9909 self.subscription_period = subscription_period;
9910 self
9911 }
9912 #[allow(clippy::needless_lifetimes)]
9913 pub fn get_subscription_period(&'a self) -> &'a i64 {
9914 &self.subscription_period
9915 }
9916 #[allow(rustdoc::invalid_html_tags)]
9917 #[doc = "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000"]
9918 #[allow(clippy::needless_lifetimes)]
9919 pub fn subscription_price(mut self, subscription_price: i64) -> Self {
9920 self.subscription_price = subscription_price;
9921 self
9922 }
9923 #[allow(clippy::needless_lifetimes)]
9924 pub fn get_subscription_price(&'a self) -> &'a i64 {
9925 &self.subscription_price
9926 }
9927 pub async fn build(self) -> BotResult<ChatInviteLink> {
9928 self.bot
9929 .create_chat_subscription_invite_link(
9930 self.chat_id,
9931 self.name,
9932 self.subscription_period,
9933 self.subscription_price,
9934 )
9935 .await
9936 }
9937}
9938pub struct CallSetStickerSetTitle<'a> {
9939 bot: &'a Bot,
9940 name: &'a str,
9941 title: &'a str,
9942}
9943impl<'a> CallSetStickerSetTitle<'a> {
9944 #[allow(rustdoc::invalid_html_tags)]
9945 #[doc = "Sticker set name"]
9946 #[allow(clippy::needless_lifetimes)]
9947 pub fn name(mut self, name: &'a str) -> Self {
9948 self.name = name;
9949 self
9950 }
9951 #[allow(clippy::needless_lifetimes)]
9952 pub fn get_name(&'a self) -> &'a &'a str {
9953 &self.name
9954 }
9955 #[allow(rustdoc::invalid_html_tags)]
9956 #[doc = "Sticker set title, 1-64 characters"]
9957 #[allow(clippy::needless_lifetimes)]
9958 pub fn title(mut self, title: &'a str) -> Self {
9959 self.title = title;
9960 self
9961 }
9962 #[allow(clippy::needless_lifetimes)]
9963 pub fn get_title(&'a self) -> &'a &'a str {
9964 &self.title
9965 }
9966 pub async fn build(self) -> BotResult<bool> {
9967 self.bot.set_sticker_set_title(self.name, self.title).await
9968 }
9969}
9970pub struct CallApproveSuggestedPost<'a> {
9971 bot: &'a Bot,
9972 chat_id: i64,
9973 message_id: i64,
9974 send_date: Option<i64>,
9975}
9976impl<'a> CallApproveSuggestedPost<'a> {
9977 #[allow(rustdoc::invalid_html_tags)]
9978 #[doc = "Unique identifier for the target direct messages chat"]
9979 #[allow(clippy::needless_lifetimes)]
9980 pub fn chat_id(mut self, chat_id: i64) -> Self {
9981 self.chat_id = chat_id;
9982 self
9983 }
9984 #[allow(clippy::needless_lifetimes)]
9985 pub fn get_chat_id(&'a self) -> &'a i64 {
9986 &self.chat_id
9987 }
9988 #[allow(rustdoc::invalid_html_tags)]
9989 #[doc = "Identifier of a suggested post message to approve"]
9990 #[allow(clippy::needless_lifetimes)]
9991 pub fn message_id(mut self, message_id: i64) -> Self {
9992 self.message_id = message_id;
9993 self
9994 }
9995 #[allow(clippy::needless_lifetimes)]
9996 pub fn get_message_id(&'a self) -> &'a i64 {
9997 &self.message_id
9998 }
9999 #[allow(rustdoc::invalid_html_tags)]
10000 #[doc = "Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future"]
10001 #[allow(clippy::needless_lifetimes)]
10002 pub fn send_date(mut self, send_date: i64) -> Self {
10003 self.send_date = Some(send_date);
10004 self
10005 }
10006 #[allow(clippy::needless_lifetimes)]
10007 pub fn get_send_date(&'a self) -> &'a Option<i64> {
10008 &self.send_date
10009 }
10010 pub async fn build(self) -> BotResult<bool> {
10011 self.bot
10012 .approve_suggested_post(self.chat_id, self.message_id, self.send_date)
10013 .await
10014 }
10015}
10016pub struct CallHideGeneralForumTopic<'a, V> {
10017 bot: &'a Bot,
10018 chat_id: V,
10019}
10020impl<'a, V: Into<ChatHandle> + Serialize> CallHideGeneralForumTopic<'a, V> {
10021 #[allow(rustdoc::invalid_html_tags)]
10022 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
10023 #[allow(clippy::needless_lifetimes)]
10024 pub fn chat_id(mut self, chat_id: V) -> Self {
10025 self.chat_id = chat_id;
10026 self
10027 }
10028 #[allow(clippy::needless_lifetimes)]
10029 pub fn get_chat_id(&'a self) -> &'a V {
10030 &self.chat_id
10031 }
10032 pub async fn build(self) -> BotResult<bool> {
10033 self.bot.hide_general_forum_topic(self.chat_id).await
10034 }
10035}
10036pub struct CallCreateNewStickerSet<'a> {
10037 bot: &'a Bot,
10038 user_id: i64,
10039 name: &'a str,
10040 title: &'a str,
10041 stickers: &'a Vec<InputSticker>,
10042 sticker_type: Option<&'a str>,
10043 needs_repainting: Option<bool>,
10044}
10045impl<'a> CallCreateNewStickerSet<'a> {
10046 #[allow(rustdoc::invalid_html_tags)]
10047 #[doc = "User identifier of created sticker set owner"]
10048 #[allow(clippy::needless_lifetimes)]
10049 pub fn user_id(mut self, user_id: i64) -> Self {
10050 self.user_id = user_id;
10051 self
10052 }
10053 #[allow(clippy::needless_lifetimes)]
10054 pub fn get_user_id(&'a self) -> &'a i64 {
10055 &self.user_id
10056 }
10057 #[allow(rustdoc::invalid_html_tags)]
10058 #[doc = "Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in \"_by_<bot_username>\". <bot_username> is case insensitive. 1-64 characters."]
10059 #[allow(clippy::needless_lifetimes)]
10060 pub fn name(mut self, name: &'a str) -> Self {
10061 self.name = name;
10062 self
10063 }
10064 #[allow(clippy::needless_lifetimes)]
10065 pub fn get_name(&'a self) -> &'a &'a str {
10066 &self.name
10067 }
10068 #[allow(rustdoc::invalid_html_tags)]
10069 #[doc = "Sticker set title, 1-64 characters"]
10070 #[allow(clippy::needless_lifetimes)]
10071 pub fn title(mut self, title: &'a str) -> Self {
10072 self.title = title;
10073 self
10074 }
10075 #[allow(clippy::needless_lifetimes)]
10076 pub fn get_title(&'a self) -> &'a &'a str {
10077 &self.title
10078 }
10079 #[allow(rustdoc::invalid_html_tags)]
10080 #[doc = "A JSON-serialized list of 1-50 initial stickers to be added to the sticker set"]
10081 #[allow(clippy::needless_lifetimes)]
10082 pub fn stickers(mut self, stickers: &'a Vec<InputSticker>) -> Self {
10083 self.stickers = stickers;
10084 self
10085 }
10086 #[allow(clippy::needless_lifetimes)]
10087 pub fn get_stickers(&'a self) -> &'a &'a Vec<InputSticker> {
10088 &self.stickers
10089 }
10090 #[allow(rustdoc::invalid_html_tags)]
10091 #[doc = "Type of stickers in the set, pass \"regular\", \"mask\", or \"custom_emoji\". By default, a regular sticker set is created."]
10092 #[allow(clippy::needless_lifetimes)]
10093 pub fn sticker_type(mut self, sticker_type: &'a str) -> Self {
10094 self.sticker_type = Some(sticker_type);
10095 self
10096 }
10097 #[allow(clippy::needless_lifetimes)]
10098 pub fn get_sticker_type(&'a self) -> &'a Option<&'a str> {
10099 &self.sticker_type
10100 }
10101 #[allow(rustdoc::invalid_html_tags)]
10102 #[doc = "Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"]
10103 #[allow(clippy::needless_lifetimes)]
10104 pub fn needs_repainting(mut self, needs_repainting: bool) -> Self {
10105 self.needs_repainting = Some(needs_repainting);
10106 self
10107 }
10108 #[allow(clippy::needless_lifetimes)]
10109 pub fn get_needs_repainting(&'a self) -> &'a Option<bool> {
10110 &self.needs_repainting
10111 }
10112 pub async fn build(self) -> BotResult<bool> {
10113 self.bot
10114 .create_new_sticker_set(
10115 self.user_id,
10116 self.name,
10117 self.title,
10118 self.stickers,
10119 self.sticker_type,
10120 self.needs_repainting,
10121 )
10122 .await
10123 }
10124}
10125pub struct CallSendVideoNote<'a, V> {
10126 bot: &'a Bot,
10127 business_connection_id: Option<&'a str>,
10128 chat_id: V,
10129 message_thread_id: Option<i64>,
10130 direct_messages_topic_id: Option<i64>,
10131 video_note: FileData,
10132 duration: Option<i64>,
10133 length: Option<i64>,
10134 thumbnail: Option<FileData>,
10135 disable_notification: Option<bool>,
10136 protect_content: Option<bool>,
10137 allow_paid_broadcast: Option<bool>,
10138 message_effect_id: Option<&'a str>,
10139 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
10140 reply_parameters: Option<&'a ReplyParameters>,
10141 reply_markup: Option<&'a EReplyMarkup>,
10142}
10143impl<'a, V: Into<ChatHandle> + Serialize> CallSendVideoNote<'a, V> {
10144 #[allow(rustdoc::invalid_html_tags)]
10145 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
10146 #[allow(clippy::needless_lifetimes)]
10147 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
10148 self.business_connection_id = Some(business_connection_id);
10149 self
10150 }
10151 #[allow(clippy::needless_lifetimes)]
10152 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
10153 &self.business_connection_id
10154 }
10155 #[allow(rustdoc::invalid_html_tags)]
10156 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
10157 #[allow(clippy::needless_lifetimes)]
10158 pub fn chat_id(mut self, chat_id: V) -> Self {
10159 self.chat_id = chat_id;
10160 self
10161 }
10162 #[allow(clippy::needless_lifetimes)]
10163 pub fn get_chat_id(&'a self) -> &'a V {
10164 &self.chat_id
10165 }
10166 #[allow(rustdoc::invalid_html_tags)]
10167 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
10168 #[allow(clippy::needless_lifetimes)]
10169 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
10170 self.message_thread_id = Some(message_thread_id);
10171 self
10172 }
10173 #[allow(clippy::needless_lifetimes)]
10174 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
10175 &self.message_thread_id
10176 }
10177 #[allow(rustdoc::invalid_html_tags)]
10178 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
10179 #[allow(clippy::needless_lifetimes)]
10180 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
10181 self.direct_messages_topic_id = Some(direct_messages_topic_id);
10182 self
10183 }
10184 #[allow(clippy::needless_lifetimes)]
10185 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
10186 &self.direct_messages_topic_id
10187 }
10188 #[allow(rustdoc::invalid_html_tags)]
10189 #[doc = "Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Sending video notes by a URL is currently unsupported"]
10190 #[allow(clippy::needless_lifetimes)]
10191 pub fn video_note(mut self, video_note: FileData) -> Self {
10192 self.video_note = video_note;
10193 self
10194 }
10195 #[allow(clippy::needless_lifetimes)]
10196 pub fn get_video_note(&'a self) -> &'a FileData {
10197 &self.video_note
10198 }
10199 #[allow(rustdoc::invalid_html_tags)]
10200 #[doc = "Duration of sent video in seconds"]
10201 #[allow(clippy::needless_lifetimes)]
10202 pub fn duration(mut self, duration: i64) -> Self {
10203 self.duration = Some(duration);
10204 self
10205 }
10206 #[allow(clippy::needless_lifetimes)]
10207 pub fn get_duration(&'a self) -> &'a Option<i64> {
10208 &self.duration
10209 }
10210 #[allow(rustdoc::invalid_html_tags)]
10211 #[doc = "Video width and height, i.e. diameter of the video message"]
10212 #[allow(clippy::needless_lifetimes)]
10213 pub fn length(mut self, length: i64) -> Self {
10214 self.length = Some(length);
10215 self
10216 }
10217 #[allow(clippy::needless_lifetimes)]
10218 pub fn get_length(&'a self) -> &'a Option<i64> {
10219 &self.length
10220 }
10221 #[allow(rustdoc::invalid_html_tags)]
10222 #[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
10223 #[allow(clippy::needless_lifetimes)]
10224 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
10225 self.thumbnail = Some(thumbnail);
10226 self
10227 }
10228 #[allow(clippy::needless_lifetimes)]
10229 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
10230 &self.thumbnail
10231 }
10232 #[allow(rustdoc::invalid_html_tags)]
10233 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
10234 #[allow(clippy::needless_lifetimes)]
10235 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
10236 self.disable_notification = Some(disable_notification);
10237 self
10238 }
10239 #[allow(clippy::needless_lifetimes)]
10240 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
10241 &self.disable_notification
10242 }
10243 #[allow(rustdoc::invalid_html_tags)]
10244 #[doc = "Protects the contents of the sent message from forwarding and saving"]
10245 #[allow(clippy::needless_lifetimes)]
10246 pub fn protect_content(mut self, protect_content: bool) -> Self {
10247 self.protect_content = Some(protect_content);
10248 self
10249 }
10250 #[allow(clippy::needless_lifetimes)]
10251 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
10252 &self.protect_content
10253 }
10254 #[allow(rustdoc::invalid_html_tags)]
10255 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
10256 #[allow(clippy::needless_lifetimes)]
10257 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
10258 self.allow_paid_broadcast = Some(allow_paid_broadcast);
10259 self
10260 }
10261 #[allow(clippy::needless_lifetimes)]
10262 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
10263 &self.allow_paid_broadcast
10264 }
10265 #[allow(rustdoc::invalid_html_tags)]
10266 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
10267 #[allow(clippy::needless_lifetimes)]
10268 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
10269 self.message_effect_id = Some(message_effect_id);
10270 self
10271 }
10272 #[allow(clippy::needless_lifetimes)]
10273 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
10274 &self.message_effect_id
10275 }
10276 #[allow(rustdoc::invalid_html_tags)]
10277 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
10278 #[allow(clippy::needless_lifetimes)]
10279 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
10280 where
10281 T: Into<&'a SuggestedPostParameters>,
10282 {
10283 self.suggested_post_parameters = Some(suggested_post_parameters.into());
10284 self
10285 }
10286 #[allow(clippy::needless_lifetimes)]
10287 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
10288 &self.suggested_post_parameters
10289 }
10290 #[allow(rustdoc::invalid_html_tags)]
10291 #[doc = "Description of the message to reply to"]
10292 #[allow(clippy::needless_lifetimes)]
10293 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
10294 where
10295 T: Into<&'a ReplyParameters>,
10296 {
10297 self.reply_parameters = Some(reply_parameters.into());
10298 self
10299 }
10300 #[allow(clippy::needless_lifetimes)]
10301 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
10302 &self.reply_parameters
10303 }
10304 #[allow(rustdoc::invalid_html_tags)]
10305 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
10306 #[allow(clippy::needless_lifetimes)]
10307 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
10308 where
10309 T: Into<&'a EReplyMarkup>,
10310 {
10311 self.reply_markup = Some(reply_markup.into());
10312 self
10313 }
10314 #[allow(clippy::needless_lifetimes)]
10315 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
10316 &self.reply_markup
10317 }
10318 pub async fn build(self) -> BotResult<Message> {
10319 self.bot
10320 .send_video_note(
10321 self.business_connection_id,
10322 self.chat_id,
10323 self.message_thread_id,
10324 self.direct_messages_topic_id,
10325 self.video_note,
10326 self.duration,
10327 self.length,
10328 self.thumbnail,
10329 self.disable_notification,
10330 self.protect_content,
10331 self.allow_paid_broadcast,
10332 self.message_effect_id,
10333 self.suggested_post_parameters,
10334 self.reply_parameters,
10335 self.reply_markup,
10336 )
10337 .await
10338 }
10339}
10340pub struct CallUnbanChatMember<'a, V> {
10341 bot: &'a Bot,
10342 chat_id: V,
10343 user_id: i64,
10344 only_if_banned: Option<bool>,
10345}
10346impl<'a, V: Into<ChatHandle> + Serialize> CallUnbanChatMember<'a, V> {
10347 #[allow(rustdoc::invalid_html_tags)]
10348 #[doc = "Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)"]
10349 #[allow(clippy::needless_lifetimes)]
10350 pub fn chat_id(mut self, chat_id: V) -> Self {
10351 self.chat_id = chat_id;
10352 self
10353 }
10354 #[allow(clippy::needless_lifetimes)]
10355 pub fn get_chat_id(&'a self) -> &'a V {
10356 &self.chat_id
10357 }
10358 #[allow(rustdoc::invalid_html_tags)]
10359 #[doc = "Unique identifier of the target user"]
10360 #[allow(clippy::needless_lifetimes)]
10361 pub fn user_id(mut self, user_id: i64) -> Self {
10362 self.user_id = user_id;
10363 self
10364 }
10365 #[allow(clippy::needless_lifetimes)]
10366 pub fn get_user_id(&'a self) -> &'a i64 {
10367 &self.user_id
10368 }
10369 #[allow(rustdoc::invalid_html_tags)]
10370 #[doc = "Do nothing if the user is not banned"]
10371 #[allow(clippy::needless_lifetimes)]
10372 pub fn only_if_banned(mut self, only_if_banned: bool) -> Self {
10373 self.only_if_banned = Some(only_if_banned);
10374 self
10375 }
10376 #[allow(clippy::needless_lifetimes)]
10377 pub fn get_only_if_banned(&'a self) -> &'a Option<bool> {
10378 &self.only_if_banned
10379 }
10380 pub async fn build(self) -> BotResult<bool> {
10381 self.bot
10382 .unban_chat_member(self.chat_id, self.user_id, self.only_if_banned)
10383 .await
10384 }
10385}
10386pub struct CallEditChatSubscriptionInviteLink<'a, V> {
10387 bot: &'a Bot,
10388 chat_id: V,
10389 invite_link: &'a str,
10390 name: Option<&'a str>,
10391}
10392impl<'a, V: Into<ChatHandle> + Serialize> CallEditChatSubscriptionInviteLink<'a, V> {
10393 #[allow(rustdoc::invalid_html_tags)]
10394 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
10395 #[allow(clippy::needless_lifetimes)]
10396 pub fn chat_id(mut self, chat_id: V) -> Self {
10397 self.chat_id = chat_id;
10398 self
10399 }
10400 #[allow(clippy::needless_lifetimes)]
10401 pub fn get_chat_id(&'a self) -> &'a V {
10402 &self.chat_id
10403 }
10404 #[allow(rustdoc::invalid_html_tags)]
10405 #[doc = "The invite link to edit"]
10406 #[allow(clippy::needless_lifetimes)]
10407 pub fn invite_link(mut self, invite_link: &'a str) -> Self {
10408 self.invite_link = invite_link;
10409 self
10410 }
10411 #[allow(clippy::needless_lifetimes)]
10412 pub fn get_invite_link(&'a self) -> &'a &'a str {
10413 &self.invite_link
10414 }
10415 #[allow(rustdoc::invalid_html_tags)]
10416 #[doc = "Invite link name; 0-32 characters"]
10417 #[allow(clippy::needless_lifetimes)]
10418 pub fn name(mut self, name: &'a str) -> Self {
10419 self.name = Some(name);
10420 self
10421 }
10422 #[allow(clippy::needless_lifetimes)]
10423 pub fn get_name(&'a self) -> &'a Option<&'a str> {
10424 &self.name
10425 }
10426 pub async fn build(self) -> BotResult<ChatInviteLink> {
10427 self.bot
10428 .edit_chat_subscription_invite_link(self.chat_id, self.invite_link, self.name)
10429 .await
10430 }
10431}
10432pub struct CallUnpinAllForumTopicMessages<'a, V> {
10433 bot: &'a Bot,
10434 chat_id: V,
10435 message_thread_id: i64,
10436}
10437impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllForumTopicMessages<'a, V> {
10438 #[allow(rustdoc::invalid_html_tags)]
10439 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
10440 #[allow(clippy::needless_lifetimes)]
10441 pub fn chat_id(mut self, chat_id: V) -> Self {
10442 self.chat_id = chat_id;
10443 self
10444 }
10445 #[allow(clippy::needless_lifetimes)]
10446 pub fn get_chat_id(&'a self) -> &'a V {
10447 &self.chat_id
10448 }
10449 #[allow(rustdoc::invalid_html_tags)]
10450 #[doc = "Unique identifier for the target message thread of the forum topic"]
10451 #[allow(clippy::needless_lifetimes)]
10452 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
10453 self.message_thread_id = message_thread_id;
10454 self
10455 }
10456 #[allow(clippy::needless_lifetimes)]
10457 pub fn get_message_thread_id(&'a self) -> &'a i64 {
10458 &self.message_thread_id
10459 }
10460 pub async fn build(self) -> BotResult<bool> {
10461 self.bot
10462 .unpin_all_forum_topic_messages(self.chat_id, self.message_thread_id)
10463 .await
10464 }
10465}
10466pub struct CallSendGame<'a> {
10467 bot: &'a Bot,
10468 business_connection_id: Option<&'a str>,
10469 chat_id: i64,
10470 message_thread_id: Option<i64>,
10471 game_short_name: &'a str,
10472 disable_notification: Option<bool>,
10473 protect_content: Option<bool>,
10474 allow_paid_broadcast: Option<bool>,
10475 message_effect_id: Option<&'a str>,
10476 reply_parameters: Option<&'a ReplyParameters>,
10477 reply_markup: Option<&'a InlineKeyboardMarkup>,
10478}
10479impl<'a> CallSendGame<'a> {
10480 #[allow(rustdoc::invalid_html_tags)]
10481 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
10482 #[allow(clippy::needless_lifetimes)]
10483 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
10484 self.business_connection_id = Some(business_connection_id);
10485 self
10486 }
10487 #[allow(clippy::needless_lifetimes)]
10488 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
10489 &self.business_connection_id
10490 }
10491 #[allow(rustdoc::invalid_html_tags)]
10492 #[doc = "Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats."]
10493 #[allow(clippy::needless_lifetimes)]
10494 pub fn chat_id(mut self, chat_id: i64) -> Self {
10495 self.chat_id = chat_id;
10496 self
10497 }
10498 #[allow(clippy::needless_lifetimes)]
10499 pub fn get_chat_id(&'a self) -> &'a i64 {
10500 &self.chat_id
10501 }
10502 #[allow(rustdoc::invalid_html_tags)]
10503 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
10504 #[allow(clippy::needless_lifetimes)]
10505 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
10506 self.message_thread_id = Some(message_thread_id);
10507 self
10508 }
10509 #[allow(clippy::needless_lifetimes)]
10510 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
10511 &self.message_thread_id
10512 }
10513 #[allow(rustdoc::invalid_html_tags)]
10514 #[doc = "Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather."]
10515 #[allow(clippy::needless_lifetimes)]
10516 pub fn game_short_name(mut self, game_short_name: &'a str) -> Self {
10517 self.game_short_name = game_short_name;
10518 self
10519 }
10520 #[allow(clippy::needless_lifetimes)]
10521 pub fn get_game_short_name(&'a self) -> &'a &'a str {
10522 &self.game_short_name
10523 }
10524 #[allow(rustdoc::invalid_html_tags)]
10525 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
10526 #[allow(clippy::needless_lifetimes)]
10527 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
10528 self.disable_notification = Some(disable_notification);
10529 self
10530 }
10531 #[allow(clippy::needless_lifetimes)]
10532 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
10533 &self.disable_notification
10534 }
10535 #[allow(rustdoc::invalid_html_tags)]
10536 #[doc = "Protects the contents of the sent message from forwarding and saving"]
10537 #[allow(clippy::needless_lifetimes)]
10538 pub fn protect_content(mut self, protect_content: bool) -> Self {
10539 self.protect_content = Some(protect_content);
10540 self
10541 }
10542 #[allow(clippy::needless_lifetimes)]
10543 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
10544 &self.protect_content
10545 }
10546 #[allow(rustdoc::invalid_html_tags)]
10547 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
10548 #[allow(clippy::needless_lifetimes)]
10549 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
10550 self.allow_paid_broadcast = Some(allow_paid_broadcast);
10551 self
10552 }
10553 #[allow(clippy::needless_lifetimes)]
10554 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
10555 &self.allow_paid_broadcast
10556 }
10557 #[allow(rustdoc::invalid_html_tags)]
10558 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
10559 #[allow(clippy::needless_lifetimes)]
10560 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
10561 self.message_effect_id = Some(message_effect_id);
10562 self
10563 }
10564 #[allow(clippy::needless_lifetimes)]
10565 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
10566 &self.message_effect_id
10567 }
10568 #[allow(rustdoc::invalid_html_tags)]
10569 #[doc = "Description of the message to reply to"]
10570 #[allow(clippy::needless_lifetimes)]
10571 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
10572 where
10573 T: Into<&'a ReplyParameters>,
10574 {
10575 self.reply_parameters = Some(reply_parameters.into());
10576 self
10577 }
10578 #[allow(clippy::needless_lifetimes)]
10579 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
10580 &self.reply_parameters
10581 }
10582 #[allow(rustdoc::invalid_html_tags)]
10583 #[doc = "A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."]
10584 #[allow(clippy::needless_lifetimes)]
10585 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
10586 where
10587 T: Into<&'a InlineKeyboardMarkup>,
10588 {
10589 self.reply_markup = Some(reply_markup.into());
10590 self
10591 }
10592 #[allow(clippy::needless_lifetimes)]
10593 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
10594 &self.reply_markup
10595 }
10596 pub async fn build(self) -> BotResult<Message> {
10597 self.bot
10598 .send_game(
10599 self.business_connection_id,
10600 self.chat_id,
10601 self.message_thread_id,
10602 self.game_short_name,
10603 self.disable_notification,
10604 self.protect_content,
10605 self.allow_paid_broadcast,
10606 self.message_effect_id,
10607 self.reply_parameters,
10608 self.reply_markup,
10609 )
10610 .await
10611 }
10612}
10613pub struct CallCloseGeneralForumTopic<'a, V> {
10614 bot: &'a Bot,
10615 chat_id: V,
10616}
10617impl<'a, V: Into<ChatHandle> + Serialize> CallCloseGeneralForumTopic<'a, V> {
10618 #[allow(rustdoc::invalid_html_tags)]
10619 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
10620 #[allow(clippy::needless_lifetimes)]
10621 pub fn chat_id(mut self, chat_id: V) -> Self {
10622 self.chat_id = chat_id;
10623 self
10624 }
10625 #[allow(clippy::needless_lifetimes)]
10626 pub fn get_chat_id(&'a self) -> &'a V {
10627 &self.chat_id
10628 }
10629 pub async fn build(self) -> BotResult<bool> {
10630 self.bot.close_general_forum_topic(self.chat_id).await
10631 }
10632}
10633pub struct CallSetStickerPositionInSet<'a> {
10634 bot: &'a Bot,
10635 sticker: &'a str,
10636 position: i64,
10637}
10638impl<'a> CallSetStickerPositionInSet<'a> {
10639 #[allow(rustdoc::invalid_html_tags)]
10640 #[doc = "File identifier of the sticker"]
10641 #[allow(clippy::needless_lifetimes)]
10642 pub fn sticker(mut self, sticker: &'a str) -> Self {
10643 self.sticker = sticker;
10644 self
10645 }
10646 #[allow(clippy::needless_lifetimes)]
10647 pub fn get_sticker(&'a self) -> &'a &'a str {
10648 &self.sticker
10649 }
10650 #[allow(rustdoc::invalid_html_tags)]
10651 #[doc = "New sticker position in the set, zero-based"]
10652 #[allow(clippy::needless_lifetimes)]
10653 pub fn position(mut self, position: i64) -> Self {
10654 self.position = position;
10655 self
10656 }
10657 #[allow(clippy::needless_lifetimes)]
10658 pub fn get_position(&'a self) -> &'a i64 {
10659 &self.position
10660 }
10661 pub async fn build(self) -> BotResult<bool> {
10662 self.bot
10663 .set_sticker_position_in_set(self.sticker, self.position)
10664 .await
10665 }
10666}
10667pub struct CallSendAudio<'a, V> {
10668 bot: &'a Bot,
10669 business_connection_id: Option<&'a str>,
10670 chat_id: V,
10671 message_thread_id: Option<i64>,
10672 direct_messages_topic_id: Option<i64>,
10673 audio: FileData,
10674 caption: Option<&'a str>,
10675 parse_mode: Option<&'a str>,
10676 caption_entities: Option<&'a Vec<MessageEntity>>,
10677 duration: Option<i64>,
10678 performer: Option<&'a str>,
10679 title: Option<&'a str>,
10680 thumbnail: Option<FileData>,
10681 disable_notification: Option<bool>,
10682 protect_content: Option<bool>,
10683 allow_paid_broadcast: Option<bool>,
10684 message_effect_id: Option<&'a str>,
10685 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
10686 reply_parameters: Option<&'a ReplyParameters>,
10687 reply_markup: Option<&'a EReplyMarkup>,
10688}
10689impl<'a, V: Into<ChatHandle> + Serialize> CallSendAudio<'a, V> {
10690 #[allow(rustdoc::invalid_html_tags)]
10691 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
10692 #[allow(clippy::needless_lifetimes)]
10693 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
10694 self.business_connection_id = Some(business_connection_id);
10695 self
10696 }
10697 #[allow(clippy::needless_lifetimes)]
10698 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
10699 &self.business_connection_id
10700 }
10701 #[allow(rustdoc::invalid_html_tags)]
10702 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
10703 #[allow(clippy::needless_lifetimes)]
10704 pub fn chat_id(mut self, chat_id: V) -> Self {
10705 self.chat_id = chat_id;
10706 self
10707 }
10708 #[allow(clippy::needless_lifetimes)]
10709 pub fn get_chat_id(&'a self) -> &'a V {
10710 &self.chat_id
10711 }
10712 #[allow(rustdoc::invalid_html_tags)]
10713 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
10714 #[allow(clippy::needless_lifetimes)]
10715 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
10716 self.message_thread_id = Some(message_thread_id);
10717 self
10718 }
10719 #[allow(clippy::needless_lifetimes)]
10720 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
10721 &self.message_thread_id
10722 }
10723 #[allow(rustdoc::invalid_html_tags)]
10724 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
10725 #[allow(clippy::needless_lifetimes)]
10726 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
10727 self.direct_messages_topic_id = Some(direct_messages_topic_id);
10728 self
10729 }
10730 #[allow(clippy::needless_lifetimes)]
10731 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
10732 &self.direct_messages_topic_id
10733 }
10734 #[allow(rustdoc::invalid_html_tags)]
10735 #[doc = "Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
10736 #[allow(clippy::needless_lifetimes)]
10737 pub fn audio(mut self, audio: FileData) -> Self {
10738 self.audio = audio;
10739 self
10740 }
10741 #[allow(clippy::needless_lifetimes)]
10742 pub fn get_audio(&'a self) -> &'a FileData {
10743 &self.audio
10744 }
10745 #[allow(rustdoc::invalid_html_tags)]
10746 #[doc = "Audio caption, 0-1024 characters after entities parsing"]
10747 #[allow(clippy::needless_lifetimes)]
10748 pub fn caption(mut self, caption: &'a str) -> Self {
10749 self.caption = Some(caption);
10750 self
10751 }
10752 #[allow(clippy::needless_lifetimes)]
10753 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
10754 &self.caption
10755 }
10756 #[allow(rustdoc::invalid_html_tags)]
10757 #[doc = "Mode for parsing entities in the audio caption. See formatting options for more details."]
10758 #[allow(clippy::needless_lifetimes)]
10759 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
10760 self.parse_mode = Some(parse_mode);
10761 self
10762 }
10763 #[allow(clippy::needless_lifetimes)]
10764 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
10765 &self.parse_mode
10766 }
10767 #[allow(rustdoc::invalid_html_tags)]
10768 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
10769 #[allow(clippy::needless_lifetimes)]
10770 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
10771 self.caption_entities = Some(caption_entities);
10772 self
10773 }
10774 #[allow(clippy::needless_lifetimes)]
10775 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
10776 &self.caption_entities
10777 }
10778 #[allow(rustdoc::invalid_html_tags)]
10779 #[doc = "Duration of the audio in seconds"]
10780 #[allow(clippy::needless_lifetimes)]
10781 pub fn duration(mut self, duration: i64) -> Self {
10782 self.duration = Some(duration);
10783 self
10784 }
10785 #[allow(clippy::needless_lifetimes)]
10786 pub fn get_duration(&'a self) -> &'a Option<i64> {
10787 &self.duration
10788 }
10789 #[allow(rustdoc::invalid_html_tags)]
10790 #[doc = "Performer"]
10791 #[allow(clippy::needless_lifetimes)]
10792 pub fn performer(mut self, performer: &'a str) -> Self {
10793 self.performer = Some(performer);
10794 self
10795 }
10796 #[allow(clippy::needless_lifetimes)]
10797 pub fn get_performer(&'a self) -> &'a Option<&'a str> {
10798 &self.performer
10799 }
10800 #[allow(rustdoc::invalid_html_tags)]
10801 #[doc = "Track name"]
10802 #[allow(clippy::needless_lifetimes)]
10803 pub fn title(mut self, title: &'a str) -> Self {
10804 self.title = Some(title);
10805 self
10806 }
10807 #[allow(clippy::needless_lifetimes)]
10808 pub fn get_title(&'a self) -> &'a Option<&'a str> {
10809 &self.title
10810 }
10811 #[allow(rustdoc::invalid_html_tags)]
10812 #[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
10813 #[allow(clippy::needless_lifetimes)]
10814 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
10815 self.thumbnail = Some(thumbnail);
10816 self
10817 }
10818 #[allow(clippy::needless_lifetimes)]
10819 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
10820 &self.thumbnail
10821 }
10822 #[allow(rustdoc::invalid_html_tags)]
10823 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
10824 #[allow(clippy::needless_lifetimes)]
10825 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
10826 self.disable_notification = Some(disable_notification);
10827 self
10828 }
10829 #[allow(clippy::needless_lifetimes)]
10830 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
10831 &self.disable_notification
10832 }
10833 #[allow(rustdoc::invalid_html_tags)]
10834 #[doc = "Protects the contents of the sent message from forwarding and saving"]
10835 #[allow(clippy::needless_lifetimes)]
10836 pub fn protect_content(mut self, protect_content: bool) -> Self {
10837 self.protect_content = Some(protect_content);
10838 self
10839 }
10840 #[allow(clippy::needless_lifetimes)]
10841 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
10842 &self.protect_content
10843 }
10844 #[allow(rustdoc::invalid_html_tags)]
10845 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
10846 #[allow(clippy::needless_lifetimes)]
10847 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
10848 self.allow_paid_broadcast = Some(allow_paid_broadcast);
10849 self
10850 }
10851 #[allow(clippy::needless_lifetimes)]
10852 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
10853 &self.allow_paid_broadcast
10854 }
10855 #[allow(rustdoc::invalid_html_tags)]
10856 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
10857 #[allow(clippy::needless_lifetimes)]
10858 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
10859 self.message_effect_id = Some(message_effect_id);
10860 self
10861 }
10862 #[allow(clippy::needless_lifetimes)]
10863 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
10864 &self.message_effect_id
10865 }
10866 #[allow(rustdoc::invalid_html_tags)]
10867 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
10868 #[allow(clippy::needless_lifetimes)]
10869 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
10870 where
10871 T: Into<&'a SuggestedPostParameters>,
10872 {
10873 self.suggested_post_parameters = Some(suggested_post_parameters.into());
10874 self
10875 }
10876 #[allow(clippy::needless_lifetimes)]
10877 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
10878 &self.suggested_post_parameters
10879 }
10880 #[allow(rustdoc::invalid_html_tags)]
10881 #[doc = "Description of the message to reply to"]
10882 #[allow(clippy::needless_lifetimes)]
10883 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
10884 where
10885 T: Into<&'a ReplyParameters>,
10886 {
10887 self.reply_parameters = Some(reply_parameters.into());
10888 self
10889 }
10890 #[allow(clippy::needless_lifetimes)]
10891 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
10892 &self.reply_parameters
10893 }
10894 #[allow(rustdoc::invalid_html_tags)]
10895 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
10896 #[allow(clippy::needless_lifetimes)]
10897 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
10898 where
10899 T: Into<&'a EReplyMarkup>,
10900 {
10901 self.reply_markup = Some(reply_markup.into());
10902 self
10903 }
10904 #[allow(clippy::needless_lifetimes)]
10905 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
10906 &self.reply_markup
10907 }
10908 pub async fn build(self) -> BotResult<Message> {
10909 self.bot
10910 .send_audio(
10911 self.business_connection_id,
10912 self.chat_id,
10913 self.message_thread_id,
10914 self.direct_messages_topic_id,
10915 self.audio,
10916 self.caption,
10917 self.parse_mode,
10918 self.caption_entities,
10919 self.duration,
10920 self.performer,
10921 self.title,
10922 self.thumbnail,
10923 self.disable_notification,
10924 self.protect_content,
10925 self.allow_paid_broadcast,
10926 self.message_effect_id,
10927 self.suggested_post_parameters,
10928 self.reply_parameters,
10929 self.reply_markup,
10930 )
10931 .await
10932 }
10933}
10934pub struct CallEditMessageText<'a, V> {
10935 bot: &'a Bot,
10936 business_connection_id: Option<&'a str>,
10937 chat_id: Option<V>,
10938 message_id: Option<i64>,
10939 inline_message_id: Option<&'a str>,
10940 text: &'a str,
10941 parse_mode: Option<&'a str>,
10942 entities: Option<&'a Vec<MessageEntity>>,
10943 link_preview_options: Option<&'a LinkPreviewOptions>,
10944 reply_markup: Option<&'a InlineKeyboardMarkup>,
10945}
10946impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageText<'a, V> {
10947 #[allow(rustdoc::invalid_html_tags)]
10948 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
10949 #[allow(clippy::needless_lifetimes)]
10950 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
10951 self.business_connection_id = Some(business_connection_id);
10952 self
10953 }
10954 #[allow(clippy::needless_lifetimes)]
10955 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
10956 &self.business_connection_id
10957 }
10958 #[allow(rustdoc::invalid_html_tags)]
10959 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
10960 #[allow(clippy::needless_lifetimes)]
10961 pub fn chat_id(mut self, chat_id: V) -> Self {
10962 self.chat_id = Some(chat_id);
10963 self
10964 }
10965 #[allow(clippy::needless_lifetimes)]
10966 pub fn get_chat_id(&'a self) -> &'a Option<V> {
10967 &self.chat_id
10968 }
10969 #[allow(rustdoc::invalid_html_tags)]
10970 #[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
10971 #[allow(clippy::needless_lifetimes)]
10972 pub fn message_id(mut self, message_id: i64) -> Self {
10973 self.message_id = Some(message_id);
10974 self
10975 }
10976 #[allow(clippy::needless_lifetimes)]
10977 pub fn get_message_id(&'a self) -> &'a Option<i64> {
10978 &self.message_id
10979 }
10980 #[allow(rustdoc::invalid_html_tags)]
10981 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
10982 #[allow(clippy::needless_lifetimes)]
10983 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
10984 self.inline_message_id = Some(inline_message_id);
10985 self
10986 }
10987 #[allow(clippy::needless_lifetimes)]
10988 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
10989 &self.inline_message_id
10990 }
10991 #[allow(rustdoc::invalid_html_tags)]
10992 #[doc = "New text of the message, 1-4096 characters after entities parsing"]
10993 #[allow(clippy::needless_lifetimes)]
10994 pub fn text(mut self, text: &'a str) -> Self {
10995 self.text = text;
10996 self
10997 }
10998 #[allow(clippy::needless_lifetimes)]
10999 pub fn get_text(&'a self) -> &'a &'a str {
11000 &self.text
11001 }
11002 #[allow(rustdoc::invalid_html_tags)]
11003 #[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
11004 #[allow(clippy::needless_lifetimes)]
11005 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
11006 self.parse_mode = Some(parse_mode);
11007 self
11008 }
11009 #[allow(clippy::needless_lifetimes)]
11010 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
11011 &self.parse_mode
11012 }
11013 #[allow(rustdoc::invalid_html_tags)]
11014 #[doc = "A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode"]
11015 #[allow(clippy::needless_lifetimes)]
11016 pub fn entities(mut self, entities: &'a Vec<MessageEntity>) -> Self {
11017 self.entities = Some(entities);
11018 self
11019 }
11020 #[allow(clippy::needless_lifetimes)]
11021 pub fn get_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
11022 &self.entities
11023 }
11024 #[allow(rustdoc::invalid_html_tags)]
11025 #[doc = "Link preview generation options for the message"]
11026 #[allow(clippy::needless_lifetimes)]
11027 pub fn link_preview_options<T>(mut self, link_preview_options: T) -> Self
11028 where
11029 T: Into<&'a LinkPreviewOptions>,
11030 {
11031 self.link_preview_options = Some(link_preview_options.into());
11032 self
11033 }
11034 #[allow(clippy::needless_lifetimes)]
11035 pub fn get_link_preview_options(&'a self) -> &'a Option<&'a LinkPreviewOptions> {
11036 &self.link_preview_options
11037 }
11038 #[allow(rustdoc::invalid_html_tags)]
11039 #[doc = "A JSON-serialized object for an inline keyboard."]
11040 #[allow(clippy::needless_lifetimes)]
11041 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
11042 where
11043 T: Into<&'a InlineKeyboardMarkup>,
11044 {
11045 self.reply_markup = Some(reply_markup.into());
11046 self
11047 }
11048 #[allow(clippy::needless_lifetimes)]
11049 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
11050 &self.reply_markup
11051 }
11052 pub async fn build(self) -> BotResult<MessageBool> {
11053 self.bot
11054 .edit_message_text(
11055 self.business_connection_id,
11056 self.chat_id,
11057 self.message_id,
11058 self.inline_message_id,
11059 self.text,
11060 self.parse_mode,
11061 self.entities,
11062 self.link_preview_options,
11063 self.reply_markup,
11064 )
11065 .await
11066 }
11067}
11068pub struct CallGetChatMenuButton<'a> {
11069 bot: &'a Bot,
11070 chat_id: Option<i64>,
11071}
11072impl<'a> CallGetChatMenuButton<'a> {
11073 #[allow(rustdoc::invalid_html_tags)]
11074 #[doc = "Unique identifier for the target private chat. If not specified, default bot's menu button will be returned"]
11075 #[allow(clippy::needless_lifetimes)]
11076 pub fn chat_id(mut self, chat_id: i64) -> Self {
11077 self.chat_id = Some(chat_id);
11078 self
11079 }
11080 #[allow(clippy::needless_lifetimes)]
11081 pub fn get_chat_id(&'a self) -> &'a Option<i64> {
11082 &self.chat_id
11083 }
11084 pub async fn build(self) -> BotResult<MenuButton> {
11085 self.bot.get_chat_menu_button(self.chat_id).await
11086 }
11087}
11088pub struct CallSendSticker<'a, V> {
11089 bot: &'a Bot,
11090 business_connection_id: Option<&'a str>,
11091 chat_id: V,
11092 message_thread_id: Option<i64>,
11093 direct_messages_topic_id: Option<i64>,
11094 sticker: FileData,
11095 emoji: Option<&'a str>,
11096 disable_notification: Option<bool>,
11097 protect_content: Option<bool>,
11098 allow_paid_broadcast: Option<bool>,
11099 message_effect_id: Option<&'a str>,
11100 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
11101 reply_parameters: Option<&'a ReplyParameters>,
11102 reply_markup: Option<&'a EReplyMarkup>,
11103}
11104impl<'a, V: Into<ChatHandle> + Serialize> CallSendSticker<'a, V> {
11105 #[allow(rustdoc::invalid_html_tags)]
11106 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
11107 #[allow(clippy::needless_lifetimes)]
11108 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11109 self.business_connection_id = Some(business_connection_id);
11110 self
11111 }
11112 #[allow(clippy::needless_lifetimes)]
11113 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
11114 &self.business_connection_id
11115 }
11116 #[allow(rustdoc::invalid_html_tags)]
11117 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
11118 #[allow(clippy::needless_lifetimes)]
11119 pub fn chat_id(mut self, chat_id: V) -> Self {
11120 self.chat_id = chat_id;
11121 self
11122 }
11123 #[allow(clippy::needless_lifetimes)]
11124 pub fn get_chat_id(&'a self) -> &'a V {
11125 &self.chat_id
11126 }
11127 #[allow(rustdoc::invalid_html_tags)]
11128 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
11129 #[allow(clippy::needless_lifetimes)]
11130 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
11131 self.message_thread_id = Some(message_thread_id);
11132 self
11133 }
11134 #[allow(clippy::needless_lifetimes)]
11135 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
11136 &self.message_thread_id
11137 }
11138 #[allow(rustdoc::invalid_html_tags)]
11139 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
11140 #[allow(clippy::needless_lifetimes)]
11141 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
11142 self.direct_messages_topic_id = Some(direct_messages_topic_id);
11143 self
11144 }
11145 #[allow(clippy::needless_lifetimes)]
11146 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
11147 &self.direct_messages_topic_id
11148 }
11149 #[allow(rustdoc::invalid_html_tags)]
11150 #[doc = "Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Video and animated stickers can't be sent via an HTTP URL."]
11151 #[allow(clippy::needless_lifetimes)]
11152 pub fn sticker(mut self, sticker: FileData) -> Self {
11153 self.sticker = sticker;
11154 self
11155 }
11156 #[allow(clippy::needless_lifetimes)]
11157 pub fn get_sticker(&'a self) -> &'a FileData {
11158 &self.sticker
11159 }
11160 #[allow(rustdoc::invalid_html_tags)]
11161 #[doc = "Emoji associated with the sticker; only for just uploaded stickers"]
11162 #[allow(clippy::needless_lifetimes)]
11163 pub fn emoji(mut self, emoji: &'a str) -> Self {
11164 self.emoji = Some(emoji);
11165 self
11166 }
11167 #[allow(clippy::needless_lifetimes)]
11168 pub fn get_emoji(&'a self) -> &'a Option<&'a str> {
11169 &self.emoji
11170 }
11171 #[allow(rustdoc::invalid_html_tags)]
11172 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
11173 #[allow(clippy::needless_lifetimes)]
11174 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
11175 self.disable_notification = Some(disable_notification);
11176 self
11177 }
11178 #[allow(clippy::needless_lifetimes)]
11179 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
11180 &self.disable_notification
11181 }
11182 #[allow(rustdoc::invalid_html_tags)]
11183 #[doc = "Protects the contents of the sent message from forwarding and saving"]
11184 #[allow(clippy::needless_lifetimes)]
11185 pub fn protect_content(mut self, protect_content: bool) -> Self {
11186 self.protect_content = Some(protect_content);
11187 self
11188 }
11189 #[allow(clippy::needless_lifetimes)]
11190 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
11191 &self.protect_content
11192 }
11193 #[allow(rustdoc::invalid_html_tags)]
11194 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
11195 #[allow(clippy::needless_lifetimes)]
11196 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
11197 self.allow_paid_broadcast = Some(allow_paid_broadcast);
11198 self
11199 }
11200 #[allow(clippy::needless_lifetimes)]
11201 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
11202 &self.allow_paid_broadcast
11203 }
11204 #[allow(rustdoc::invalid_html_tags)]
11205 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
11206 #[allow(clippy::needless_lifetimes)]
11207 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
11208 self.message_effect_id = Some(message_effect_id);
11209 self
11210 }
11211 #[allow(clippy::needless_lifetimes)]
11212 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
11213 &self.message_effect_id
11214 }
11215 #[allow(rustdoc::invalid_html_tags)]
11216 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
11217 #[allow(clippy::needless_lifetimes)]
11218 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
11219 where
11220 T: Into<&'a SuggestedPostParameters>,
11221 {
11222 self.suggested_post_parameters = Some(suggested_post_parameters.into());
11223 self
11224 }
11225 #[allow(clippy::needless_lifetimes)]
11226 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
11227 &self.suggested_post_parameters
11228 }
11229 #[allow(rustdoc::invalid_html_tags)]
11230 #[doc = "Description of the message to reply to"]
11231 #[allow(clippy::needless_lifetimes)]
11232 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
11233 where
11234 T: Into<&'a ReplyParameters>,
11235 {
11236 self.reply_parameters = Some(reply_parameters.into());
11237 self
11238 }
11239 #[allow(clippy::needless_lifetimes)]
11240 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
11241 &self.reply_parameters
11242 }
11243 #[allow(rustdoc::invalid_html_tags)]
11244 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
11245 #[allow(clippy::needless_lifetimes)]
11246 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
11247 where
11248 T: Into<&'a EReplyMarkup>,
11249 {
11250 self.reply_markup = Some(reply_markup.into());
11251 self
11252 }
11253 #[allow(clippy::needless_lifetimes)]
11254 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
11255 &self.reply_markup
11256 }
11257 pub async fn build(self) -> BotResult<Message> {
11258 self.bot
11259 .send_sticker(
11260 self.business_connection_id,
11261 self.chat_id,
11262 self.message_thread_id,
11263 self.direct_messages_topic_id,
11264 self.sticker,
11265 self.emoji,
11266 self.disable_notification,
11267 self.protect_content,
11268 self.allow_paid_broadcast,
11269 self.message_effect_id,
11270 self.suggested_post_parameters,
11271 self.reply_parameters,
11272 self.reply_markup,
11273 )
11274 .await
11275 }
11276}
11277pub struct CallSendVideo<'a, V> {
11278 bot: &'a Bot,
11279 business_connection_id: Option<&'a str>,
11280 chat_id: V,
11281 message_thread_id: Option<i64>,
11282 direct_messages_topic_id: Option<i64>,
11283 video: FileData,
11284 duration: Option<i64>,
11285 width: Option<i64>,
11286 height: Option<i64>,
11287 thumbnail: Option<FileData>,
11288 cover: Option<FileData>,
11289 start_timestamp: Option<i64>,
11290 caption: Option<&'a str>,
11291 parse_mode: Option<&'a str>,
11292 caption_entities: Option<&'a Vec<MessageEntity>>,
11293 show_caption_above_media: Option<bool>,
11294 has_spoiler: Option<bool>,
11295 supports_streaming: Option<bool>,
11296 disable_notification: Option<bool>,
11297 protect_content: Option<bool>,
11298 allow_paid_broadcast: Option<bool>,
11299 message_effect_id: Option<&'a str>,
11300 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
11301 reply_parameters: Option<&'a ReplyParameters>,
11302 reply_markup: Option<&'a EReplyMarkup>,
11303}
11304impl<'a, V: Into<ChatHandle> + Serialize> CallSendVideo<'a, V> {
11305 #[allow(rustdoc::invalid_html_tags)]
11306 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
11307 #[allow(clippy::needless_lifetimes)]
11308 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11309 self.business_connection_id = Some(business_connection_id);
11310 self
11311 }
11312 #[allow(clippy::needless_lifetimes)]
11313 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
11314 &self.business_connection_id
11315 }
11316 #[allow(rustdoc::invalid_html_tags)]
11317 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
11318 #[allow(clippy::needless_lifetimes)]
11319 pub fn chat_id(mut self, chat_id: V) -> Self {
11320 self.chat_id = chat_id;
11321 self
11322 }
11323 #[allow(clippy::needless_lifetimes)]
11324 pub fn get_chat_id(&'a self) -> &'a V {
11325 &self.chat_id
11326 }
11327 #[allow(rustdoc::invalid_html_tags)]
11328 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
11329 #[allow(clippy::needless_lifetimes)]
11330 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
11331 self.message_thread_id = Some(message_thread_id);
11332 self
11333 }
11334 #[allow(clippy::needless_lifetimes)]
11335 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
11336 &self.message_thread_id
11337 }
11338 #[allow(rustdoc::invalid_html_tags)]
11339 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
11340 #[allow(clippy::needless_lifetimes)]
11341 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
11342 self.direct_messages_topic_id = Some(direct_messages_topic_id);
11343 self
11344 }
11345 #[allow(clippy::needless_lifetimes)]
11346 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
11347 &self.direct_messages_topic_id
11348 }
11349 #[allow(rustdoc::invalid_html_tags)]
11350 #[doc = "Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
11351 #[allow(clippy::needless_lifetimes)]
11352 pub fn video(mut self, video: FileData) -> Self {
11353 self.video = video;
11354 self
11355 }
11356 #[allow(clippy::needless_lifetimes)]
11357 pub fn get_video(&'a self) -> &'a FileData {
11358 &self.video
11359 }
11360 #[allow(rustdoc::invalid_html_tags)]
11361 #[doc = "Duration of sent video in seconds"]
11362 #[allow(clippy::needless_lifetimes)]
11363 pub fn duration(mut self, duration: i64) -> Self {
11364 self.duration = Some(duration);
11365 self
11366 }
11367 #[allow(clippy::needless_lifetimes)]
11368 pub fn get_duration(&'a self) -> &'a Option<i64> {
11369 &self.duration
11370 }
11371 #[allow(rustdoc::invalid_html_tags)]
11372 #[doc = "Video width"]
11373 #[allow(clippy::needless_lifetimes)]
11374 pub fn width(mut self, width: i64) -> Self {
11375 self.width = Some(width);
11376 self
11377 }
11378 #[allow(clippy::needless_lifetimes)]
11379 pub fn get_width(&'a self) -> &'a Option<i64> {
11380 &self.width
11381 }
11382 #[allow(rustdoc::invalid_html_tags)]
11383 #[doc = "Video height"]
11384 #[allow(clippy::needless_lifetimes)]
11385 pub fn height(mut self, height: i64) -> Self {
11386 self.height = Some(height);
11387 self
11388 }
11389 #[allow(clippy::needless_lifetimes)]
11390 pub fn get_height(&'a self) -> &'a Option<i64> {
11391 &self.height
11392 }
11393 #[allow(rustdoc::invalid_html_tags)]
11394 #[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
11395 #[allow(clippy::needless_lifetimes)]
11396 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
11397 self.thumbnail = Some(thumbnail);
11398 self
11399 }
11400 #[allow(clippy::needless_lifetimes)]
11401 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
11402 &self.thumbnail
11403 }
11404 #[allow(rustdoc::invalid_html_tags)]
11405 #[doc = "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \"attach://<file_attach_name>\" to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
11406 #[allow(clippy::needless_lifetimes)]
11407 pub fn cover(mut self, cover: FileData) -> Self {
11408 self.cover = Some(cover);
11409 self
11410 }
11411 #[allow(clippy::needless_lifetimes)]
11412 pub fn get_cover(&'a self) -> &'a Option<FileData> {
11413 &self.cover
11414 }
11415 #[allow(rustdoc::invalid_html_tags)]
11416 #[doc = "Start timestamp for the video in the message"]
11417 #[allow(clippy::needless_lifetimes)]
11418 pub fn start_timestamp(mut self, start_timestamp: i64) -> Self {
11419 self.start_timestamp = Some(start_timestamp);
11420 self
11421 }
11422 #[allow(clippy::needless_lifetimes)]
11423 pub fn get_start_timestamp(&'a self) -> &'a Option<i64> {
11424 &self.start_timestamp
11425 }
11426 #[allow(rustdoc::invalid_html_tags)]
11427 #[doc = "Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing"]
11428 #[allow(clippy::needless_lifetimes)]
11429 pub fn caption(mut self, caption: &'a str) -> Self {
11430 self.caption = Some(caption);
11431 self
11432 }
11433 #[allow(clippy::needless_lifetimes)]
11434 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
11435 &self.caption
11436 }
11437 #[allow(rustdoc::invalid_html_tags)]
11438 #[doc = "Mode for parsing entities in the video caption. See formatting options for more details."]
11439 #[allow(clippy::needless_lifetimes)]
11440 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
11441 self.parse_mode = Some(parse_mode);
11442 self
11443 }
11444 #[allow(clippy::needless_lifetimes)]
11445 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
11446 &self.parse_mode
11447 }
11448 #[allow(rustdoc::invalid_html_tags)]
11449 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
11450 #[allow(clippy::needless_lifetimes)]
11451 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
11452 self.caption_entities = Some(caption_entities);
11453 self
11454 }
11455 #[allow(clippy::needless_lifetimes)]
11456 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
11457 &self.caption_entities
11458 }
11459 #[allow(rustdoc::invalid_html_tags)]
11460 #[doc = "Pass True, if the caption must be shown above the message media"]
11461 #[allow(clippy::needless_lifetimes)]
11462 pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
11463 self.show_caption_above_media = Some(show_caption_above_media);
11464 self
11465 }
11466 #[allow(clippy::needless_lifetimes)]
11467 pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
11468 &self.show_caption_above_media
11469 }
11470 #[allow(rustdoc::invalid_html_tags)]
11471 #[doc = "Pass True if the video needs to be covered with a spoiler animation"]
11472 #[allow(clippy::needless_lifetimes)]
11473 pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
11474 self.has_spoiler = Some(has_spoiler);
11475 self
11476 }
11477 #[allow(clippy::needless_lifetimes)]
11478 pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
11479 &self.has_spoiler
11480 }
11481 #[allow(rustdoc::invalid_html_tags)]
11482 #[doc = "Pass True if the uploaded video is suitable for streaming"]
11483 #[allow(clippy::needless_lifetimes)]
11484 pub fn supports_streaming(mut self, supports_streaming: bool) -> Self {
11485 self.supports_streaming = Some(supports_streaming);
11486 self
11487 }
11488 #[allow(clippy::needless_lifetimes)]
11489 pub fn get_supports_streaming(&'a self) -> &'a Option<bool> {
11490 &self.supports_streaming
11491 }
11492 #[allow(rustdoc::invalid_html_tags)]
11493 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
11494 #[allow(clippy::needless_lifetimes)]
11495 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
11496 self.disable_notification = Some(disable_notification);
11497 self
11498 }
11499 #[allow(clippy::needless_lifetimes)]
11500 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
11501 &self.disable_notification
11502 }
11503 #[allow(rustdoc::invalid_html_tags)]
11504 #[doc = "Protects the contents of the sent message from forwarding and saving"]
11505 #[allow(clippy::needless_lifetimes)]
11506 pub fn protect_content(mut self, protect_content: bool) -> Self {
11507 self.protect_content = Some(protect_content);
11508 self
11509 }
11510 #[allow(clippy::needless_lifetimes)]
11511 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
11512 &self.protect_content
11513 }
11514 #[allow(rustdoc::invalid_html_tags)]
11515 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
11516 #[allow(clippy::needless_lifetimes)]
11517 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
11518 self.allow_paid_broadcast = Some(allow_paid_broadcast);
11519 self
11520 }
11521 #[allow(clippy::needless_lifetimes)]
11522 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
11523 &self.allow_paid_broadcast
11524 }
11525 #[allow(rustdoc::invalid_html_tags)]
11526 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
11527 #[allow(clippy::needless_lifetimes)]
11528 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
11529 self.message_effect_id = Some(message_effect_id);
11530 self
11531 }
11532 #[allow(clippy::needless_lifetimes)]
11533 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
11534 &self.message_effect_id
11535 }
11536 #[allow(rustdoc::invalid_html_tags)]
11537 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
11538 #[allow(clippy::needless_lifetimes)]
11539 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
11540 where
11541 T: Into<&'a SuggestedPostParameters>,
11542 {
11543 self.suggested_post_parameters = Some(suggested_post_parameters.into());
11544 self
11545 }
11546 #[allow(clippy::needless_lifetimes)]
11547 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
11548 &self.suggested_post_parameters
11549 }
11550 #[allow(rustdoc::invalid_html_tags)]
11551 #[doc = "Description of the message to reply to"]
11552 #[allow(clippy::needless_lifetimes)]
11553 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
11554 where
11555 T: Into<&'a ReplyParameters>,
11556 {
11557 self.reply_parameters = Some(reply_parameters.into());
11558 self
11559 }
11560 #[allow(clippy::needless_lifetimes)]
11561 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
11562 &self.reply_parameters
11563 }
11564 #[allow(rustdoc::invalid_html_tags)]
11565 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
11566 #[allow(clippy::needless_lifetimes)]
11567 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
11568 where
11569 T: Into<&'a EReplyMarkup>,
11570 {
11571 self.reply_markup = Some(reply_markup.into());
11572 self
11573 }
11574 #[allow(clippy::needless_lifetimes)]
11575 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
11576 &self.reply_markup
11577 }
11578 pub async fn build(self) -> BotResult<Message> {
11579 self.bot
11580 .send_video(
11581 self.business_connection_id,
11582 self.chat_id,
11583 self.message_thread_id,
11584 self.direct_messages_topic_id,
11585 self.video,
11586 self.duration,
11587 self.width,
11588 self.height,
11589 self.thumbnail,
11590 self.cover,
11591 self.start_timestamp,
11592 self.caption,
11593 self.parse_mode,
11594 self.caption_entities,
11595 self.show_caption_above_media,
11596 self.has_spoiler,
11597 self.supports_streaming,
11598 self.disable_notification,
11599 self.protect_content,
11600 self.allow_paid_broadcast,
11601 self.message_effect_id,
11602 self.suggested_post_parameters,
11603 self.reply_parameters,
11604 self.reply_markup,
11605 )
11606 .await
11607 }
11608}
11609pub struct CallBanChatSenderChat<'a, V> {
11610 bot: &'a Bot,
11611 chat_id: V,
11612 sender_chat_id: i64,
11613}
11614impl<'a, V: Into<ChatHandle> + Serialize> CallBanChatSenderChat<'a, V> {
11615 #[allow(rustdoc::invalid_html_tags)]
11616 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
11617 #[allow(clippy::needless_lifetimes)]
11618 pub fn chat_id(mut self, chat_id: V) -> Self {
11619 self.chat_id = chat_id;
11620 self
11621 }
11622 #[allow(clippy::needless_lifetimes)]
11623 pub fn get_chat_id(&'a self) -> &'a V {
11624 &self.chat_id
11625 }
11626 #[allow(rustdoc::invalid_html_tags)]
11627 #[doc = "Unique identifier of the target sender chat"]
11628 #[allow(clippy::needless_lifetimes)]
11629 pub fn sender_chat_id(mut self, sender_chat_id: i64) -> Self {
11630 self.sender_chat_id = sender_chat_id;
11631 self
11632 }
11633 #[allow(clippy::needless_lifetimes)]
11634 pub fn get_sender_chat_id(&'a self) -> &'a i64 {
11635 &self.sender_chat_id
11636 }
11637 pub async fn build(self) -> BotResult<bool> {
11638 self.bot
11639 .ban_chat_sender_chat(self.chat_id, self.sender_chat_id)
11640 .await
11641 }
11642}
11643pub struct CallGetChatAdministrators<'a, V> {
11644 bot: &'a Bot,
11645 chat_id: V,
11646}
11647impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatAdministrators<'a, V> {
11648 #[allow(rustdoc::invalid_html_tags)]
11649 #[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
11650 #[allow(clippy::needless_lifetimes)]
11651 pub fn chat_id(mut self, chat_id: V) -> Self {
11652 self.chat_id = chat_id;
11653 self
11654 }
11655 #[allow(clippy::needless_lifetimes)]
11656 pub fn get_chat_id(&'a self) -> &'a V {
11657 &self.chat_id
11658 }
11659 pub async fn build(self) -> BotResult<Vec<ChatMember>> {
11660 self.bot.get_chat_administrators(self.chat_id).await
11661 }
11662}
11663pub struct CallDeleteForumTopic<'a, V> {
11664 bot: &'a Bot,
11665 chat_id: V,
11666 message_thread_id: i64,
11667}
11668impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteForumTopic<'a, V> {
11669 #[allow(rustdoc::invalid_html_tags)]
11670 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
11671 #[allow(clippy::needless_lifetimes)]
11672 pub fn chat_id(mut self, chat_id: V) -> Self {
11673 self.chat_id = chat_id;
11674 self
11675 }
11676 #[allow(clippy::needless_lifetimes)]
11677 pub fn get_chat_id(&'a self) -> &'a V {
11678 &self.chat_id
11679 }
11680 #[allow(rustdoc::invalid_html_tags)]
11681 #[doc = "Unique identifier for the target message thread of the forum topic"]
11682 #[allow(clippy::needless_lifetimes)]
11683 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
11684 self.message_thread_id = message_thread_id;
11685 self
11686 }
11687 #[allow(clippy::needless_lifetimes)]
11688 pub fn get_message_thread_id(&'a self) -> &'a i64 {
11689 &self.message_thread_id
11690 }
11691 pub async fn build(self) -> BotResult<bool> {
11692 self.bot
11693 .delete_forum_topic(self.chat_id, self.message_thread_id)
11694 .await
11695 }
11696}
11697pub struct CallGetBusinessConnection<'a> {
11698 bot: &'a Bot,
11699 business_connection_id: &'a str,
11700}
11701impl<'a> CallGetBusinessConnection<'a> {
11702 #[allow(rustdoc::invalid_html_tags)]
11703 #[doc = "Unique identifier of the business connection"]
11704 #[allow(clippy::needless_lifetimes)]
11705 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11706 self.business_connection_id = business_connection_id;
11707 self
11708 }
11709 #[allow(clippy::needless_lifetimes)]
11710 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
11711 &self.business_connection_id
11712 }
11713 pub async fn build(self) -> BotResult<BusinessConnection> {
11714 self.bot
11715 .get_business_connection(self.business_connection_id)
11716 .await
11717 }
11718}
11719pub struct CallSetBusinessAccountName<'a> {
11720 bot: &'a Bot,
11721 business_connection_id: &'a str,
11722 first_name: &'a str,
11723 last_name: Option<&'a str>,
11724}
11725impl<'a> CallSetBusinessAccountName<'a> {
11726 #[allow(rustdoc::invalid_html_tags)]
11727 #[doc = "Unique identifier of the business connection"]
11728 #[allow(clippy::needless_lifetimes)]
11729 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11730 self.business_connection_id = business_connection_id;
11731 self
11732 }
11733 #[allow(clippy::needless_lifetimes)]
11734 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
11735 &self.business_connection_id
11736 }
11737 #[allow(rustdoc::invalid_html_tags)]
11738 #[doc = "The new value of the first name for the business account; 1-64 characters"]
11739 #[allow(clippy::needless_lifetimes)]
11740 pub fn first_name(mut self, first_name: &'a str) -> Self {
11741 self.first_name = first_name;
11742 self
11743 }
11744 #[allow(clippy::needless_lifetimes)]
11745 pub fn get_first_name(&'a self) -> &'a &'a str {
11746 &self.first_name
11747 }
11748 #[allow(rustdoc::invalid_html_tags)]
11749 #[doc = "The new value of the last name for the business account; 0-64 characters"]
11750 #[allow(clippy::needless_lifetimes)]
11751 pub fn last_name(mut self, last_name: &'a str) -> Self {
11752 self.last_name = Some(last_name);
11753 self
11754 }
11755 #[allow(clippy::needless_lifetimes)]
11756 pub fn get_last_name(&'a self) -> &'a Option<&'a str> {
11757 &self.last_name
11758 }
11759 pub async fn build(self) -> BotResult<bool> {
11760 self.bot
11761 .set_business_account_name(self.business_connection_id, self.first_name, self.last_name)
11762 .await
11763 }
11764}
11765pub struct CallSetBusinessAccountGiftSettings<'a> {
11766 bot: &'a Bot,
11767 business_connection_id: &'a str,
11768 show_gift_button: bool,
11769 accepted_gift_types: &'a AcceptedGiftTypes,
11770}
11771impl<'a> CallSetBusinessAccountGiftSettings<'a> {
11772 #[allow(rustdoc::invalid_html_tags)]
11773 #[doc = "Unique identifier of the business connection"]
11774 #[allow(clippy::needless_lifetimes)]
11775 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11776 self.business_connection_id = business_connection_id;
11777 self
11778 }
11779 #[allow(clippy::needless_lifetimes)]
11780 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
11781 &self.business_connection_id
11782 }
11783 #[allow(rustdoc::invalid_html_tags)]
11784 #[doc = "Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field"]
11785 #[allow(clippy::needless_lifetimes)]
11786 pub fn show_gift_button(mut self, show_gift_button: bool) -> Self {
11787 self.show_gift_button = show_gift_button;
11788 self
11789 }
11790 #[allow(clippy::needless_lifetimes)]
11791 pub fn get_show_gift_button(&'a self) -> &'a bool {
11792 &self.show_gift_button
11793 }
11794 #[allow(rustdoc::invalid_html_tags)]
11795 #[doc = "Types of gifts accepted by the business account"]
11796 #[allow(clippy::needless_lifetimes)]
11797 pub fn accepted_gift_types<T>(mut self, accepted_gift_types: T) -> Self
11798 where
11799 T: Into<&'a AcceptedGiftTypes>,
11800 {
11801 self.accepted_gift_types = accepted_gift_types.into();
11802 self
11803 }
11804 #[allow(clippy::needless_lifetimes)]
11805 pub fn get_accepted_gift_types(&'a self) -> &'a &'a AcceptedGiftTypes {
11806 &self.accepted_gift_types
11807 }
11808 pub async fn build(self) -> BotResult<bool> {
11809 self.bot
11810 .set_business_account_gift_settings(
11811 self.business_connection_id,
11812 self.show_gift_button,
11813 self.accepted_gift_types,
11814 )
11815 .await
11816 }
11817}
11818pub struct CallStopMessageLiveLocation<'a, V> {
11819 bot: &'a Bot,
11820 business_connection_id: Option<&'a str>,
11821 chat_id: Option<V>,
11822 message_id: Option<i64>,
11823 inline_message_id: Option<&'a str>,
11824 reply_markup: Option<&'a InlineKeyboardMarkup>,
11825}
11826impl<'a, V: Into<ChatHandle> + Serialize> CallStopMessageLiveLocation<'a, V> {
11827 #[allow(rustdoc::invalid_html_tags)]
11828 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
11829 #[allow(clippy::needless_lifetimes)]
11830 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11831 self.business_connection_id = Some(business_connection_id);
11832 self
11833 }
11834 #[allow(clippy::needless_lifetimes)]
11835 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
11836 &self.business_connection_id
11837 }
11838 #[allow(rustdoc::invalid_html_tags)]
11839 #[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
11840 #[allow(clippy::needless_lifetimes)]
11841 pub fn chat_id(mut self, chat_id: V) -> Self {
11842 self.chat_id = Some(chat_id);
11843 self
11844 }
11845 #[allow(clippy::needless_lifetimes)]
11846 pub fn get_chat_id(&'a self) -> &'a Option<V> {
11847 &self.chat_id
11848 }
11849 #[allow(rustdoc::invalid_html_tags)]
11850 #[doc = "Required if inline_message_id is not specified. Identifier of the message with live location to stop"]
11851 #[allow(clippy::needless_lifetimes)]
11852 pub fn message_id(mut self, message_id: i64) -> Self {
11853 self.message_id = Some(message_id);
11854 self
11855 }
11856 #[allow(clippy::needless_lifetimes)]
11857 pub fn get_message_id(&'a self) -> &'a Option<i64> {
11858 &self.message_id
11859 }
11860 #[allow(rustdoc::invalid_html_tags)]
11861 #[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
11862 #[allow(clippy::needless_lifetimes)]
11863 pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
11864 self.inline_message_id = Some(inline_message_id);
11865 self
11866 }
11867 #[allow(clippy::needless_lifetimes)]
11868 pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
11869 &self.inline_message_id
11870 }
11871 #[allow(rustdoc::invalid_html_tags)]
11872 #[doc = "A JSON-serialized object for a new inline keyboard."]
11873 #[allow(clippy::needless_lifetimes)]
11874 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
11875 where
11876 T: Into<&'a InlineKeyboardMarkup>,
11877 {
11878 self.reply_markup = Some(reply_markup.into());
11879 self
11880 }
11881 #[allow(clippy::needless_lifetimes)]
11882 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
11883 &self.reply_markup
11884 }
11885 pub async fn build(self) -> BotResult<MessageBool> {
11886 self.bot
11887 .stop_message_live_location(
11888 self.business_connection_id,
11889 self.chat_id,
11890 self.message_id,
11891 self.inline_message_id,
11892 self.reply_markup,
11893 )
11894 .await
11895 }
11896}
11897pub struct CallSendPoll<'a, V> {
11898 bot: &'a Bot,
11899 business_connection_id: Option<&'a str>,
11900 chat_id: V,
11901 message_thread_id: Option<i64>,
11902 question: &'a str,
11903 question_parse_mode: Option<&'a str>,
11904 question_entities: Option<&'a Vec<MessageEntity>>,
11905 options: &'a Vec<InputPollOption>,
11906 is_anonymous: Option<bool>,
11907 tg_type: Option<&'a str>,
11908 allows_multiple_answers: Option<bool>,
11909 correct_option_id: Option<i64>,
11910 explanation: Option<&'a str>,
11911 explanation_parse_mode: Option<&'a str>,
11912 explanation_entities: Option<&'a Vec<MessageEntity>>,
11913 open_period: Option<i64>,
11914 close_date: Option<i64>,
11915 is_closed: Option<bool>,
11916 disable_notification: Option<bool>,
11917 protect_content: Option<bool>,
11918 allow_paid_broadcast: Option<bool>,
11919 message_effect_id: Option<&'a str>,
11920 reply_parameters: Option<&'a ReplyParameters>,
11921 reply_markup: Option<&'a EReplyMarkup>,
11922}
11923impl<'a, V: Into<ChatHandle> + Serialize> CallSendPoll<'a, V> {
11924 #[allow(rustdoc::invalid_html_tags)]
11925 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
11926 #[allow(clippy::needless_lifetimes)]
11927 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
11928 self.business_connection_id = Some(business_connection_id);
11929 self
11930 }
11931 #[allow(clippy::needless_lifetimes)]
11932 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
11933 &self.business_connection_id
11934 }
11935 #[allow(rustdoc::invalid_html_tags)]
11936 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). Polls can't be sent to channel direct messages chats."]
11937 #[allow(clippy::needless_lifetimes)]
11938 pub fn chat_id(mut self, chat_id: V) -> Self {
11939 self.chat_id = chat_id;
11940 self
11941 }
11942 #[allow(clippy::needless_lifetimes)]
11943 pub fn get_chat_id(&'a self) -> &'a V {
11944 &self.chat_id
11945 }
11946 #[allow(rustdoc::invalid_html_tags)]
11947 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
11948 #[allow(clippy::needless_lifetimes)]
11949 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
11950 self.message_thread_id = Some(message_thread_id);
11951 self
11952 }
11953 #[allow(clippy::needless_lifetimes)]
11954 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
11955 &self.message_thread_id
11956 }
11957 #[allow(rustdoc::invalid_html_tags)]
11958 #[doc = "Poll question, 1-300 characters"]
11959 #[allow(clippy::needless_lifetimes)]
11960 pub fn question(mut self, question: &'a str) -> Self {
11961 self.question = question;
11962 self
11963 }
11964 #[allow(clippy::needless_lifetimes)]
11965 pub fn get_question(&'a self) -> &'a &'a str {
11966 &self.question
11967 }
11968 #[allow(rustdoc::invalid_html_tags)]
11969 #[doc = "Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed"]
11970 #[allow(clippy::needless_lifetimes)]
11971 pub fn question_parse_mode(mut self, question_parse_mode: &'a str) -> Self {
11972 self.question_parse_mode = Some(question_parse_mode);
11973 self
11974 }
11975 #[allow(clippy::needless_lifetimes)]
11976 pub fn get_question_parse_mode(&'a self) -> &'a Option<&'a str> {
11977 &self.question_parse_mode
11978 }
11979 #[allow(rustdoc::invalid_html_tags)]
11980 #[doc = "A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode"]
11981 #[allow(clippy::needless_lifetimes)]
11982 pub fn question_entities(mut self, question_entities: &'a Vec<MessageEntity>) -> Self {
11983 self.question_entities = Some(question_entities);
11984 self
11985 }
11986 #[allow(clippy::needless_lifetimes)]
11987 pub fn get_question_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
11988 &self.question_entities
11989 }
11990 #[allow(rustdoc::invalid_html_tags)]
11991 #[doc = "A JSON-serialized list of 2-12 answer options"]
11992 #[allow(clippy::needless_lifetimes)]
11993 pub fn options(mut self, options: &'a Vec<InputPollOption>) -> Self {
11994 self.options = options;
11995 self
11996 }
11997 #[allow(clippy::needless_lifetimes)]
11998 pub fn get_options(&'a self) -> &'a &'a Vec<InputPollOption> {
11999 &self.options
12000 }
12001 #[allow(rustdoc::invalid_html_tags)]
12002 #[doc = "True, if the poll needs to be anonymous, defaults to True"]
12003 #[allow(clippy::needless_lifetimes)]
12004 pub fn is_anonymous(mut self, is_anonymous: bool) -> Self {
12005 self.is_anonymous = Some(is_anonymous);
12006 self
12007 }
12008 #[allow(clippy::needless_lifetimes)]
12009 pub fn get_is_anonymous(&'a self) -> &'a Option<bool> {
12010 &self.is_anonymous
12011 }
12012 #[allow(rustdoc::invalid_html_tags)]
12013 #[doc = "Poll type, \"quiz\" or \"regular\", defaults to \"regular\""]
12014 #[allow(clippy::needless_lifetimes)]
12015 pub fn tg_type(mut self, tg_type: &'a str) -> Self {
12016 self.tg_type = Some(tg_type);
12017 self
12018 }
12019 #[allow(clippy::needless_lifetimes)]
12020 pub fn get_tg_type(&'a self) -> &'a Option<&'a str> {
12021 &self.tg_type
12022 }
12023 #[allow(rustdoc::invalid_html_tags)]
12024 #[doc = "True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False"]
12025 #[allow(clippy::needless_lifetimes)]
12026 pub fn allows_multiple_answers(mut self, allows_multiple_answers: bool) -> Self {
12027 self.allows_multiple_answers = Some(allows_multiple_answers);
12028 self
12029 }
12030 #[allow(clippy::needless_lifetimes)]
12031 pub fn get_allows_multiple_answers(&'a self) -> &'a Option<bool> {
12032 &self.allows_multiple_answers
12033 }
12034 #[allow(rustdoc::invalid_html_tags)]
12035 #[doc = "0-based identifier of the correct answer option, required for polls in quiz mode"]
12036 #[allow(clippy::needless_lifetimes)]
12037 pub fn correct_option_id(mut self, correct_option_id: i64) -> Self {
12038 self.correct_option_id = Some(correct_option_id);
12039 self
12040 }
12041 #[allow(clippy::needless_lifetimes)]
12042 pub fn get_correct_option_id(&'a self) -> &'a Option<i64> {
12043 &self.correct_option_id
12044 }
12045 #[allow(rustdoc::invalid_html_tags)]
12046 #[doc = "Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing"]
12047 #[allow(clippy::needless_lifetimes)]
12048 pub fn explanation(mut self, explanation: &'a str) -> Self {
12049 self.explanation = Some(explanation);
12050 self
12051 }
12052 #[allow(clippy::needless_lifetimes)]
12053 pub fn get_explanation(&'a self) -> &'a Option<&'a str> {
12054 &self.explanation
12055 }
12056 #[allow(rustdoc::invalid_html_tags)]
12057 #[doc = "Mode for parsing entities in the explanation. See formatting options for more details."]
12058 #[allow(clippy::needless_lifetimes)]
12059 pub fn explanation_parse_mode(mut self, explanation_parse_mode: &'a str) -> Self {
12060 self.explanation_parse_mode = Some(explanation_parse_mode);
12061 self
12062 }
12063 #[allow(clippy::needless_lifetimes)]
12064 pub fn get_explanation_parse_mode(&'a self) -> &'a Option<&'a str> {
12065 &self.explanation_parse_mode
12066 }
12067 #[allow(rustdoc::invalid_html_tags)]
12068 #[doc = "A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode"]
12069 #[allow(clippy::needless_lifetimes)]
12070 pub fn explanation_entities(mut self, explanation_entities: &'a Vec<MessageEntity>) -> Self {
12071 self.explanation_entities = Some(explanation_entities);
12072 self
12073 }
12074 #[allow(clippy::needless_lifetimes)]
12075 pub fn get_explanation_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
12076 &self.explanation_entities
12077 }
12078 #[allow(rustdoc::invalid_html_tags)]
12079 #[doc = "Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date."]
12080 #[allow(clippy::needless_lifetimes)]
12081 pub fn open_period(mut self, open_period: i64) -> Self {
12082 self.open_period = Some(open_period);
12083 self
12084 }
12085 #[allow(clippy::needless_lifetimes)]
12086 pub fn get_open_period(&'a self) -> &'a Option<i64> {
12087 &self.open_period
12088 }
12089 #[allow(rustdoc::invalid_html_tags)]
12090 #[doc = "Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period."]
12091 #[allow(clippy::needless_lifetimes)]
12092 pub fn close_date(mut self, close_date: i64) -> Self {
12093 self.close_date = Some(close_date);
12094 self
12095 }
12096 #[allow(clippy::needless_lifetimes)]
12097 pub fn get_close_date(&'a self) -> &'a Option<i64> {
12098 &self.close_date
12099 }
12100 #[allow(rustdoc::invalid_html_tags)]
12101 #[doc = "Pass True if the poll needs to be immediately closed. This can be useful for poll preview."]
12102 #[allow(clippy::needless_lifetimes)]
12103 pub fn is_closed(mut self, is_closed: bool) -> Self {
12104 self.is_closed = Some(is_closed);
12105 self
12106 }
12107 #[allow(clippy::needless_lifetimes)]
12108 pub fn get_is_closed(&'a self) -> &'a Option<bool> {
12109 &self.is_closed
12110 }
12111 #[allow(rustdoc::invalid_html_tags)]
12112 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
12113 #[allow(clippy::needless_lifetimes)]
12114 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
12115 self.disable_notification = Some(disable_notification);
12116 self
12117 }
12118 #[allow(clippy::needless_lifetimes)]
12119 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
12120 &self.disable_notification
12121 }
12122 #[allow(rustdoc::invalid_html_tags)]
12123 #[doc = "Protects the contents of the sent message from forwarding and saving"]
12124 #[allow(clippy::needless_lifetimes)]
12125 pub fn protect_content(mut self, protect_content: bool) -> Self {
12126 self.protect_content = Some(protect_content);
12127 self
12128 }
12129 #[allow(clippy::needless_lifetimes)]
12130 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
12131 &self.protect_content
12132 }
12133 #[allow(rustdoc::invalid_html_tags)]
12134 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
12135 #[allow(clippy::needless_lifetimes)]
12136 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
12137 self.allow_paid_broadcast = Some(allow_paid_broadcast);
12138 self
12139 }
12140 #[allow(clippy::needless_lifetimes)]
12141 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
12142 &self.allow_paid_broadcast
12143 }
12144 #[allow(rustdoc::invalid_html_tags)]
12145 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
12146 #[allow(clippy::needless_lifetimes)]
12147 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
12148 self.message_effect_id = Some(message_effect_id);
12149 self
12150 }
12151 #[allow(clippy::needless_lifetimes)]
12152 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
12153 &self.message_effect_id
12154 }
12155 #[allow(rustdoc::invalid_html_tags)]
12156 #[doc = "Description of the message to reply to"]
12157 #[allow(clippy::needless_lifetimes)]
12158 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
12159 where
12160 T: Into<&'a ReplyParameters>,
12161 {
12162 self.reply_parameters = Some(reply_parameters.into());
12163 self
12164 }
12165 #[allow(clippy::needless_lifetimes)]
12166 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
12167 &self.reply_parameters
12168 }
12169 #[allow(rustdoc::invalid_html_tags)]
12170 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
12171 #[allow(clippy::needless_lifetimes)]
12172 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
12173 where
12174 T: Into<&'a EReplyMarkup>,
12175 {
12176 self.reply_markup = Some(reply_markup.into());
12177 self
12178 }
12179 #[allow(clippy::needless_lifetimes)]
12180 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
12181 &self.reply_markup
12182 }
12183 pub async fn build(self) -> BotResult<Message> {
12184 self.bot
12185 .send_poll(
12186 self.business_connection_id,
12187 self.chat_id,
12188 self.message_thread_id,
12189 self.question,
12190 self.question_parse_mode,
12191 self.question_entities,
12192 self.options,
12193 self.is_anonymous,
12194 self.tg_type,
12195 self.allows_multiple_answers,
12196 self.correct_option_id,
12197 self.explanation,
12198 self.explanation_parse_mode,
12199 self.explanation_entities,
12200 self.open_period,
12201 self.close_date,
12202 self.is_closed,
12203 self.disable_notification,
12204 self.protect_content,
12205 self.allow_paid_broadcast,
12206 self.message_effect_id,
12207 self.reply_parameters,
12208 self.reply_markup,
12209 )
12210 .await
12211 }
12212}
12213pub struct CallAnswerCallbackQuery<'a> {
12214 bot: &'a Bot,
12215 callback_query_id: &'a str,
12216 text: Option<&'a str>,
12217 show_alert: Option<bool>,
12218 url: Option<&'a str>,
12219 cache_time: Option<i64>,
12220}
12221impl<'a> CallAnswerCallbackQuery<'a> {
12222 #[allow(rustdoc::invalid_html_tags)]
12223 #[doc = "Unique identifier for the query to be answered"]
12224 #[allow(clippy::needless_lifetimes)]
12225 pub fn callback_query_id(mut self, callback_query_id: &'a str) -> Self {
12226 self.callback_query_id = callback_query_id;
12227 self
12228 }
12229 #[allow(clippy::needless_lifetimes)]
12230 pub fn get_callback_query_id(&'a self) -> &'a &'a str {
12231 &self.callback_query_id
12232 }
12233 #[allow(rustdoc::invalid_html_tags)]
12234 #[doc = "Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters"]
12235 #[allow(clippy::needless_lifetimes)]
12236 pub fn text(mut self, text: &'a str) -> Self {
12237 self.text = Some(text);
12238 self
12239 }
12240 #[allow(clippy::needless_lifetimes)]
12241 pub fn get_text(&'a self) -> &'a Option<&'a str> {
12242 &self.text
12243 }
12244 #[allow(rustdoc::invalid_html_tags)]
12245 #[doc = "If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false."]
12246 #[allow(clippy::needless_lifetimes)]
12247 pub fn show_alert(mut self, show_alert: bool) -> Self {
12248 self.show_alert = Some(show_alert);
12249 self
12250 }
12251 #[allow(clippy::needless_lifetimes)]
12252 pub fn get_show_alert(&'a self) -> &'a Option<bool> {
12253 &self.show_alert
12254 }
12255 #[allow(rustdoc::invalid_html_tags)]
12256 #[doc = "URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter."]
12257 #[allow(clippy::needless_lifetimes)]
12258 pub fn url(mut self, url: &'a str) -> Self {
12259 self.url = Some(url);
12260 self
12261 }
12262 #[allow(clippy::needless_lifetimes)]
12263 pub fn get_url(&'a self) -> &'a Option<&'a str> {
12264 &self.url
12265 }
12266 #[allow(rustdoc::invalid_html_tags)]
12267 #[doc = "The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."]
12268 #[allow(clippy::needless_lifetimes)]
12269 pub fn cache_time(mut self, cache_time: i64) -> Self {
12270 self.cache_time = Some(cache_time);
12271 self
12272 }
12273 #[allow(clippy::needless_lifetimes)]
12274 pub fn get_cache_time(&'a self) -> &'a Option<i64> {
12275 &self.cache_time
12276 }
12277 pub async fn build(self) -> BotResult<bool> {
12278 self.bot
12279 .answer_callback_query(
12280 self.callback_query_id,
12281 self.text,
12282 self.show_alert,
12283 self.url,
12284 self.cache_time,
12285 )
12286 .await
12287 }
12288}
12289pub struct CallForwardMessage<'a, V> {
12290 bot: &'a Bot,
12291 chat_id: V,
12292 message_thread_id: Option<i64>,
12293 direct_messages_topic_id: Option<i64>,
12294 from_chat_id: V,
12295 video_start_timestamp: Option<i64>,
12296 disable_notification: Option<bool>,
12297 protect_content: Option<bool>,
12298 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
12299 message_id: i64,
12300}
12301impl<'a, V: Into<ChatHandle> + Serialize> CallForwardMessage<'a, V> {
12302 #[allow(rustdoc::invalid_html_tags)]
12303 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
12304 #[allow(clippy::needless_lifetimes)]
12305 pub fn chat_id(mut self, chat_id: V) -> Self {
12306 self.chat_id = chat_id;
12307 self
12308 }
12309 #[allow(clippy::needless_lifetimes)]
12310 pub fn get_chat_id(&'a self) -> &'a V {
12311 &self.chat_id
12312 }
12313 #[allow(rustdoc::invalid_html_tags)]
12314 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
12315 #[allow(clippy::needless_lifetimes)]
12316 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
12317 self.message_thread_id = Some(message_thread_id);
12318 self
12319 }
12320 #[allow(clippy::needless_lifetimes)]
12321 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
12322 &self.message_thread_id
12323 }
12324 #[allow(rustdoc::invalid_html_tags)]
12325 #[doc = "Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat"]
12326 #[allow(clippy::needless_lifetimes)]
12327 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
12328 self.direct_messages_topic_id = Some(direct_messages_topic_id);
12329 self
12330 }
12331 #[allow(clippy::needless_lifetimes)]
12332 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
12333 &self.direct_messages_topic_id
12334 }
12335 #[allow(rustdoc::invalid_html_tags)]
12336 #[doc = "Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)"]
12337 #[allow(clippy::needless_lifetimes)]
12338 pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
12339 self.from_chat_id = from_chat_id;
12340 self
12341 }
12342 #[allow(clippy::needless_lifetimes)]
12343 pub fn get_from_chat_id(&'a self) -> &'a V {
12344 &self.from_chat_id
12345 }
12346 #[allow(rustdoc::invalid_html_tags)]
12347 #[doc = "New start timestamp for the forwarded video in the message"]
12348 #[allow(clippy::needless_lifetimes)]
12349 pub fn video_start_timestamp(mut self, video_start_timestamp: i64) -> Self {
12350 self.video_start_timestamp = Some(video_start_timestamp);
12351 self
12352 }
12353 #[allow(clippy::needless_lifetimes)]
12354 pub fn get_video_start_timestamp(&'a self) -> &'a Option<i64> {
12355 &self.video_start_timestamp
12356 }
12357 #[allow(rustdoc::invalid_html_tags)]
12358 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
12359 #[allow(clippy::needless_lifetimes)]
12360 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
12361 self.disable_notification = Some(disable_notification);
12362 self
12363 }
12364 #[allow(clippy::needless_lifetimes)]
12365 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
12366 &self.disable_notification
12367 }
12368 #[allow(rustdoc::invalid_html_tags)]
12369 #[doc = "Protects the contents of the forwarded message from forwarding and saving"]
12370 #[allow(clippy::needless_lifetimes)]
12371 pub fn protect_content(mut self, protect_content: bool) -> Self {
12372 self.protect_content = Some(protect_content);
12373 self
12374 }
12375 #[allow(clippy::needless_lifetimes)]
12376 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
12377 &self.protect_content
12378 }
12379 #[allow(rustdoc::invalid_html_tags)]
12380 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only"]
12381 #[allow(clippy::needless_lifetimes)]
12382 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
12383 where
12384 T: Into<&'a SuggestedPostParameters>,
12385 {
12386 self.suggested_post_parameters = Some(suggested_post_parameters.into());
12387 self
12388 }
12389 #[allow(clippy::needless_lifetimes)]
12390 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
12391 &self.suggested_post_parameters
12392 }
12393 #[allow(rustdoc::invalid_html_tags)]
12394 #[doc = "Message identifier in the chat specified in from_chat_id"]
12395 #[allow(clippy::needless_lifetimes)]
12396 pub fn message_id(mut self, message_id: i64) -> Self {
12397 self.message_id = message_id;
12398 self
12399 }
12400 #[allow(clippy::needless_lifetimes)]
12401 pub fn get_message_id(&'a self) -> &'a i64 {
12402 &self.message_id
12403 }
12404 pub async fn build(self) -> BotResult<Message> {
12405 self.bot
12406 .forward_message(
12407 self.chat_id,
12408 self.message_thread_id,
12409 self.direct_messages_topic_id,
12410 self.from_chat_id,
12411 self.video_start_timestamp,
12412 self.disable_notification,
12413 self.protect_content,
12414 self.suggested_post_parameters,
12415 self.message_id,
12416 )
12417 .await
12418 }
12419}
12420pub struct CallRevokeChatInviteLink<'a, V> {
12421 bot: &'a Bot,
12422 chat_id: V,
12423 invite_link: &'a str,
12424}
12425impl<'a, V: Into<ChatHandle> + Serialize> CallRevokeChatInviteLink<'a, V> {
12426 #[allow(rustdoc::invalid_html_tags)]
12427 #[doc = "Unique identifier of the target chat or username of the target channel (in the format @channelusername)"]
12428 #[allow(clippy::needless_lifetimes)]
12429 pub fn chat_id(mut self, chat_id: V) -> Self {
12430 self.chat_id = chat_id;
12431 self
12432 }
12433 #[allow(clippy::needless_lifetimes)]
12434 pub fn get_chat_id(&'a self) -> &'a V {
12435 &self.chat_id
12436 }
12437 #[allow(rustdoc::invalid_html_tags)]
12438 #[doc = "The invite link to revoke"]
12439 #[allow(clippy::needless_lifetimes)]
12440 pub fn invite_link(mut self, invite_link: &'a str) -> Self {
12441 self.invite_link = invite_link;
12442 self
12443 }
12444 #[allow(clippy::needless_lifetimes)]
12445 pub fn get_invite_link(&'a self) -> &'a &'a str {
12446 &self.invite_link
12447 }
12448 pub async fn build(self) -> BotResult<ChatInviteLink> {
12449 self.bot
12450 .revoke_chat_invite_link(self.chat_id, self.invite_link)
12451 .await
12452 }
12453}
12454pub struct CallStopPoll<'a, V> {
12455 bot: &'a Bot,
12456 business_connection_id: Option<&'a str>,
12457 chat_id: V,
12458 message_id: i64,
12459 reply_markup: Option<&'a InlineKeyboardMarkup>,
12460}
12461impl<'a, V: Into<ChatHandle> + Serialize> CallStopPoll<'a, V> {
12462 #[allow(rustdoc::invalid_html_tags)]
12463 #[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
12464 #[allow(clippy::needless_lifetimes)]
12465 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
12466 self.business_connection_id = Some(business_connection_id);
12467 self
12468 }
12469 #[allow(clippy::needless_lifetimes)]
12470 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
12471 &self.business_connection_id
12472 }
12473 #[allow(rustdoc::invalid_html_tags)]
12474 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
12475 #[allow(clippy::needless_lifetimes)]
12476 pub fn chat_id(mut self, chat_id: V) -> Self {
12477 self.chat_id = chat_id;
12478 self
12479 }
12480 #[allow(clippy::needless_lifetimes)]
12481 pub fn get_chat_id(&'a self) -> &'a V {
12482 &self.chat_id
12483 }
12484 #[allow(rustdoc::invalid_html_tags)]
12485 #[doc = "Identifier of the original message with the poll"]
12486 #[allow(clippy::needless_lifetimes)]
12487 pub fn message_id(mut self, message_id: i64) -> Self {
12488 self.message_id = message_id;
12489 self
12490 }
12491 #[allow(clippy::needless_lifetimes)]
12492 pub fn get_message_id(&'a self) -> &'a i64 {
12493 &self.message_id
12494 }
12495 #[allow(rustdoc::invalid_html_tags)]
12496 #[doc = "A JSON-serialized object for a new message inline keyboard."]
12497 #[allow(clippy::needless_lifetimes)]
12498 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
12499 where
12500 T: Into<&'a InlineKeyboardMarkup>,
12501 {
12502 self.reply_markup = Some(reply_markup.into());
12503 self
12504 }
12505 #[allow(clippy::needless_lifetimes)]
12506 pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
12507 &self.reply_markup
12508 }
12509 pub async fn build(self) -> BotResult<Poll> {
12510 self.bot
12511 .stop_poll(
12512 self.business_connection_id,
12513 self.chat_id,
12514 self.message_id,
12515 self.reply_markup,
12516 )
12517 .await
12518 }
12519}
12520pub struct CallUnhideGeneralForumTopic<'a, V> {
12521 bot: &'a Bot,
12522 chat_id: V,
12523}
12524impl<'a, V: Into<ChatHandle> + Serialize> CallUnhideGeneralForumTopic<'a, V> {
12525 #[allow(rustdoc::invalid_html_tags)]
12526 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
12527 #[allow(clippy::needless_lifetimes)]
12528 pub fn chat_id(mut self, chat_id: V) -> Self {
12529 self.chat_id = chat_id;
12530 self
12531 }
12532 #[allow(clippy::needless_lifetimes)]
12533 pub fn get_chat_id(&'a self) -> &'a V {
12534 &self.chat_id
12535 }
12536 pub async fn build(self) -> BotResult<bool> {
12537 self.bot.unhide_general_forum_topic(self.chat_id).await
12538 }
12539}
12540pub struct CallUploadStickerFile<'a> {
12541 bot: &'a Bot,
12542 user_id: i64,
12543 sticker: FileData,
12544 sticker_format: &'a str,
12545}
12546impl<'a> CallUploadStickerFile<'a> {
12547 #[allow(rustdoc::invalid_html_tags)]
12548 #[doc = "User identifier of sticker file owner"]
12549 #[allow(clippy::needless_lifetimes)]
12550 pub fn user_id(mut self, user_id: i64) -> Self {
12551 self.user_id = user_id;
12552 self
12553 }
12554 #[allow(clippy::needless_lifetimes)]
12555 pub fn get_user_id(&'a self) -> &'a i64 {
12556 &self.user_id
12557 }
12558 #[allow(rustdoc::invalid_html_tags)]
12559 #[doc = "A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
12560 #[allow(clippy::needless_lifetimes)]
12561 pub fn sticker(mut self, sticker: FileData) -> Self {
12562 self.sticker = sticker;
12563 self
12564 }
12565 #[allow(clippy::needless_lifetimes)]
12566 pub fn get_sticker(&'a self) -> &'a FileData {
12567 &self.sticker
12568 }
12569 #[allow(rustdoc::invalid_html_tags)]
12570 #[doc = "Format of the sticker, must be one of \"static\", \"animated\", \"video\""]
12571 #[allow(clippy::needless_lifetimes)]
12572 pub fn sticker_format(mut self, sticker_format: &'a str) -> Self {
12573 self.sticker_format = sticker_format;
12574 self
12575 }
12576 #[allow(clippy::needless_lifetimes)]
12577 pub fn get_sticker_format(&'a self) -> &'a &'a str {
12578 &self.sticker_format
12579 }
12580 pub async fn build(self) -> BotResult<File> {
12581 self.bot
12582 .upload_sticker_file(self.user_id, self.sticker, self.sticker_format)
12583 .await
12584 }
12585}
12586pub struct CallSetStickerKeywords<'a> {
12587 bot: &'a Bot,
12588 sticker: &'a str,
12589 keywords: Option<&'a Vec<String>>,
12590}
12591impl<'a> CallSetStickerKeywords<'a> {
12592 #[allow(rustdoc::invalid_html_tags)]
12593 #[doc = "File identifier of the sticker"]
12594 #[allow(clippy::needless_lifetimes)]
12595 pub fn sticker(mut self, sticker: &'a str) -> Self {
12596 self.sticker = sticker;
12597 self
12598 }
12599 #[allow(clippy::needless_lifetimes)]
12600 pub fn get_sticker(&'a self) -> &'a &'a str {
12601 &self.sticker
12602 }
12603 #[allow(rustdoc::invalid_html_tags)]
12604 #[doc = "A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"]
12605 #[allow(clippy::needless_lifetimes)]
12606 pub fn keywords(mut self, keywords: &'a Vec<String>) -> Self {
12607 self.keywords = Some(keywords);
12608 self
12609 }
12610 #[allow(clippy::needless_lifetimes)]
12611 pub fn get_keywords(&'a self) -> &'a Option<&'a Vec<String>> {
12612 &self.keywords
12613 }
12614 pub async fn build(self) -> BotResult<bool> {
12615 self.bot
12616 .set_sticker_keywords(self.sticker, self.keywords)
12617 .await
12618 }
12619}
12620pub struct CallSetChatMenuButton<'a> {
12621 bot: &'a Bot,
12622 chat_id: Option<i64>,
12623 menu_button: Option<&'a MenuButton>,
12624}
12625impl<'a> CallSetChatMenuButton<'a> {
12626 #[allow(rustdoc::invalid_html_tags)]
12627 #[doc = "Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"]
12628 #[allow(clippy::needless_lifetimes)]
12629 pub fn chat_id(mut self, chat_id: i64) -> Self {
12630 self.chat_id = Some(chat_id);
12631 self
12632 }
12633 #[allow(clippy::needless_lifetimes)]
12634 pub fn get_chat_id(&'a self) -> &'a Option<i64> {
12635 &self.chat_id
12636 }
12637 #[allow(rustdoc::invalid_html_tags)]
12638 #[doc = "A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault"]
12639 #[allow(clippy::needless_lifetimes)]
12640 pub fn menu_button<T>(mut self, menu_button: T) -> Self
12641 where
12642 T: Into<&'a MenuButton>,
12643 {
12644 self.menu_button = Some(menu_button.into());
12645 self
12646 }
12647 #[allow(clippy::needless_lifetimes)]
12648 pub fn get_menu_button(&'a self) -> &'a Option<&'a MenuButton> {
12649 &self.menu_button
12650 }
12651 pub async fn build(self) -> BotResult<bool> {
12652 self.bot
12653 .set_chat_menu_button(self.chat_id, self.menu_button)
12654 .await
12655 }
12656}
12657pub struct CallEditStory<'a> {
12658 bot: &'a Bot,
12659 business_connection_id: &'a str,
12660 story_id: i64,
12661 content: &'a InputStoryContent,
12662 caption: Option<&'a str>,
12663 parse_mode: Option<&'a str>,
12664 caption_entities: Option<&'a Vec<MessageEntity>>,
12665 areas: Option<&'a Vec<StoryArea>>,
12666}
12667impl<'a> CallEditStory<'a> {
12668 #[allow(rustdoc::invalid_html_tags)]
12669 #[doc = "Unique identifier of the business connection"]
12670 #[allow(clippy::needless_lifetimes)]
12671 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
12672 self.business_connection_id = business_connection_id;
12673 self
12674 }
12675 #[allow(clippy::needless_lifetimes)]
12676 pub fn get_business_connection_id(&'a self) -> &'a &'a str {
12677 &self.business_connection_id
12678 }
12679 #[allow(rustdoc::invalid_html_tags)]
12680 #[doc = "Unique identifier of the story to edit"]
12681 #[allow(clippy::needless_lifetimes)]
12682 pub fn story_id(mut self, story_id: i64) -> Self {
12683 self.story_id = story_id;
12684 self
12685 }
12686 #[allow(clippy::needless_lifetimes)]
12687 pub fn get_story_id(&'a self) -> &'a i64 {
12688 &self.story_id
12689 }
12690 #[allow(rustdoc::invalid_html_tags)]
12691 #[doc = "Content of the story"]
12692 #[allow(clippy::needless_lifetimes)]
12693 pub fn content<T>(mut self, content: T) -> Self
12694 where
12695 T: Into<&'a InputStoryContent>,
12696 {
12697 self.content = content.into();
12698 self
12699 }
12700 #[allow(clippy::needless_lifetimes)]
12701 pub fn get_content(&'a self) -> &'a &'a InputStoryContent {
12702 &self.content
12703 }
12704 #[allow(rustdoc::invalid_html_tags)]
12705 #[doc = "Caption of the story, 0-2048 characters after entities parsing"]
12706 #[allow(clippy::needless_lifetimes)]
12707 pub fn caption(mut self, caption: &'a str) -> Self {
12708 self.caption = Some(caption);
12709 self
12710 }
12711 #[allow(clippy::needless_lifetimes)]
12712 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
12713 &self.caption
12714 }
12715 #[allow(rustdoc::invalid_html_tags)]
12716 #[doc = "Mode for parsing entities in the story caption. See formatting options for more details."]
12717 #[allow(clippy::needless_lifetimes)]
12718 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
12719 self.parse_mode = Some(parse_mode);
12720 self
12721 }
12722 #[allow(clippy::needless_lifetimes)]
12723 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
12724 &self.parse_mode
12725 }
12726 #[allow(rustdoc::invalid_html_tags)]
12727 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
12728 #[allow(clippy::needless_lifetimes)]
12729 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
12730 self.caption_entities = Some(caption_entities);
12731 self
12732 }
12733 #[allow(clippy::needless_lifetimes)]
12734 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
12735 &self.caption_entities
12736 }
12737 #[allow(rustdoc::invalid_html_tags)]
12738 #[doc = "A JSON-serialized list of clickable areas to be shown on the story"]
12739 #[allow(clippy::needless_lifetimes)]
12740 pub fn areas(mut self, areas: &'a Vec<StoryArea>) -> Self {
12741 self.areas = Some(areas);
12742 self
12743 }
12744 #[allow(clippy::needless_lifetimes)]
12745 pub fn get_areas(&'a self) -> &'a Option<&'a Vec<StoryArea>> {
12746 &self.areas
12747 }
12748 pub async fn build(self) -> BotResult<Story> {
12749 self.bot
12750 .edit_story(
12751 self.business_connection_id,
12752 self.story_id,
12753 self.content,
12754 self.caption,
12755 self.parse_mode,
12756 self.caption_entities,
12757 self.areas,
12758 )
12759 .await
12760 }
12761}
12762pub struct CallSendDocument<'a, V> {
12763 bot: &'a Bot,
12764 business_connection_id: Option<&'a str>,
12765 chat_id: V,
12766 message_thread_id: Option<i64>,
12767 direct_messages_topic_id: Option<i64>,
12768 document: FileData,
12769 thumbnail: Option<FileData>,
12770 caption: Option<&'a str>,
12771 parse_mode: Option<&'a str>,
12772 caption_entities: Option<&'a Vec<MessageEntity>>,
12773 disable_content_type_detection: Option<bool>,
12774 disable_notification: Option<bool>,
12775 protect_content: Option<bool>,
12776 allow_paid_broadcast: Option<bool>,
12777 message_effect_id: Option<&'a str>,
12778 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
12779 reply_parameters: Option<&'a ReplyParameters>,
12780 reply_markup: Option<&'a EReplyMarkup>,
12781}
12782impl<'a, V: Into<ChatHandle> + Serialize> CallSendDocument<'a, V> {
12783 #[allow(rustdoc::invalid_html_tags)]
12784 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
12785 #[allow(clippy::needless_lifetimes)]
12786 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
12787 self.business_connection_id = Some(business_connection_id);
12788 self
12789 }
12790 #[allow(clippy::needless_lifetimes)]
12791 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
12792 &self.business_connection_id
12793 }
12794 #[allow(rustdoc::invalid_html_tags)]
12795 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
12796 #[allow(clippy::needless_lifetimes)]
12797 pub fn chat_id(mut self, chat_id: V) -> Self {
12798 self.chat_id = chat_id;
12799 self
12800 }
12801 #[allow(clippy::needless_lifetimes)]
12802 pub fn get_chat_id(&'a self) -> &'a V {
12803 &self.chat_id
12804 }
12805 #[allow(rustdoc::invalid_html_tags)]
12806 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
12807 #[allow(clippy::needless_lifetimes)]
12808 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
12809 self.message_thread_id = Some(message_thread_id);
12810 self
12811 }
12812 #[allow(clippy::needless_lifetimes)]
12813 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
12814 &self.message_thread_id
12815 }
12816 #[allow(rustdoc::invalid_html_tags)]
12817 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
12818 #[allow(clippy::needless_lifetimes)]
12819 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
12820 self.direct_messages_topic_id = Some(direct_messages_topic_id);
12821 self
12822 }
12823 #[allow(clippy::needless_lifetimes)]
12824 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
12825 &self.direct_messages_topic_id
12826 }
12827 #[allow(rustdoc::invalid_html_tags)]
12828 #[doc = "File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
12829 #[allow(clippy::needless_lifetimes)]
12830 pub fn document(mut self, document: FileData) -> Self {
12831 self.document = document;
12832 self
12833 }
12834 #[allow(clippy::needless_lifetimes)]
12835 pub fn get_document(&'a self) -> &'a FileData {
12836 &self.document
12837 }
12838 #[allow(rustdoc::invalid_html_tags)]
12839 #[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
12840 #[allow(clippy::needless_lifetimes)]
12841 pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
12842 self.thumbnail = Some(thumbnail);
12843 self
12844 }
12845 #[allow(clippy::needless_lifetimes)]
12846 pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
12847 &self.thumbnail
12848 }
12849 #[allow(rustdoc::invalid_html_tags)]
12850 #[doc = "Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing"]
12851 #[allow(clippy::needless_lifetimes)]
12852 pub fn caption(mut self, caption: &'a str) -> Self {
12853 self.caption = Some(caption);
12854 self
12855 }
12856 #[allow(clippy::needless_lifetimes)]
12857 pub fn get_caption(&'a self) -> &'a Option<&'a str> {
12858 &self.caption
12859 }
12860 #[allow(rustdoc::invalid_html_tags)]
12861 #[doc = "Mode for parsing entities in the document caption. See formatting options for more details."]
12862 #[allow(clippy::needless_lifetimes)]
12863 pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
12864 self.parse_mode = Some(parse_mode);
12865 self
12866 }
12867 #[allow(clippy::needless_lifetimes)]
12868 pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
12869 &self.parse_mode
12870 }
12871 #[allow(rustdoc::invalid_html_tags)]
12872 #[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
12873 #[allow(clippy::needless_lifetimes)]
12874 pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
12875 self.caption_entities = Some(caption_entities);
12876 self
12877 }
12878 #[allow(clippy::needless_lifetimes)]
12879 pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
12880 &self.caption_entities
12881 }
12882 #[allow(rustdoc::invalid_html_tags)]
12883 #[doc = "Disables automatic server-side content type detection for files uploaded using multipart/form-data"]
12884 #[allow(clippy::needless_lifetimes)]
12885 pub fn disable_content_type_detection(mut self, disable_content_type_detection: bool) -> Self {
12886 self.disable_content_type_detection = Some(disable_content_type_detection);
12887 self
12888 }
12889 #[allow(clippy::needless_lifetimes)]
12890 pub fn get_disable_content_type_detection(&'a self) -> &'a Option<bool> {
12891 &self.disable_content_type_detection
12892 }
12893 #[allow(rustdoc::invalid_html_tags)]
12894 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
12895 #[allow(clippy::needless_lifetimes)]
12896 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
12897 self.disable_notification = Some(disable_notification);
12898 self
12899 }
12900 #[allow(clippy::needless_lifetimes)]
12901 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
12902 &self.disable_notification
12903 }
12904 #[allow(rustdoc::invalid_html_tags)]
12905 #[doc = "Protects the contents of the sent message from forwarding and saving"]
12906 #[allow(clippy::needless_lifetimes)]
12907 pub fn protect_content(mut self, protect_content: bool) -> Self {
12908 self.protect_content = Some(protect_content);
12909 self
12910 }
12911 #[allow(clippy::needless_lifetimes)]
12912 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
12913 &self.protect_content
12914 }
12915 #[allow(rustdoc::invalid_html_tags)]
12916 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
12917 #[allow(clippy::needless_lifetimes)]
12918 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
12919 self.allow_paid_broadcast = Some(allow_paid_broadcast);
12920 self
12921 }
12922 #[allow(clippy::needless_lifetimes)]
12923 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
12924 &self.allow_paid_broadcast
12925 }
12926 #[allow(rustdoc::invalid_html_tags)]
12927 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
12928 #[allow(clippy::needless_lifetimes)]
12929 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
12930 self.message_effect_id = Some(message_effect_id);
12931 self
12932 }
12933 #[allow(clippy::needless_lifetimes)]
12934 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
12935 &self.message_effect_id
12936 }
12937 #[allow(rustdoc::invalid_html_tags)]
12938 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
12939 #[allow(clippy::needless_lifetimes)]
12940 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
12941 where
12942 T: Into<&'a SuggestedPostParameters>,
12943 {
12944 self.suggested_post_parameters = Some(suggested_post_parameters.into());
12945 self
12946 }
12947 #[allow(clippy::needless_lifetimes)]
12948 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
12949 &self.suggested_post_parameters
12950 }
12951 #[allow(rustdoc::invalid_html_tags)]
12952 #[doc = "Description of the message to reply to"]
12953 #[allow(clippy::needless_lifetimes)]
12954 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
12955 where
12956 T: Into<&'a ReplyParameters>,
12957 {
12958 self.reply_parameters = Some(reply_parameters.into());
12959 self
12960 }
12961 #[allow(clippy::needless_lifetimes)]
12962 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
12963 &self.reply_parameters
12964 }
12965 #[allow(rustdoc::invalid_html_tags)]
12966 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
12967 #[allow(clippy::needless_lifetimes)]
12968 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
12969 where
12970 T: Into<&'a EReplyMarkup>,
12971 {
12972 self.reply_markup = Some(reply_markup.into());
12973 self
12974 }
12975 #[allow(clippy::needless_lifetimes)]
12976 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
12977 &self.reply_markup
12978 }
12979 pub async fn build(self) -> BotResult<Message> {
12980 self.bot
12981 .send_document(
12982 self.business_connection_id,
12983 self.chat_id,
12984 self.message_thread_id,
12985 self.direct_messages_topic_id,
12986 self.document,
12987 self.thumbnail,
12988 self.caption,
12989 self.parse_mode,
12990 self.caption_entities,
12991 self.disable_content_type_detection,
12992 self.disable_notification,
12993 self.protect_content,
12994 self.allow_paid_broadcast,
12995 self.message_effect_id,
12996 self.suggested_post_parameters,
12997 self.reply_parameters,
12998 self.reply_markup,
12999 )
13000 .await
13001 }
13002}
13003pub struct CallSendVenue<'a, V> {
13004 bot: &'a Bot,
13005 business_connection_id: Option<&'a str>,
13006 chat_id: V,
13007 message_thread_id: Option<i64>,
13008 direct_messages_topic_id: Option<i64>,
13009 latitude: ::ordered_float::OrderedFloat<f64>,
13010 longitude: ::ordered_float::OrderedFloat<f64>,
13011 title: &'a str,
13012 address: &'a str,
13013 foursquare_id: Option<&'a str>,
13014 foursquare_type: Option<&'a str>,
13015 google_place_id: Option<&'a str>,
13016 google_place_type: Option<&'a str>,
13017 disable_notification: Option<bool>,
13018 protect_content: Option<bool>,
13019 allow_paid_broadcast: Option<bool>,
13020 message_effect_id: Option<&'a str>,
13021 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
13022 reply_parameters: Option<&'a ReplyParameters>,
13023 reply_markup: Option<&'a EReplyMarkup>,
13024}
13025impl<'a, V: Into<ChatHandle> + Serialize> CallSendVenue<'a, V> {
13026 #[allow(rustdoc::invalid_html_tags)]
13027 #[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
13028 #[allow(clippy::needless_lifetimes)]
13029 pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
13030 self.business_connection_id = Some(business_connection_id);
13031 self
13032 }
13033 #[allow(clippy::needless_lifetimes)]
13034 pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
13035 &self.business_connection_id
13036 }
13037 #[allow(rustdoc::invalid_html_tags)]
13038 #[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
13039 #[allow(clippy::needless_lifetimes)]
13040 pub fn chat_id(mut self, chat_id: V) -> Self {
13041 self.chat_id = chat_id;
13042 self
13043 }
13044 #[allow(clippy::needless_lifetimes)]
13045 pub fn get_chat_id(&'a self) -> &'a V {
13046 &self.chat_id
13047 }
13048 #[allow(rustdoc::invalid_html_tags)]
13049 #[doc = "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"]
13050 #[allow(clippy::needless_lifetimes)]
13051 pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
13052 self.message_thread_id = Some(message_thread_id);
13053 self
13054 }
13055 #[allow(clippy::needless_lifetimes)]
13056 pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
13057 &self.message_thread_id
13058 }
13059 #[allow(rustdoc::invalid_html_tags)]
13060 #[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
13061 #[allow(clippy::needless_lifetimes)]
13062 pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
13063 self.direct_messages_topic_id = Some(direct_messages_topic_id);
13064 self
13065 }
13066 #[allow(clippy::needless_lifetimes)]
13067 pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
13068 &self.direct_messages_topic_id
13069 }
13070 #[allow(rustdoc::invalid_html_tags)]
13071 #[doc = "Latitude of the venue"]
13072 #[allow(clippy::needless_lifetimes)]
13073 pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
13074 self.latitude = latitude;
13075 self
13076 }
13077 #[allow(clippy::needless_lifetimes)]
13078 pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
13079 &self.latitude
13080 }
13081 #[allow(rustdoc::invalid_html_tags)]
13082 #[doc = "Longitude of the venue"]
13083 #[allow(clippy::needless_lifetimes)]
13084 pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
13085 self.longitude = longitude;
13086 self
13087 }
13088 #[allow(clippy::needless_lifetimes)]
13089 pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
13090 &self.longitude
13091 }
13092 #[allow(rustdoc::invalid_html_tags)]
13093 #[doc = "Name of the venue"]
13094 #[allow(clippy::needless_lifetimes)]
13095 pub fn title(mut self, title: &'a str) -> Self {
13096 self.title = title;
13097 self
13098 }
13099 #[allow(clippy::needless_lifetimes)]
13100 pub fn get_title(&'a self) -> &'a &'a str {
13101 &self.title
13102 }
13103 #[allow(rustdoc::invalid_html_tags)]
13104 #[doc = "Address of the venue"]
13105 #[allow(clippy::needless_lifetimes)]
13106 pub fn address(mut self, address: &'a str) -> Self {
13107 self.address = address;
13108 self
13109 }
13110 #[allow(clippy::needless_lifetimes)]
13111 pub fn get_address(&'a self) -> &'a &'a str {
13112 &self.address
13113 }
13114 #[allow(rustdoc::invalid_html_tags)]
13115 #[doc = "Foursquare identifier of the venue"]
13116 #[allow(clippy::needless_lifetimes)]
13117 pub fn foursquare_id(mut self, foursquare_id: &'a str) -> Self {
13118 self.foursquare_id = Some(foursquare_id);
13119 self
13120 }
13121 #[allow(clippy::needless_lifetimes)]
13122 pub fn get_foursquare_id(&'a self) -> &'a Option<&'a str> {
13123 &self.foursquare_id
13124 }
13125 #[allow(rustdoc::invalid_html_tags)]
13126 #[doc = "Foursquare type of the venue, if known. (For example, \"arts_entertainment/default\", \"arts_entertainment/aquarium\" or \"food/icecream\".)"]
13127 #[allow(clippy::needless_lifetimes)]
13128 pub fn foursquare_type(mut self, foursquare_type: &'a str) -> Self {
13129 self.foursquare_type = Some(foursquare_type);
13130 self
13131 }
13132 #[allow(clippy::needless_lifetimes)]
13133 pub fn get_foursquare_type(&'a self) -> &'a Option<&'a str> {
13134 &self.foursquare_type
13135 }
13136 #[allow(rustdoc::invalid_html_tags)]
13137 #[doc = "Google Places identifier of the venue"]
13138 #[allow(clippy::needless_lifetimes)]
13139 pub fn google_place_id(mut self, google_place_id: &'a str) -> Self {
13140 self.google_place_id = Some(google_place_id);
13141 self
13142 }
13143 #[allow(clippy::needless_lifetimes)]
13144 pub fn get_google_place_id(&'a self) -> &'a Option<&'a str> {
13145 &self.google_place_id
13146 }
13147 #[allow(rustdoc::invalid_html_tags)]
13148 #[doc = "Google Places type of the venue. (See supported types.)"]
13149 #[allow(clippy::needless_lifetimes)]
13150 pub fn google_place_type(mut self, google_place_type: &'a str) -> Self {
13151 self.google_place_type = Some(google_place_type);
13152 self
13153 }
13154 #[allow(clippy::needless_lifetimes)]
13155 pub fn get_google_place_type(&'a self) -> &'a Option<&'a str> {
13156 &self.google_place_type
13157 }
13158 #[allow(rustdoc::invalid_html_tags)]
13159 #[doc = "Sends the message silently. Users will receive a notification with no sound."]
13160 #[allow(clippy::needless_lifetimes)]
13161 pub fn disable_notification(mut self, disable_notification: bool) -> Self {
13162 self.disable_notification = Some(disable_notification);
13163 self
13164 }
13165 #[allow(clippy::needless_lifetimes)]
13166 pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
13167 &self.disable_notification
13168 }
13169 #[allow(rustdoc::invalid_html_tags)]
13170 #[doc = "Protects the contents of the sent message from forwarding and saving"]
13171 #[allow(clippy::needless_lifetimes)]
13172 pub fn protect_content(mut self, protect_content: bool) -> Self {
13173 self.protect_content = Some(protect_content);
13174 self
13175 }
13176 #[allow(clippy::needless_lifetimes)]
13177 pub fn get_protect_content(&'a self) -> &'a Option<bool> {
13178 &self.protect_content
13179 }
13180 #[allow(rustdoc::invalid_html_tags)]
13181 #[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
13182 #[allow(clippy::needless_lifetimes)]
13183 pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
13184 self.allow_paid_broadcast = Some(allow_paid_broadcast);
13185 self
13186 }
13187 #[allow(clippy::needless_lifetimes)]
13188 pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
13189 &self.allow_paid_broadcast
13190 }
13191 #[allow(rustdoc::invalid_html_tags)]
13192 #[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
13193 #[allow(clippy::needless_lifetimes)]
13194 pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
13195 self.message_effect_id = Some(message_effect_id);
13196 self
13197 }
13198 #[allow(clippy::needless_lifetimes)]
13199 pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
13200 &self.message_effect_id
13201 }
13202 #[allow(rustdoc::invalid_html_tags)]
13203 #[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
13204 #[allow(clippy::needless_lifetimes)]
13205 pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
13206 where
13207 T: Into<&'a SuggestedPostParameters>,
13208 {
13209 self.suggested_post_parameters = Some(suggested_post_parameters.into());
13210 self
13211 }
13212 #[allow(clippy::needless_lifetimes)]
13213 pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
13214 &self.suggested_post_parameters
13215 }
13216 #[allow(rustdoc::invalid_html_tags)]
13217 #[doc = "Description of the message to reply to"]
13218 #[allow(clippy::needless_lifetimes)]
13219 pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
13220 where
13221 T: Into<&'a ReplyParameters>,
13222 {
13223 self.reply_parameters = Some(reply_parameters.into());
13224 self
13225 }
13226 #[allow(clippy::needless_lifetimes)]
13227 pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
13228 &self.reply_parameters
13229 }
13230 #[allow(rustdoc::invalid_html_tags)]
13231 #[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
13232 #[allow(clippy::needless_lifetimes)]
13233 pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
13234 where
13235 T: Into<&'a EReplyMarkup>,
13236 {
13237 self.reply_markup = Some(reply_markup.into());
13238 self
13239 }
13240 #[allow(clippy::needless_lifetimes)]
13241 pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
13242 &self.reply_markup
13243 }
13244 pub async fn build(self) -> BotResult<Message> {
13245 self.bot
13246 .send_venue(
13247 self.business_connection_id,
13248 self.chat_id,
13249 self.message_thread_id,
13250 self.direct_messages_topic_id,
13251 self.latitude,
13252 self.longitude,
13253 self.title,
13254 self.address,
13255 self.foursquare_id,
13256 self.foursquare_type,
13257 self.google_place_id,
13258 self.google_place_type,
13259 self.disable_notification,
13260 self.protect_content,
13261 self.allow_paid_broadcast,
13262 self.message_effect_id,
13263 self.suggested_post_parameters,
13264 self.reply_parameters,
13265 self.reply_markup,
13266 )
13267 .await
13268 }
13269}
13270pub struct CallCreateForumTopic<'a, V> {
13271 bot: &'a Bot,
13272 chat_id: V,
13273 name: &'a str,
13274 icon_color: Option<i64>,
13275 icon_custom_emoji_id: Option<&'a str>,
13276}
13277impl<'a, V: Into<ChatHandle> + Serialize> CallCreateForumTopic<'a, V> {
13278 #[allow(rustdoc::invalid_html_tags)]
13279 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
13280 #[allow(clippy::needless_lifetimes)]
13281 pub fn chat_id(mut self, chat_id: V) -> Self {
13282 self.chat_id = chat_id;
13283 self
13284 }
13285 #[allow(clippy::needless_lifetimes)]
13286 pub fn get_chat_id(&'a self) -> &'a V {
13287 &self.chat_id
13288 }
13289 #[allow(rustdoc::invalid_html_tags)]
13290 #[doc = "Topic name, 1-128 characters"]
13291 #[allow(clippy::needless_lifetimes)]
13292 pub fn name(mut self, name: &'a str) -> Self {
13293 self.name = name;
13294 self
13295 }
13296 #[allow(clippy::needless_lifetimes)]
13297 pub fn get_name(&'a self) -> &'a &'a str {
13298 &self.name
13299 }
13300 #[allow(rustdoc::invalid_html_tags)]
13301 #[doc = "Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)"]
13302 #[allow(clippy::needless_lifetimes)]
13303 pub fn icon_color(mut self, icon_color: i64) -> Self {
13304 self.icon_color = Some(icon_color);
13305 self
13306 }
13307 #[allow(clippy::needless_lifetimes)]
13308 pub fn get_icon_color(&'a self) -> &'a Option<i64> {
13309 &self.icon_color
13310 }
13311 #[allow(rustdoc::invalid_html_tags)]
13312 #[doc = "Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers."]
13313 #[allow(clippy::needless_lifetimes)]
13314 pub fn icon_custom_emoji_id(mut self, icon_custom_emoji_id: &'a str) -> Self {
13315 self.icon_custom_emoji_id = Some(icon_custom_emoji_id);
13316 self
13317 }
13318 #[allow(clippy::needless_lifetimes)]
13319 pub fn get_icon_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
13320 &self.icon_custom_emoji_id
13321 }
13322 pub async fn build(self) -> BotResult<ForumTopic> {
13323 self.bot
13324 .create_forum_topic(
13325 self.chat_id,
13326 self.name,
13327 self.icon_color,
13328 self.icon_custom_emoji_id,
13329 )
13330 .await
13331 }
13332}
13333pub struct CallRemoveUserVerification<'a> {
13334 bot: &'a Bot,
13335 user_id: i64,
13336}
13337impl<'a> CallRemoveUserVerification<'a> {
13338 #[allow(rustdoc::invalid_html_tags)]
13339 #[doc = "Unique identifier of the target user"]
13340 #[allow(clippy::needless_lifetimes)]
13341 pub fn user_id(mut self, user_id: i64) -> Self {
13342 self.user_id = user_id;
13343 self
13344 }
13345 #[allow(clippy::needless_lifetimes)]
13346 pub fn get_user_id(&'a self) -> &'a i64 {
13347 &self.user_id
13348 }
13349 pub async fn build(self) -> BotResult<bool> {
13350 self.bot.remove_user_verification(self.user_id).await
13351 }
13352}
13353pub struct CallRestrictChatMember<'a, V> {
13354 bot: &'a Bot,
13355 chat_id: V,
13356 user_id: i64,
13357 permissions: &'a ChatPermissions,
13358 use_independent_chat_permissions: Option<bool>,
13359 until_date: Option<i64>,
13360}
13361impl<'a, V: Into<ChatHandle> + Serialize> CallRestrictChatMember<'a, V> {
13362 #[allow(rustdoc::invalid_html_tags)]
13363 #[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
13364 #[allow(clippy::needless_lifetimes)]
13365 pub fn chat_id(mut self, chat_id: V) -> Self {
13366 self.chat_id = chat_id;
13367 self
13368 }
13369 #[allow(clippy::needless_lifetimes)]
13370 pub fn get_chat_id(&'a self) -> &'a V {
13371 &self.chat_id
13372 }
13373 #[allow(rustdoc::invalid_html_tags)]
13374 #[doc = "Unique identifier of the target user"]
13375 #[allow(clippy::needless_lifetimes)]
13376 pub fn user_id(mut self, user_id: i64) -> Self {
13377 self.user_id = user_id;
13378 self
13379 }
13380 #[allow(clippy::needless_lifetimes)]
13381 pub fn get_user_id(&'a self) -> &'a i64 {
13382 &self.user_id
13383 }
13384 #[allow(rustdoc::invalid_html_tags)]
13385 #[doc = "A JSON-serialized object for new user permissions"]
13386 #[allow(clippy::needless_lifetimes)]
13387 pub fn permissions<T>(mut self, permissions: T) -> Self
13388 where
13389 T: Into<&'a ChatPermissions>,
13390 {
13391 self.permissions = permissions.into();
13392 self
13393 }
13394 #[allow(clippy::needless_lifetimes)]
13395 pub fn get_permissions(&'a self) -> &'a &'a ChatPermissions {
13396 &self.permissions
13397 }
13398 #[allow(rustdoc::invalid_html_tags)]
13399 #[doc = "Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission."]
13400 #[allow(clippy::needless_lifetimes)]
13401 pub fn use_independent_chat_permissions(
13402 mut self,
13403 use_independent_chat_permissions: bool,
13404 ) -> Self {
13405 self.use_independent_chat_permissions = Some(use_independent_chat_permissions);
13406 self
13407 }
13408 #[allow(clippy::needless_lifetimes)]
13409 pub fn get_use_independent_chat_permissions(&'a self) -> &'a Option<bool> {
13410 &self.use_independent_chat_permissions
13411 }
13412 #[allow(rustdoc::invalid_html_tags)]
13413 #[doc = "Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"]
13414 #[allow(clippy::needless_lifetimes)]
13415 pub fn until_date(mut self, until_date: i64) -> Self {
13416 self.until_date = Some(until_date);
13417 self
13418 }
13419 #[allow(clippy::needless_lifetimes)]
13420 pub fn get_until_date(&'a self) -> &'a Option<i64> {
13421 &self.until_date
13422 }
13423 pub async fn build(self) -> BotResult<bool> {
13424 self.bot
13425 .restrict_chat_member(
13426 self.chat_id,
13427 self.user_id,
13428 self.permissions,
13429 self.use_independent_chat_permissions,
13430 self.until_date,
13431 )
13432 .await
13433 }
13434}
13435impl<'a, V: Into<ChatHandle> + Serialize> EditMessageReplyMarkupOpts<'a, V> {
13436 #[allow(clippy::let_and_return, dead_code)]
13437 fn get_form(self, form: Form) -> Form {
13438 let form = if let Some(reply_markup) = self.reply_markup {
13439 form.text("reply_markup", reply_markup)
13440 } else {
13441 form
13442 };
13443 let form = if let Some(business_connection_id) = self.business_connection_id {
13444 form.text("business_connection_id", business_connection_id.to_string())
13445 } else {
13446 form
13447 };
13448 let form = if let Some(message_id) = self.message_id {
13449 form.text("message_id", message_id.to_string())
13450 } else {
13451 form
13452 };
13453 let form = if let Some(inline_message_id) = self.inline_message_id {
13454 form.text("inline_message_id", inline_message_id.to_string())
13455 } else {
13456 form
13457 };
13458 let form = if let Some(chat_id) = self.chat_id {
13459 let v: ChatHandle = chat_id.into();
13460 form.text("chat_id", v.to_string())
13461 } else {
13462 form
13463 };
13464 form
13465 }
13466}
13467impl<'a> PostStoryOpts<'a> {
13468 #[allow(clippy::let_and_return, dead_code)]
13469 fn get_form(self, form: Form) -> Form {
13470 let form = form.text("content", self.content);
13471 let form = if let Some(caption_entities) = self.caption_entities {
13472 form.text("caption_entities", caption_entities)
13473 } else {
13474 form
13475 };
13476 let form = if let Some(areas) = self.areas {
13477 form.text("areas", areas)
13478 } else {
13479 form
13480 };
13481 let form = form.text(
13482 "business_connection_id",
13483 self.business_connection_id.to_string(),
13484 );
13485 let form = form.text("active_period", self.active_period.to_string());
13486 let form = if let Some(caption) = self.caption {
13487 form.text("caption", caption.to_string())
13488 } else {
13489 form
13490 };
13491 let form = if let Some(parse_mode) = self.parse_mode {
13492 form.text("parse_mode", parse_mode.to_string())
13493 } else {
13494 form
13495 };
13496 let form = if let Some(post_to_chat_page) = self.post_to_chat_page {
13497 form.text("post_to_chat_page", post_to_chat_page.to_string())
13498 } else {
13499 form
13500 };
13501 let form = if let Some(protect_content) = self.protect_content {
13502 form.text("protect_content", protect_content.to_string())
13503 } else {
13504 form
13505 };
13506 form
13507 }
13508}
13509impl<V: Into<ChatHandle> + Serialize> UnbanChatSenderChatOpts<V> {
13510 #[allow(clippy::let_and_return, dead_code)]
13511 fn get_form(self, form: Form) -> Form {
13512 let form = form.text("sender_chat_id", self.sender_chat_id.to_string());
13513 let v: ChatHandle = self.chat_id.into();
13514 let form = form.text("chat_id", v.to_string());
13515 form
13516 }
13517}
13518impl GetMeOpts {
13519 #[allow(clippy::let_and_return, dead_code)]
13520 fn get_form(self, form: Form) -> Form {
13521 form
13522 }
13523}
13524impl<V: Into<ChatHandle> + Serialize> ExportChatInviteLinkOpts<V> {
13525 #[allow(clippy::let_and_return, dead_code)]
13526 fn get_form(self, form: Form) -> Form {
13527 let v: ChatHandle = self.chat_id.into();
13528 let form = form.text("chat_id", v.to_string());
13529 form
13530 }
13531}
13532impl<V: Into<ChatHandle> + Serialize> GetChatMemberOpts<V> {
13533 #[allow(clippy::let_and_return, dead_code)]
13534 fn get_form(self, form: Form) -> Form {
13535 let form = form.text("user_id", self.user_id.to_string());
13536 let v: ChatHandle = self.chat_id.into();
13537 let form = form.text("chat_id", v.to_string());
13538 form
13539 }
13540}
13541impl<'a> SetCustomEmojiStickerSetThumbnailOpts<'a> {
13542 #[allow(clippy::let_and_return, dead_code)]
13543 fn get_form(self, form: Form) -> Form {
13544 let form = form.text("name", self.name.to_string());
13545 let form = if let Some(custom_emoji_id) = self.custom_emoji_id {
13546 form.text("custom_emoji_id", custom_emoji_id.to_string())
13547 } else {
13548 form
13549 };
13550 form
13551 }
13552}
13553impl<'a> SetUserEmojiStatusOpts<'a> {
13554 #[allow(clippy::let_and_return, dead_code)]
13555 fn get_form(self, form: Form) -> Form {
13556 let form = form.text("user_id", self.user_id.to_string());
13557 let form = if let Some(emoji_status_custom_emoji_id) = self.emoji_status_custom_emoji_id {
13558 form.text(
13559 "emoji_status_custom_emoji_id",
13560 emoji_status_custom_emoji_id.to_string(),
13561 )
13562 } else {
13563 form
13564 };
13565 let form = if let Some(emoji_status_expiration_date) = self.emoji_status_expiration_date {
13566 form.text(
13567 "emoji_status_expiration_date",
13568 emoji_status_expiration_date.to_string(),
13569 )
13570 } else {
13571 form
13572 };
13573 form
13574 }
13575}
13576impl<'a, V: Into<ChatHandle> + Serialize> SendContactOpts<'a, V> {
13577 #[allow(clippy::let_and_return, dead_code)]
13578 fn get_form(self, form: Form) -> Form {
13579 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
13580 form.text("suggested_post_parameters", suggested_post_parameters)
13581 } else {
13582 form
13583 };
13584 let form = if let Some(reply_parameters) = self.reply_parameters {
13585 form.text("reply_parameters", reply_parameters)
13586 } else {
13587 form
13588 };
13589 let form = if let Some(reply_markup) = self.reply_markup {
13590 form.text("reply_markup", reply_markup)
13591 } else {
13592 form
13593 };
13594 let form = if let Some(business_connection_id) = self.business_connection_id {
13595 form.text("business_connection_id", business_connection_id.to_string())
13596 } else {
13597 form
13598 };
13599 let form = if let Some(message_thread_id) = self.message_thread_id {
13600 form.text("message_thread_id", message_thread_id.to_string())
13601 } else {
13602 form
13603 };
13604 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
13605 form.text(
13606 "direct_messages_topic_id",
13607 direct_messages_topic_id.to_string(),
13608 )
13609 } else {
13610 form
13611 };
13612 let form = form.text("phone_number", self.phone_number.to_string());
13613 let form = form.text("first_name", self.first_name.to_string());
13614 let form = if let Some(last_name) = self.last_name {
13615 form.text("last_name", last_name.to_string())
13616 } else {
13617 form
13618 };
13619 let form = if let Some(vcard) = self.vcard {
13620 form.text("vcard", vcard.to_string())
13621 } else {
13622 form
13623 };
13624 let form = if let Some(disable_notification) = self.disable_notification {
13625 form.text("disable_notification", disable_notification.to_string())
13626 } else {
13627 form
13628 };
13629 let form = if let Some(protect_content) = self.protect_content {
13630 form.text("protect_content", protect_content.to_string())
13631 } else {
13632 form
13633 };
13634 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
13635 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
13636 } else {
13637 form
13638 };
13639 let form = if let Some(message_effect_id) = self.message_effect_id {
13640 form.text("message_effect_id", message_effect_id.to_string())
13641 } else {
13642 form
13643 };
13644 let v: ChatHandle = self.chat_id.into();
13645 let form = form.text("chat_id", v.to_string());
13646 form
13647 }
13648}
13649impl<'a, V: Into<ChatHandle> + Serialize> SendMessageOpts<'a, V> {
13650 #[allow(clippy::let_and_return, dead_code)]
13651 fn get_form(self, form: Form) -> Form {
13652 let form = if let Some(entities) = self.entities {
13653 form.text("entities", entities)
13654 } else {
13655 form
13656 };
13657 let form = if let Some(link_preview_options) = self.link_preview_options {
13658 form.text("link_preview_options", link_preview_options)
13659 } else {
13660 form
13661 };
13662 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
13663 form.text("suggested_post_parameters", suggested_post_parameters)
13664 } else {
13665 form
13666 };
13667 let form = if let Some(reply_parameters) = self.reply_parameters {
13668 form.text("reply_parameters", reply_parameters)
13669 } else {
13670 form
13671 };
13672 let form = if let Some(reply_markup) = self.reply_markup {
13673 form.text("reply_markup", reply_markup)
13674 } else {
13675 form
13676 };
13677 let form = if let Some(business_connection_id) = self.business_connection_id {
13678 form.text("business_connection_id", business_connection_id.to_string())
13679 } else {
13680 form
13681 };
13682 let form = if let Some(message_thread_id) = self.message_thread_id {
13683 form.text("message_thread_id", message_thread_id.to_string())
13684 } else {
13685 form
13686 };
13687 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
13688 form.text(
13689 "direct_messages_topic_id",
13690 direct_messages_topic_id.to_string(),
13691 )
13692 } else {
13693 form
13694 };
13695 let form = form.text("text", self.text.to_string());
13696 let form = if let Some(parse_mode) = self.parse_mode {
13697 form.text("parse_mode", parse_mode.to_string())
13698 } else {
13699 form
13700 };
13701 let form = if let Some(disable_notification) = self.disable_notification {
13702 form.text("disable_notification", disable_notification.to_string())
13703 } else {
13704 form
13705 };
13706 let form = if let Some(protect_content) = self.protect_content {
13707 form.text("protect_content", protect_content.to_string())
13708 } else {
13709 form
13710 };
13711 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
13712 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
13713 } else {
13714 form
13715 };
13716 let form = if let Some(message_effect_id) = self.message_effect_id {
13717 form.text("message_effect_id", message_effect_id.to_string())
13718 } else {
13719 form
13720 };
13721 let v: ChatHandle = self.chat_id.into();
13722 let form = form.text("chat_id", v.to_string());
13723 form
13724 }
13725}
13726impl<V: Into<ChatHandle> + Serialize> BanChatMemberOpts<V> {
13727 #[allow(clippy::let_and_return, dead_code)]
13728 fn get_form(self, form: Form) -> Form {
13729 let form = form.text("user_id", self.user_id.to_string());
13730 let form = if let Some(until_date) = self.until_date {
13731 form.text("until_date", until_date.to_string())
13732 } else {
13733 form
13734 };
13735 let form = if let Some(revoke_messages) = self.revoke_messages {
13736 form.text("revoke_messages", revoke_messages.to_string())
13737 } else {
13738 form
13739 };
13740 let v: ChatHandle = self.chat_id.into();
13741 let form = form.text("chat_id", v.to_string());
13742 form
13743 }
13744}
13745impl<'a, V: Into<ChatHandle> + Serialize> EditChatInviteLinkOpts<'a, V> {
13746 #[allow(clippy::let_and_return, dead_code)]
13747 fn get_form(self, form: Form) -> Form {
13748 let form = form.text("invite_link", self.invite_link.to_string());
13749 let form = if let Some(name) = self.name {
13750 form.text("name", name.to_string())
13751 } else {
13752 form
13753 };
13754 let form = if let Some(expire_date) = self.expire_date {
13755 form.text("expire_date", expire_date.to_string())
13756 } else {
13757 form
13758 };
13759 let form = if let Some(member_limit) = self.member_limit {
13760 form.text("member_limit", member_limit.to_string())
13761 } else {
13762 form
13763 };
13764 let form = if let Some(creates_join_request) = self.creates_join_request {
13765 form.text("creates_join_request", creates_join_request.to_string())
13766 } else {
13767 form
13768 };
13769 let v: ChatHandle = self.chat_id.into();
13770 let form = form.text("chat_id", v.to_string());
13771 form
13772 }
13773}
13774impl<'a, V: Into<ChatHandle> + Serialize> UnpinChatMessageOpts<'a, V> {
13775 #[allow(clippy::let_and_return, dead_code)]
13776 fn get_form(self, form: Form) -> Form {
13777 let form = if let Some(business_connection_id) = self.business_connection_id {
13778 form.text("business_connection_id", business_connection_id.to_string())
13779 } else {
13780 form
13781 };
13782 let form = if let Some(message_id) = self.message_id {
13783 form.text("message_id", message_id.to_string())
13784 } else {
13785 form
13786 };
13787 let v: ChatHandle = self.chat_id.into();
13788 let form = form.text("chat_id", v.to_string());
13789 form
13790 }
13791}
13792impl<'a> AnswerInlineQueryOpts<'a> {
13793 #[allow(clippy::let_and_return, dead_code)]
13794 fn get_form(self, form: Form) -> Form {
13795 let form = form.text("results", self.results);
13796 let form = if let Some(button) = self.button {
13797 form.text("button", button)
13798 } else {
13799 form
13800 };
13801 let form = form.text("inline_query_id", self.inline_query_id.to_string());
13802 let form = if let Some(cache_time) = self.cache_time {
13803 form.text("cache_time", cache_time.to_string())
13804 } else {
13805 form
13806 };
13807 let form = if let Some(is_personal) = self.is_personal {
13808 form.text("is_personal", is_personal.to_string())
13809 } else {
13810 form
13811 };
13812 let form = if let Some(next_offset) = self.next_offset {
13813 form.text("next_offset", next_offset.to_string())
13814 } else {
13815 form
13816 };
13817 form
13818 }
13819}
13820impl<'a> GetFileOpts<'a> {
13821 #[allow(clippy::let_and_return, dead_code)]
13822 fn get_form(self, form: Form) -> Form {
13823 let form = form.text("file_id", self.file_id.to_string());
13824 form
13825 }
13826}
13827impl GetStarTransactionsOpts {
13828 #[allow(clippy::let_and_return, dead_code)]
13829 fn get_form(self, form: Form) -> Form {
13830 let form = if let Some(offset) = self.offset {
13831 form.text("offset", offset.to_string())
13832 } else {
13833 form
13834 };
13835 let form = if let Some(limit) = self.limit {
13836 form.text("limit", limit.to_string())
13837 } else {
13838 form
13839 };
13840 form
13841 }
13842}
13843impl<V: Into<ChatHandle> + Serialize> ForwardMessagesOpts<V> {
13844 #[allow(clippy::let_and_return, dead_code)]
13845 fn get_form(self, form: Form) -> Form {
13846 let form = form.text("message_ids", self.message_ids);
13847 let form = if let Some(message_thread_id) = self.message_thread_id {
13848 form.text("message_thread_id", message_thread_id.to_string())
13849 } else {
13850 form
13851 };
13852 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
13853 form.text(
13854 "direct_messages_topic_id",
13855 direct_messages_topic_id.to_string(),
13856 )
13857 } else {
13858 form
13859 };
13860 let form = if let Some(disable_notification) = self.disable_notification {
13861 form.text("disable_notification", disable_notification.to_string())
13862 } else {
13863 form
13864 };
13865 let form = if let Some(protect_content) = self.protect_content {
13866 form.text("protect_content", protect_content.to_string())
13867 } else {
13868 form
13869 };
13870 let v: ChatHandle = self.chat_id.into();
13871 let form = form.text("chat_id", v.to_string());
13872 let v: ChatHandle = self.from_chat_id.into();
13873 let form = form.text("from_chat_id", v.to_string());
13874 form
13875 }
13876}
13877impl<'a> GetStickerSetOpts<'a> {
13878 #[allow(clippy::let_and_return, dead_code)]
13879 fn get_form(self, form: Form) -> Form {
13880 let form = form.text("name", self.name.to_string());
13881 form
13882 }
13883}
13884impl GetForumTopicIconStickersOpts {
13885 #[allow(clippy::let_and_return, dead_code)]
13886 fn get_form(self, form: Form) -> Form {
13887 form
13888 }
13889}
13890impl<'a> TransferGiftOpts<'a> {
13891 #[allow(clippy::let_and_return, dead_code)]
13892 fn get_form(self, form: Form) -> Form {
13893 let form = form.text(
13894 "business_connection_id",
13895 self.business_connection_id.to_string(),
13896 );
13897 let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
13898 let form = form.text("new_owner_chat_id", self.new_owner_chat_id.to_string());
13899 let form = if let Some(star_count) = self.star_count {
13900 form.text("star_count", star_count.to_string())
13901 } else {
13902 form
13903 };
13904 form
13905 }
13906}
13907impl<V: Into<ChatHandle> + Serialize> DeleteMessagesOpts<V> {
13908 #[allow(clippy::let_and_return, dead_code)]
13909 fn get_form(self, form: Form) -> Form {
13910 let form = form.text("message_ids", self.message_ids);
13911 let v: ChatHandle = self.chat_id.into();
13912 let form = form.text("chat_id", v.to_string());
13913 form
13914 }
13915}
13916impl<V: Into<ChatHandle> + Serialize> ReopenGeneralForumTopicOpts<V> {
13917 #[allow(clippy::let_and_return, dead_code)]
13918 fn get_form(self, form: Form) -> Form {
13919 let v: ChatHandle = self.chat_id.into();
13920 let form = form.text("chat_id", v.to_string());
13921 form
13922 }
13923}
13924impl<'a> SendChecklistOpts<'a> {
13925 #[allow(clippy::let_and_return, dead_code)]
13926 fn get_form(self, form: Form) -> Form {
13927 let form = form.text("checklist", self.checklist);
13928 let form = if let Some(reply_parameters) = self.reply_parameters {
13929 form.text("reply_parameters", reply_parameters)
13930 } else {
13931 form
13932 };
13933 let form = if let Some(reply_markup) = self.reply_markup {
13934 form.text("reply_markup", reply_markup)
13935 } else {
13936 form
13937 };
13938 let form = form.text(
13939 "business_connection_id",
13940 self.business_connection_id.to_string(),
13941 );
13942 let form = form.text("chat_id", self.chat_id.to_string());
13943 let form = if let Some(disable_notification) = self.disable_notification {
13944 form.text("disable_notification", disable_notification.to_string())
13945 } else {
13946 form
13947 };
13948 let form = if let Some(protect_content) = self.protect_content {
13949 form.text("protect_content", protect_content.to_string())
13950 } else {
13951 form
13952 };
13953 let form = if let Some(message_effect_id) = self.message_effect_id {
13954 form.text("message_effect_id", message_effect_id.to_string())
13955 } else {
13956 form
13957 };
13958 form
13959 }
13960}
13961impl<V: Into<ChatHandle> + Serialize> DeleteChatPhotoOpts<V> {
13962 #[allow(clippy::let_and_return, dead_code)]
13963 fn get_form(self, form: Form) -> Form {
13964 let v: ChatHandle = self.chat_id.into();
13965 let form = form.text("chat_id", v.to_string());
13966 form
13967 }
13968}
13969impl<'a> VerifyUserOpts<'a> {
13970 #[allow(clippy::let_and_return, dead_code)]
13971 fn get_form(self, form: Form) -> Form {
13972 let form = form.text("user_id", self.user_id.to_string());
13973 let form = if let Some(custom_description) = self.custom_description {
13974 form.text("custom_description", custom_description.to_string())
13975 } else {
13976 form
13977 };
13978 form
13979 }
13980}
13981impl<V: Into<ChatHandle> + Serialize> ApproveChatJoinRequestOpts<V> {
13982 #[allow(clippy::let_and_return, dead_code)]
13983 fn get_form(self, form: Form) -> Form {
13984 let form = form.text("user_id", self.user_id.to_string());
13985 let v: ChatHandle = self.chat_id.into();
13986 let form = form.text("chat_id", v.to_string());
13987 form
13988 }
13989}
13990impl<'a, V: Into<ChatHandle> + Serialize> SendInvoiceOpts<'a, V> {
13991 #[allow(clippy::let_and_return, dead_code)]
13992 fn get_form(self, form: Form) -> Form {
13993 let form = form.text("prices", self.prices);
13994 let form = if let Some(suggested_tip_amounts) = self.suggested_tip_amounts {
13995 form.text("suggested_tip_amounts", suggested_tip_amounts)
13996 } else {
13997 form
13998 };
13999 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
14000 form.text("suggested_post_parameters", suggested_post_parameters)
14001 } else {
14002 form
14003 };
14004 let form = if let Some(reply_parameters) = self.reply_parameters {
14005 form.text("reply_parameters", reply_parameters)
14006 } else {
14007 form
14008 };
14009 let form = if let Some(reply_markup) = self.reply_markup {
14010 form.text("reply_markup", reply_markup)
14011 } else {
14012 form
14013 };
14014 let form = if let Some(message_thread_id) = self.message_thread_id {
14015 form.text("message_thread_id", message_thread_id.to_string())
14016 } else {
14017 form
14018 };
14019 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14020 form.text(
14021 "direct_messages_topic_id",
14022 direct_messages_topic_id.to_string(),
14023 )
14024 } else {
14025 form
14026 };
14027 let form = form.text("title", self.title.to_string());
14028 let form = form.text("description", self.description.to_string());
14029 let form = form.text("payload", self.payload.to_string());
14030 let form = if let Some(provider_token) = self.provider_token {
14031 form.text("provider_token", provider_token.to_string())
14032 } else {
14033 form
14034 };
14035 let form = form.text("currency", self.currency.to_string());
14036 let form = if let Some(max_tip_amount) = self.max_tip_amount {
14037 form.text("max_tip_amount", max_tip_amount.to_string())
14038 } else {
14039 form
14040 };
14041 let form = if let Some(start_parameter) = self.start_parameter {
14042 form.text("start_parameter", start_parameter.to_string())
14043 } else {
14044 form
14045 };
14046 let form = if let Some(provider_data) = self.provider_data {
14047 form.text("provider_data", provider_data.to_string())
14048 } else {
14049 form
14050 };
14051 let form = if let Some(photo_url) = self.photo_url {
14052 form.text("photo_url", photo_url.to_string())
14053 } else {
14054 form
14055 };
14056 let form = if let Some(photo_size) = self.photo_size {
14057 form.text("photo_size", photo_size.to_string())
14058 } else {
14059 form
14060 };
14061 let form = if let Some(photo_width) = self.photo_width {
14062 form.text("photo_width", photo_width.to_string())
14063 } else {
14064 form
14065 };
14066 let form = if let Some(photo_height) = self.photo_height {
14067 form.text("photo_height", photo_height.to_string())
14068 } else {
14069 form
14070 };
14071 let form = if let Some(need_name) = self.need_name {
14072 form.text("need_name", need_name.to_string())
14073 } else {
14074 form
14075 };
14076 let form = if let Some(need_phone_number) = self.need_phone_number {
14077 form.text("need_phone_number", need_phone_number.to_string())
14078 } else {
14079 form
14080 };
14081 let form = if let Some(need_email) = self.need_email {
14082 form.text("need_email", need_email.to_string())
14083 } else {
14084 form
14085 };
14086 let form = if let Some(need_shipping_address) = self.need_shipping_address {
14087 form.text("need_shipping_address", need_shipping_address.to_string())
14088 } else {
14089 form
14090 };
14091 let form = if let Some(send_phone_number_to_provider) = self.send_phone_number_to_provider {
14092 form.text(
14093 "send_phone_number_to_provider",
14094 send_phone_number_to_provider.to_string(),
14095 )
14096 } else {
14097 form
14098 };
14099 let form = if let Some(send_email_to_provider) = self.send_email_to_provider {
14100 form.text("send_email_to_provider", send_email_to_provider.to_string())
14101 } else {
14102 form
14103 };
14104 let form = if let Some(is_flexible) = self.is_flexible {
14105 form.text("is_flexible", is_flexible.to_string())
14106 } else {
14107 form
14108 };
14109 let form = if let Some(disable_notification) = self.disable_notification {
14110 form.text("disable_notification", disable_notification.to_string())
14111 } else {
14112 form
14113 };
14114 let form = if let Some(protect_content) = self.protect_content {
14115 form.text("protect_content", protect_content.to_string())
14116 } else {
14117 form
14118 };
14119 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
14120 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
14121 } else {
14122 form
14123 };
14124 let form = if let Some(message_effect_id) = self.message_effect_id {
14125 form.text("message_effect_id", message_effect_id.to_string())
14126 } else {
14127 form
14128 };
14129 let v: ChatHandle = self.chat_id.into();
14130 let form = form.text("chat_id", v.to_string());
14131 form
14132 }
14133}
14134impl<V: Into<ChatHandle> + Serialize> CloseForumTopicOpts<V> {
14135 #[allow(clippy::let_and_return, dead_code)]
14136 fn get_form(self, form: Form) -> Form {
14137 let form = form.text("message_thread_id", self.message_thread_id.to_string());
14138 let v: ChatHandle = self.chat_id.into();
14139 let form = form.text("chat_id", v.to_string());
14140 form
14141 }
14142}
14143impl<'a> RefundStarPaymentOpts<'a> {
14144 #[allow(clippy::let_and_return, dead_code)]
14145 fn get_form(self, form: Form) -> Form {
14146 let form = form.text("user_id", self.user_id.to_string());
14147 let form = form.text(
14148 "telegram_payment_charge_id",
14149 self.telegram_payment_charge_id.to_string(),
14150 );
14151 form
14152 }
14153}
14154impl GetUpdatesOpts {
14155 #[allow(clippy::let_and_return, dead_code)]
14156 fn get_form(self, form: Form) -> Form {
14157 let form = if let Some(allowed_updates) = self.allowed_updates {
14158 form.text("allowed_updates", allowed_updates)
14159 } else {
14160 form
14161 };
14162 let form = if let Some(offset) = self.offset {
14163 form.text("offset", offset.to_string())
14164 } else {
14165 form
14166 };
14167 let form = if let Some(limit) = self.limit {
14168 form.text("limit", limit.to_string())
14169 } else {
14170 form
14171 };
14172 let form = if let Some(timeout) = self.timeout {
14173 form.text("timeout", timeout.to_string())
14174 } else {
14175 form
14176 };
14177 form
14178 }
14179}
14180impl<'a, V: Into<ChatHandle> + Serialize> SendPaidMediaOpts<'a, V> {
14181 #[allow(clippy::let_and_return, dead_code)]
14182 fn get_form(self, form: Form) -> Form {
14183 let form = form.text("media", self.media);
14184 let form = if let Some(caption_entities) = self.caption_entities {
14185 form.text("caption_entities", caption_entities)
14186 } else {
14187 form
14188 };
14189 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
14190 form.text("suggested_post_parameters", suggested_post_parameters)
14191 } else {
14192 form
14193 };
14194 let form = if let Some(reply_parameters) = self.reply_parameters {
14195 form.text("reply_parameters", reply_parameters)
14196 } else {
14197 form
14198 };
14199 let form = if let Some(reply_markup) = self.reply_markup {
14200 form.text("reply_markup", reply_markup)
14201 } else {
14202 form
14203 };
14204 let form = if let Some(business_connection_id) = self.business_connection_id {
14205 form.text("business_connection_id", business_connection_id.to_string())
14206 } else {
14207 form
14208 };
14209 let form = if let Some(message_thread_id) = self.message_thread_id {
14210 form.text("message_thread_id", message_thread_id.to_string())
14211 } else {
14212 form
14213 };
14214 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14215 form.text(
14216 "direct_messages_topic_id",
14217 direct_messages_topic_id.to_string(),
14218 )
14219 } else {
14220 form
14221 };
14222 let form = form.text("star_count", self.star_count.to_string());
14223 let form = if let Some(payload) = self.payload {
14224 form.text("payload", payload.to_string())
14225 } else {
14226 form
14227 };
14228 let form = if let Some(caption) = self.caption {
14229 form.text("caption", caption.to_string())
14230 } else {
14231 form
14232 };
14233 let form = if let Some(parse_mode) = self.parse_mode {
14234 form.text("parse_mode", parse_mode.to_string())
14235 } else {
14236 form
14237 };
14238 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
14239 form.text(
14240 "show_caption_above_media",
14241 show_caption_above_media.to_string(),
14242 )
14243 } else {
14244 form
14245 };
14246 let form = if let Some(disable_notification) = self.disable_notification {
14247 form.text("disable_notification", disable_notification.to_string())
14248 } else {
14249 form
14250 };
14251 let form = if let Some(protect_content) = self.protect_content {
14252 form.text("protect_content", protect_content.to_string())
14253 } else {
14254 form
14255 };
14256 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
14257 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
14258 } else {
14259 form
14260 };
14261 let v: ChatHandle = self.chat_id.into();
14262 let form = form.text("chat_id", v.to_string());
14263 form
14264 }
14265}
14266impl<V: Into<ChatHandle> + Serialize> ReopenForumTopicOpts<V> {
14267 #[allow(clippy::let_and_return, dead_code)]
14268 fn get_form(self, form: Form) -> Form {
14269 let form = form.text("message_thread_id", self.message_thread_id.to_string());
14270 let v: ChatHandle = self.chat_id.into();
14271 let form = form.text("chat_id", v.to_string());
14272 form
14273 }
14274}
14275impl<'a, V: Into<ChatHandle> + Serialize> EditMessageLiveLocationOpts<'a, V> {
14276 #[allow(clippy::let_and_return, dead_code)]
14277 fn get_form(self, form: Form) -> Form {
14278 let form = if let Some(reply_markup) = self.reply_markup {
14279 form.text("reply_markup", reply_markup)
14280 } else {
14281 form
14282 };
14283 let form = if let Some(business_connection_id) = self.business_connection_id {
14284 form.text("business_connection_id", business_connection_id.to_string())
14285 } else {
14286 form
14287 };
14288 let form = if let Some(message_id) = self.message_id {
14289 form.text("message_id", message_id.to_string())
14290 } else {
14291 form
14292 };
14293 let form = if let Some(inline_message_id) = self.inline_message_id {
14294 form.text("inline_message_id", inline_message_id.to_string())
14295 } else {
14296 form
14297 };
14298 let form = form.text("latitude", self.latitude.to_string());
14299 let form = form.text("longitude", self.longitude.to_string());
14300 let form = if let Some(live_period) = self.live_period {
14301 form.text("live_period", live_period.to_string())
14302 } else {
14303 form
14304 };
14305 let form = if let Some(horizontal_accuracy) = self.horizontal_accuracy {
14306 form.text("horizontal_accuracy", horizontal_accuracy.to_string())
14307 } else {
14308 form
14309 };
14310 let form = if let Some(heading) = self.heading {
14311 form.text("heading", heading.to_string())
14312 } else {
14313 form
14314 };
14315 let form = if let Some(proximity_alert_radius) = self.proximity_alert_radius {
14316 form.text("proximity_alert_radius", proximity_alert_radius.to_string())
14317 } else {
14318 form
14319 };
14320 let form = if let Some(chat_id) = self.chat_id {
14321 let v: ChatHandle = chat_id.into();
14322 form.text("chat_id", v.to_string())
14323 } else {
14324 form
14325 };
14326 form
14327 }
14328}
14329impl<'a> EditMessageChecklistOpts<'a> {
14330 #[allow(clippy::let_and_return, dead_code)]
14331 fn get_form(self, form: Form) -> Form {
14332 let form = form.text("checklist", self.checklist);
14333 let form = if let Some(reply_markup) = self.reply_markup {
14334 form.text("reply_markup", reply_markup)
14335 } else {
14336 form
14337 };
14338 let form = form.text(
14339 "business_connection_id",
14340 self.business_connection_id.to_string(),
14341 );
14342 let form = form.text("chat_id", self.chat_id.to_string());
14343 let form = form.text("message_id", self.message_id.to_string());
14344 form
14345 }
14346}
14347impl<'a> SetBusinessAccountUsernameOpts<'a> {
14348 #[allow(clippy::let_and_return, dead_code)]
14349 fn get_form(self, form: Form) -> Form {
14350 let form = form.text(
14351 "business_connection_id",
14352 self.business_connection_id.to_string(),
14353 );
14354 let form = if let Some(username) = self.username {
14355 form.text("username", username.to_string())
14356 } else {
14357 form
14358 };
14359 form
14360 }
14361}
14362impl SetPassportDataErrorsOpts {
14363 #[allow(clippy::let_and_return, dead_code)]
14364 fn get_form(self, form: Form) -> Form {
14365 let form = form.text("errors", self.errors);
14366 let form = form.text("user_id", self.user_id.to_string());
14367 form
14368 }
14369}
14370impl<'a> RemoveBusinessAccountProfilePhotoOpts<'a> {
14371 #[allow(clippy::let_and_return, dead_code)]
14372 fn get_form(self, form: Form) -> Form {
14373 let form = form.text(
14374 "business_connection_id",
14375 self.business_connection_id.to_string(),
14376 );
14377 let form = if let Some(is_public) = self.is_public {
14378 form.text("is_public", is_public.to_string())
14379 } else {
14380 form
14381 };
14382 form
14383 }
14384}
14385impl<V: Into<ChatHandle> + Serialize> SetMessageReactionOpts<V> {
14386 #[allow(clippy::let_and_return, dead_code)]
14387 fn get_form(self, form: Form) -> Form {
14388 let form = if let Some(reaction) = self.reaction {
14389 form.text("reaction", reaction)
14390 } else {
14391 form
14392 };
14393 let form = form.text("message_id", self.message_id.to_string());
14394 let form = if let Some(is_big) = self.is_big {
14395 form.text("is_big", is_big.to_string())
14396 } else {
14397 form
14398 };
14399 let v: ChatHandle = self.chat_id.into();
14400 let form = form.text("chat_id", v.to_string());
14401 form
14402 }
14403}
14404impl<'a, V: Into<ChatHandle> + Serialize> SendPhotoOpts<'a, V> {
14405 #[allow(clippy::let_and_return, dead_code)]
14406 fn get_form(self, form: Form) -> Form {
14407 let form = if let Some(caption_entities) = self.caption_entities {
14408 form.text("caption_entities", caption_entities)
14409 } else {
14410 form
14411 };
14412 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
14413 form.text("suggested_post_parameters", suggested_post_parameters)
14414 } else {
14415 form
14416 };
14417 let form = if let Some(reply_parameters) = self.reply_parameters {
14418 form.text("reply_parameters", reply_parameters)
14419 } else {
14420 form
14421 };
14422 let form = if let Some(reply_markup) = self.reply_markup {
14423 form.text("reply_markup", reply_markup)
14424 } else {
14425 form
14426 };
14427 let form = if let Some(business_connection_id) = self.business_connection_id {
14428 form.text("business_connection_id", business_connection_id.to_string())
14429 } else {
14430 form
14431 };
14432 let form = if let Some(message_thread_id) = self.message_thread_id {
14433 form.text("message_thread_id", message_thread_id.to_string())
14434 } else {
14435 form
14436 };
14437 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14438 form.text(
14439 "direct_messages_topic_id",
14440 direct_messages_topic_id.to_string(),
14441 )
14442 } else {
14443 form
14444 };
14445 let form = form.text("photo", self.photo.to_string());
14446 let form = if let Some(caption) = self.caption {
14447 form.text("caption", caption.to_string())
14448 } else {
14449 form
14450 };
14451 let form = if let Some(parse_mode) = self.parse_mode {
14452 form.text("parse_mode", parse_mode.to_string())
14453 } else {
14454 form
14455 };
14456 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
14457 form.text(
14458 "show_caption_above_media",
14459 show_caption_above_media.to_string(),
14460 )
14461 } else {
14462 form
14463 };
14464 let form = if let Some(has_spoiler) = self.has_spoiler {
14465 form.text("has_spoiler", has_spoiler.to_string())
14466 } else {
14467 form
14468 };
14469 let form = if let Some(disable_notification) = self.disable_notification {
14470 form.text("disable_notification", disable_notification.to_string())
14471 } else {
14472 form
14473 };
14474 let form = if let Some(protect_content) = self.protect_content {
14475 form.text("protect_content", protect_content.to_string())
14476 } else {
14477 form
14478 };
14479 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
14480 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
14481 } else {
14482 form
14483 };
14484 let form = if let Some(message_effect_id) = self.message_effect_id {
14485 form.text("message_effect_id", message_effect_id.to_string())
14486 } else {
14487 form
14488 };
14489 let v: ChatHandle = self.chat_id.into();
14490 let form = form.text("chat_id", v.to_string());
14491 form
14492 }
14493}
14494impl<'a> UpgradeGiftOpts<'a> {
14495 #[allow(clippy::let_and_return, dead_code)]
14496 fn get_form(self, form: Form) -> Form {
14497 let form = form.text(
14498 "business_connection_id",
14499 self.business_connection_id.to_string(),
14500 );
14501 let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
14502 let form = if let Some(keep_original_details) = self.keep_original_details {
14503 form.text("keep_original_details", keep_original_details.to_string())
14504 } else {
14505 form
14506 };
14507 let form = if let Some(star_count) = self.star_count {
14508 form.text("star_count", star_count.to_string())
14509 } else {
14510 form
14511 };
14512 form
14513 }
14514}
14515impl<V: Into<ChatHandle> + Serialize> DeleteMessageOpts<V> {
14516 #[allow(clippy::let_and_return, dead_code)]
14517 fn get_form(self, form: Form) -> Form {
14518 let form = form.text("message_id", self.message_id.to_string());
14519 let v: ChatHandle = self.chat_id.into();
14520 let form = form.text("chat_id", v.to_string());
14521 form
14522 }
14523}
14524impl<V: Into<ChatHandle> + Serialize> GetUserChatBoostsOpts<V> {
14525 #[allow(clippy::let_and_return, dead_code)]
14526 fn get_form(self, form: Form) -> Form {
14527 let form = form.text("user_id", self.user_id.to_string());
14528 let v: ChatHandle = self.chat_id.into();
14529 let form = form.text("chat_id", v.to_string());
14530 form
14531 }
14532}
14533impl<'a> GiftPremiumSubscriptionOpts<'a> {
14534 #[allow(clippy::let_and_return, dead_code)]
14535 fn get_form(self, form: Form) -> Form {
14536 let form = if let Some(text_entities) = self.text_entities {
14537 form.text("text_entities", text_entities)
14538 } else {
14539 form
14540 };
14541 let form = form.text("user_id", self.user_id.to_string());
14542 let form = form.text("month_count", self.month_count.to_string());
14543 let form = form.text("star_count", self.star_count.to_string());
14544 let form = if let Some(text) = self.text {
14545 form.text("text", text.to_string())
14546 } else {
14547 form
14548 };
14549 let form = if let Some(text_parse_mode) = self.text_parse_mode {
14550 form.text("text_parse_mode", text_parse_mode.to_string())
14551 } else {
14552 form
14553 };
14554 form
14555 }
14556}
14557impl LogOutOpts {
14558 #[allow(clippy::let_and_return, dead_code)]
14559 fn get_form(self, form: Form) -> Form {
14560 form
14561 }
14562}
14563impl<'a> ConvertGiftToStarsOpts<'a> {
14564 #[allow(clippy::let_and_return, dead_code)]
14565 fn get_form(self, form: Form) -> Form {
14566 let form = form.text(
14567 "business_connection_id",
14568 self.business_connection_id.to_string(),
14569 );
14570 let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
14571 form
14572 }
14573}
14574impl<'a, V: Into<ChatHandle> + Serialize> CopyMessageOpts<'a, V> {
14575 #[allow(clippy::let_and_return, dead_code)]
14576 fn get_form(self, form: Form) -> Form {
14577 let form = if let Some(caption_entities) = self.caption_entities {
14578 form.text("caption_entities", caption_entities)
14579 } else {
14580 form
14581 };
14582 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
14583 form.text("suggested_post_parameters", suggested_post_parameters)
14584 } else {
14585 form
14586 };
14587 let form = if let Some(reply_parameters) = self.reply_parameters {
14588 form.text("reply_parameters", reply_parameters)
14589 } else {
14590 form
14591 };
14592 let form = if let Some(reply_markup) = self.reply_markup {
14593 form.text("reply_markup", reply_markup)
14594 } else {
14595 form
14596 };
14597 let form = if let Some(message_thread_id) = self.message_thread_id {
14598 form.text("message_thread_id", message_thread_id.to_string())
14599 } else {
14600 form
14601 };
14602 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14603 form.text(
14604 "direct_messages_topic_id",
14605 direct_messages_topic_id.to_string(),
14606 )
14607 } else {
14608 form
14609 };
14610 let form = form.text("message_id", self.message_id.to_string());
14611 let form = if let Some(video_start_timestamp) = self.video_start_timestamp {
14612 form.text("video_start_timestamp", video_start_timestamp.to_string())
14613 } else {
14614 form
14615 };
14616 let form = if let Some(caption) = self.caption {
14617 form.text("caption", caption.to_string())
14618 } else {
14619 form
14620 };
14621 let form = if let Some(parse_mode) = self.parse_mode {
14622 form.text("parse_mode", parse_mode.to_string())
14623 } else {
14624 form
14625 };
14626 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
14627 form.text(
14628 "show_caption_above_media",
14629 show_caption_above_media.to_string(),
14630 )
14631 } else {
14632 form
14633 };
14634 let form = if let Some(disable_notification) = self.disable_notification {
14635 form.text("disable_notification", disable_notification.to_string())
14636 } else {
14637 form
14638 };
14639 let form = if let Some(protect_content) = self.protect_content {
14640 form.text("protect_content", protect_content.to_string())
14641 } else {
14642 form
14643 };
14644 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
14645 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
14646 } else {
14647 form
14648 };
14649 let v: ChatHandle = self.chat_id.into();
14650 let form = form.text("chat_id", v.to_string());
14651 let v: ChatHandle = self.from_chat_id.into();
14652 let form = form.text("from_chat_id", v.to_string());
14653 form
14654 }
14655}
14656impl<'a, V: Into<ChatHandle> + Serialize> EditForumTopicOpts<'a, V> {
14657 #[allow(clippy::let_and_return, dead_code)]
14658 fn get_form(self, form: Form) -> Form {
14659 let form = form.text("message_thread_id", self.message_thread_id.to_string());
14660 let form = if let Some(name) = self.name {
14661 form.text("name", name.to_string())
14662 } else {
14663 form
14664 };
14665 let form = if let Some(icon_custom_emoji_id) = self.icon_custom_emoji_id {
14666 form.text("icon_custom_emoji_id", icon_custom_emoji_id.to_string())
14667 } else {
14668 form
14669 };
14670 let v: ChatHandle = self.chat_id.into();
14671 let form = form.text("chat_id", v.to_string());
14672 form
14673 }
14674}
14675impl<'a> SetBusinessAccountBioOpts<'a> {
14676 #[allow(clippy::let_and_return, dead_code)]
14677 fn get_form(self, form: Form) -> Form {
14678 let form = form.text(
14679 "business_connection_id",
14680 self.business_connection_id.to_string(),
14681 );
14682 let form = if let Some(bio) = self.bio {
14683 form.text("bio", bio.to_string())
14684 } else {
14685 form
14686 };
14687 form
14688 }
14689}
14690impl<V: Into<ChatHandle> + Serialize> GetChatOpts<V> {
14691 #[allow(clippy::let_and_return, dead_code)]
14692 fn get_form(self, form: Form) -> Form {
14693 let v: ChatHandle = self.chat_id.into();
14694 let form = form.text("chat_id", v.to_string());
14695 form
14696 }
14697}
14698impl<'a, V: Into<ChatHandle> + Serialize> EditMessageMediaOpts<'a, V> {
14699 #[allow(clippy::let_and_return, dead_code)]
14700 fn get_form(self, form: Form) -> Form {
14701 let form = form.text("media", self.media);
14702 let form = if let Some(reply_markup) = self.reply_markup {
14703 form.text("reply_markup", reply_markup)
14704 } else {
14705 form
14706 };
14707 let form = if let Some(business_connection_id) = self.business_connection_id {
14708 form.text("business_connection_id", business_connection_id.to_string())
14709 } else {
14710 form
14711 };
14712 let form = if let Some(message_id) = self.message_id {
14713 form.text("message_id", message_id.to_string())
14714 } else {
14715 form
14716 };
14717 let form = if let Some(inline_message_id) = self.inline_message_id {
14718 form.text("inline_message_id", inline_message_id.to_string())
14719 } else {
14720 form
14721 };
14722 let form = if let Some(chat_id) = self.chat_id {
14723 let v: ChatHandle = chat_id.into();
14724 form.text("chat_id", v.to_string())
14725 } else {
14726 form
14727 };
14728 form
14729 }
14730}
14731impl<'a> SetGameScoreOpts<'a> {
14732 #[allow(clippy::let_and_return, dead_code)]
14733 fn get_form(self, form: Form) -> Form {
14734 let form = form.text("user_id", self.user_id.to_string());
14735 let form = form.text("score", self.score.to_string());
14736 let form = if let Some(force) = self.force {
14737 form.text("force", force.to_string())
14738 } else {
14739 form
14740 };
14741 let form = if let Some(disable_edit_message) = self.disable_edit_message {
14742 form.text("disable_edit_message", disable_edit_message.to_string())
14743 } else {
14744 form
14745 };
14746 let form = if let Some(chat_id) = self.chat_id {
14747 form.text("chat_id", chat_id.to_string())
14748 } else {
14749 form
14750 };
14751 let form = if let Some(message_id) = self.message_id {
14752 form.text("message_id", message_id.to_string())
14753 } else {
14754 form
14755 };
14756 let form = if let Some(inline_message_id) = self.inline_message_id {
14757 form.text("inline_message_id", inline_message_id.to_string())
14758 } else {
14759 form
14760 };
14761 form
14762 }
14763}
14764impl GetCustomEmojiStickersOpts {
14765 #[allow(clippy::let_and_return, dead_code)]
14766 fn get_form(self, form: Form) -> Form {
14767 let form = form.text("custom_emoji_ids", self.custom_emoji_ids);
14768 form
14769 }
14770}
14771impl<'a, V: Into<ChatHandle> + Serialize> SetChatAdministratorCustomTitleOpts<'a, V> {
14772 #[allow(clippy::let_and_return, dead_code)]
14773 fn get_form(self, form: Form) -> Form {
14774 let form = form.text("user_id", self.user_id.to_string());
14775 let form = form.text("custom_title", self.custom_title.to_string());
14776 let v: ChatHandle = self.chat_id.into();
14777 let form = form.text("chat_id", v.to_string());
14778 form
14779 }
14780}
14781impl<'a, V: Into<ChatHandle> + Serialize> SendGiftOpts<'a, V> {
14782 #[allow(clippy::let_and_return, dead_code)]
14783 fn get_form(self, form: Form) -> Form {
14784 let form = if let Some(text_entities) = self.text_entities {
14785 form.text("text_entities", text_entities)
14786 } else {
14787 form
14788 };
14789 let form = if let Some(user_id) = self.user_id {
14790 form.text("user_id", user_id.to_string())
14791 } else {
14792 form
14793 };
14794 let form = form.text("gift_id", self.gift_id.to_string());
14795 let form = if let Some(pay_for_upgrade) = self.pay_for_upgrade {
14796 form.text("pay_for_upgrade", pay_for_upgrade.to_string())
14797 } else {
14798 form
14799 };
14800 let form = if let Some(text) = self.text {
14801 form.text("text", text.to_string())
14802 } else {
14803 form
14804 };
14805 let form = if let Some(text_parse_mode) = self.text_parse_mode {
14806 form.text("text_parse_mode", text_parse_mode.to_string())
14807 } else {
14808 form
14809 };
14810 let form = if let Some(chat_id) = self.chat_id {
14811 let v: ChatHandle = chat_id.into();
14812 form.text("chat_id", v.to_string())
14813 } else {
14814 form
14815 };
14816 form
14817 }
14818}
14819impl<'a, V: Into<ChatHandle> + Serialize> SendDiceOpts<'a, V> {
14820 #[allow(clippy::let_and_return, dead_code)]
14821 fn get_form(self, form: Form) -> Form {
14822 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
14823 form.text("suggested_post_parameters", suggested_post_parameters)
14824 } else {
14825 form
14826 };
14827 let form = if let Some(reply_parameters) = self.reply_parameters {
14828 form.text("reply_parameters", reply_parameters)
14829 } else {
14830 form
14831 };
14832 let form = if let Some(reply_markup) = self.reply_markup {
14833 form.text("reply_markup", reply_markup)
14834 } else {
14835 form
14836 };
14837 let form = if let Some(business_connection_id) = self.business_connection_id {
14838 form.text("business_connection_id", business_connection_id.to_string())
14839 } else {
14840 form
14841 };
14842 let form = if let Some(message_thread_id) = self.message_thread_id {
14843 form.text("message_thread_id", message_thread_id.to_string())
14844 } else {
14845 form
14846 };
14847 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14848 form.text(
14849 "direct_messages_topic_id",
14850 direct_messages_topic_id.to_string(),
14851 )
14852 } else {
14853 form
14854 };
14855 let form = if let Some(emoji) = self.emoji {
14856 form.text("emoji", emoji.to_string())
14857 } else {
14858 form
14859 };
14860 let form = if let Some(disable_notification) = self.disable_notification {
14861 form.text("disable_notification", disable_notification.to_string())
14862 } else {
14863 form
14864 };
14865 let form = if let Some(protect_content) = self.protect_content {
14866 form.text("protect_content", protect_content.to_string())
14867 } else {
14868 form
14869 };
14870 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
14871 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
14872 } else {
14873 form
14874 };
14875 let form = if let Some(message_effect_id) = self.message_effect_id {
14876 form.text("message_effect_id", message_effect_id.to_string())
14877 } else {
14878 form
14879 };
14880 let v: ChatHandle = self.chat_id.into();
14881 let form = form.text("chat_id", v.to_string());
14882 form
14883 }
14884}
14885impl<V: Into<ChatHandle> + Serialize> UnpinAllGeneralForumTopicMessagesOpts<V> {
14886 #[allow(clippy::let_and_return, dead_code)]
14887 fn get_form(self, form: Form) -> Form {
14888 let v: ChatHandle = self.chat_id.into();
14889 let form = form.text("chat_id", v.to_string());
14890 form
14891 }
14892}
14893impl<'a> GetMyCommandsOpts<'a> {
14894 #[allow(clippy::let_and_return, dead_code)]
14895 fn get_form(self, form: Form) -> Form {
14896 let form = if let Some(scope) = self.scope {
14897 form.text("scope", scope)
14898 } else {
14899 form
14900 };
14901 let form = if let Some(language_code) = self.language_code {
14902 form.text("language_code", language_code.to_string())
14903 } else {
14904 form
14905 };
14906 form
14907 }
14908}
14909impl<'a> SetBusinessAccountProfilePhotoOpts<'a> {
14910 #[allow(clippy::let_and_return, dead_code)]
14911 fn get_form(self, form: Form) -> Form {
14912 let form = form.text("photo", self.photo);
14913 let form = form.text(
14914 "business_connection_id",
14915 self.business_connection_id.to_string(),
14916 );
14917 let form = if let Some(is_public) = self.is_public {
14918 form.text("is_public", is_public.to_string())
14919 } else {
14920 form
14921 };
14922 form
14923 }
14924}
14925impl<'a, V: Into<ChatHandle> + Serialize> CreateChatInviteLinkOpts<'a, V> {
14926 #[allow(clippy::let_and_return, dead_code)]
14927 fn get_form(self, form: Form) -> Form {
14928 let form = if let Some(name) = self.name {
14929 form.text("name", name.to_string())
14930 } else {
14931 form
14932 };
14933 let form = if let Some(expire_date) = self.expire_date {
14934 form.text("expire_date", expire_date.to_string())
14935 } else {
14936 form
14937 };
14938 let form = if let Some(member_limit) = self.member_limit {
14939 form.text("member_limit", member_limit.to_string())
14940 } else {
14941 form
14942 };
14943 let form = if let Some(creates_join_request) = self.creates_join_request {
14944 form.text("creates_join_request", creates_join_request.to_string())
14945 } else {
14946 form
14947 };
14948 let v: ChatHandle = self.chat_id.into();
14949 let form = form.text("chat_id", v.to_string());
14950 form
14951 }
14952}
14953impl<'a> DeleteStickerFromSetOpts<'a> {
14954 #[allow(clippy::let_and_return, dead_code)]
14955 fn get_form(self, form: Form) -> Form {
14956 let form = form.text("sticker", self.sticker.to_string());
14957 form
14958 }
14959}
14960impl<'a> GetMyDescriptionOpts<'a> {
14961 #[allow(clippy::let_and_return, dead_code)]
14962 fn get_form(self, form: Form) -> Form {
14963 let form = if let Some(language_code) = self.language_code {
14964 form.text("language_code", language_code.to_string())
14965 } else {
14966 form
14967 };
14968 form
14969 }
14970}
14971impl GetMyStarBalanceOpts {
14972 #[allow(clippy::let_and_return, dead_code)]
14973 fn get_form(self, form: Form) -> Form {
14974 form
14975 }
14976}
14977impl<'a, V: Into<ChatHandle> + Serialize> SendMediaGroupOpts<'a, V> {
14978 #[allow(clippy::let_and_return, dead_code)]
14979 fn get_form(self, form: Form) -> Form {
14980 let form = form.text("media", self.media);
14981 let form = if let Some(reply_parameters) = self.reply_parameters {
14982 form.text("reply_parameters", reply_parameters)
14983 } else {
14984 form
14985 };
14986 let form = if let Some(business_connection_id) = self.business_connection_id {
14987 form.text("business_connection_id", business_connection_id.to_string())
14988 } else {
14989 form
14990 };
14991 let form = if let Some(message_thread_id) = self.message_thread_id {
14992 form.text("message_thread_id", message_thread_id.to_string())
14993 } else {
14994 form
14995 };
14996 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
14997 form.text(
14998 "direct_messages_topic_id",
14999 direct_messages_topic_id.to_string(),
15000 )
15001 } else {
15002 form
15003 };
15004 let form = if let Some(disable_notification) = self.disable_notification {
15005 form.text("disable_notification", disable_notification.to_string())
15006 } else {
15007 form
15008 };
15009 let form = if let Some(protect_content) = self.protect_content {
15010 form.text("protect_content", protect_content.to_string())
15011 } else {
15012 form
15013 };
15014 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
15015 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
15016 } else {
15017 form
15018 };
15019 let form = if let Some(message_effect_id) = self.message_effect_id {
15020 form.text("message_effect_id", message_effect_id.to_string())
15021 } else {
15022 form
15023 };
15024 let v: ChatHandle = self.chat_id.into();
15025 let form = form.text("chat_id", v.to_string());
15026 form
15027 }
15028}
15029impl GetWebhookInfoOpts {
15030 #[allow(clippy::let_and_return, dead_code)]
15031 fn get_form(self, form: Form) -> Form {
15032 form
15033 }
15034}
15035impl<V: Into<ChatHandle> + Serialize> GetChatMemberCountOpts<V> {
15036 #[allow(clippy::let_and_return, dead_code)]
15037 fn get_form(self, form: Form) -> Form {
15038 let v: ChatHandle = self.chat_id.into();
15039 let form = form.text("chat_id", v.to_string());
15040 form
15041 }
15042}
15043impl<'a> AnswerPreCheckoutQueryOpts<'a> {
15044 #[allow(clippy::let_and_return, dead_code)]
15045 fn get_form(self, form: Form) -> Form {
15046 let form = form.text(
15047 "pre_checkout_query_id",
15048 self.pre_checkout_query_id.to_string(),
15049 );
15050 let form = form.text("ok", self.ok.to_string());
15051 let form = if let Some(error_message) = self.error_message {
15052 form.text("error_message", error_message.to_string())
15053 } else {
15054 form
15055 };
15056 form
15057 }
15058}
15059impl<V: Into<ChatHandle> + Serialize> RemoveChatVerificationOpts<V> {
15060 #[allow(clippy::let_and_return, dead_code)]
15061 fn get_form(self, form: Form) -> Form {
15062 let v: ChatHandle = self.chat_id.into();
15063 let form = form.text("chat_id", v.to_string());
15064 form
15065 }
15066}
15067impl<V: Into<ChatHandle> + Serialize> CopyMessagesOpts<V> {
15068 #[allow(clippy::let_and_return, dead_code)]
15069 fn get_form(self, form: Form) -> Form {
15070 let form = form.text("message_ids", self.message_ids);
15071 let form = if let Some(message_thread_id) = self.message_thread_id {
15072 form.text("message_thread_id", message_thread_id.to_string())
15073 } else {
15074 form
15075 };
15076 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
15077 form.text(
15078 "direct_messages_topic_id",
15079 direct_messages_topic_id.to_string(),
15080 )
15081 } else {
15082 form
15083 };
15084 let form = if let Some(disable_notification) = self.disable_notification {
15085 form.text("disable_notification", disable_notification.to_string())
15086 } else {
15087 form
15088 };
15089 let form = if let Some(protect_content) = self.protect_content {
15090 form.text("protect_content", protect_content.to_string())
15091 } else {
15092 form
15093 };
15094 let form = if let Some(remove_caption) = self.remove_caption {
15095 form.text("remove_caption", remove_caption.to_string())
15096 } else {
15097 form
15098 };
15099 let v: ChatHandle = self.chat_id.into();
15100 let form = form.text("chat_id", v.to_string());
15101 let v: ChatHandle = self.from_chat_id.into();
15102 let form = form.text("from_chat_id", v.to_string());
15103 form
15104 }
15105}
15106impl<'a> SetStickerSetThumbnailOpts<'a> {
15107 #[allow(clippy::let_and_return, dead_code)]
15108 fn get_form(self, form: Form) -> Form {
15109 let form = form.text("name", self.name.to_string());
15110 let form = form.text("user_id", self.user_id.to_string());
15111 let form = if let Some(thumbnail) = self.thumbnail {
15112 form.text("thumbnail", thumbnail.to_string())
15113 } else {
15114 form
15115 };
15116 let form = form.text("format", self.format.to_string());
15117 form
15118 }
15119}
15120impl<'a> DeleteMyCommandsOpts<'a> {
15121 #[allow(clippy::let_and_return, dead_code)]
15122 fn get_form(self, form: Form) -> Form {
15123 let form = if let Some(scope) = self.scope {
15124 form.text("scope", scope)
15125 } else {
15126 form
15127 };
15128 let form = if let Some(language_code) = self.language_code {
15129 form.text("language_code", language_code.to_string())
15130 } else {
15131 form
15132 };
15133 form
15134 }
15135}
15136impl<'a> DeleteStickerSetOpts<'a> {
15137 #[allow(clippy::let_and_return, dead_code)]
15138 fn get_form(self, form: Form) -> Form {
15139 let form = form.text("name", self.name.to_string());
15140 form
15141 }
15142}
15143impl<'a, V: Into<ChatHandle> + Serialize> SetChatDescriptionOpts<'a, V> {
15144 #[allow(clippy::let_and_return, dead_code)]
15145 fn get_form(self, form: Form) -> Form {
15146 let form = if let Some(description) = self.description {
15147 form.text("description", description.to_string())
15148 } else {
15149 form
15150 };
15151 let v: ChatHandle = self.chat_id.into();
15152 let form = form.text("chat_id", v.to_string());
15153 form
15154 }
15155}
15156impl<'a> SetStickerEmojiListOpts<'a> {
15157 #[allow(clippy::let_and_return, dead_code)]
15158 fn get_form(self, form: Form) -> Form {
15159 let form = form.text("emoji_list", self.emoji_list);
15160 let form = form.text("sticker", self.sticker.to_string());
15161 form
15162 }
15163}
15164impl<'a, V: Into<ChatHandle> + Serialize> SendLocationOpts<'a, V> {
15165 #[allow(clippy::let_and_return, dead_code)]
15166 fn get_form(self, form: Form) -> Form {
15167 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
15168 form.text("suggested_post_parameters", suggested_post_parameters)
15169 } else {
15170 form
15171 };
15172 let form = if let Some(reply_parameters) = self.reply_parameters {
15173 form.text("reply_parameters", reply_parameters)
15174 } else {
15175 form
15176 };
15177 let form = if let Some(reply_markup) = self.reply_markup {
15178 form.text("reply_markup", reply_markup)
15179 } else {
15180 form
15181 };
15182 let form = if let Some(business_connection_id) = self.business_connection_id {
15183 form.text("business_connection_id", business_connection_id.to_string())
15184 } else {
15185 form
15186 };
15187 let form = if let Some(message_thread_id) = self.message_thread_id {
15188 form.text("message_thread_id", message_thread_id.to_string())
15189 } else {
15190 form
15191 };
15192 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
15193 form.text(
15194 "direct_messages_topic_id",
15195 direct_messages_topic_id.to_string(),
15196 )
15197 } else {
15198 form
15199 };
15200 let form = form.text("latitude", self.latitude.to_string());
15201 let form = form.text("longitude", self.longitude.to_string());
15202 let form = if let Some(horizontal_accuracy) = self.horizontal_accuracy {
15203 form.text("horizontal_accuracy", horizontal_accuracy.to_string())
15204 } else {
15205 form
15206 };
15207 let form = if let Some(live_period) = self.live_period {
15208 form.text("live_period", live_period.to_string())
15209 } else {
15210 form
15211 };
15212 let form = if let Some(heading) = self.heading {
15213 form.text("heading", heading.to_string())
15214 } else {
15215 form
15216 };
15217 let form = if let Some(proximity_alert_radius) = self.proximity_alert_radius {
15218 form.text("proximity_alert_radius", proximity_alert_radius.to_string())
15219 } else {
15220 form
15221 };
15222 let form = if let Some(disable_notification) = self.disable_notification {
15223 form.text("disable_notification", disable_notification.to_string())
15224 } else {
15225 form
15226 };
15227 let form = if let Some(protect_content) = self.protect_content {
15228 form.text("protect_content", protect_content.to_string())
15229 } else {
15230 form
15231 };
15232 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
15233 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
15234 } else {
15235 form
15236 };
15237 let form = if let Some(message_effect_id) = self.message_effect_id {
15238 form.text("message_effect_id", message_effect_id.to_string())
15239 } else {
15240 form
15241 };
15242 let v: ChatHandle = self.chat_id.into();
15243 let form = form.text("chat_id", v.to_string());
15244 form
15245 }
15246}
15247impl<'a, V: Into<ChatHandle> + Serialize> SetChatTitleOpts<'a, V> {
15248 #[allow(clippy::let_and_return, dead_code)]
15249 fn get_form(self, form: Form) -> Form {
15250 let form = form.text("title", self.title.to_string());
15251 let v: ChatHandle = self.chat_id.into();
15252 let form = form.text("chat_id", v.to_string());
15253 form
15254 }
15255}
15256impl<'a> ReplaceStickerInSetOpts<'a> {
15257 #[allow(clippy::let_and_return, dead_code)]
15258 fn get_form(self, form: Form) -> Form {
15259 let form = form.text("sticker", self.sticker);
15260 let form = form.text("user_id", self.user_id.to_string());
15261 let form = form.text("name", self.name.to_string());
15262 let form = form.text("old_sticker", self.old_sticker.to_string());
15263 form
15264 }
15265}
15266impl<'a> DeclineSuggestedPostOpts<'a> {
15267 #[allow(clippy::let_and_return, dead_code)]
15268 fn get_form(self, form: Form) -> Form {
15269 let form = form.text("chat_id", self.chat_id.to_string());
15270 let form = form.text("message_id", self.message_id.to_string());
15271 let form = if let Some(comment) = self.comment {
15272 form.text("comment", comment.to_string())
15273 } else {
15274 form
15275 };
15276 form
15277 }
15278}
15279impl<'a> SetMyShortDescriptionOpts<'a> {
15280 #[allow(clippy::let_and_return, dead_code)]
15281 fn get_form(self, form: Form) -> Form {
15282 let form = if let Some(short_description) = self.short_description {
15283 form.text("short_description", short_description.to_string())
15284 } else {
15285 form
15286 };
15287 let form = if let Some(language_code) = self.language_code {
15288 form.text("language_code", language_code.to_string())
15289 } else {
15290 form
15291 };
15292 form
15293 }
15294}
15295impl GetMyDefaultAdministratorRightsOpts {
15296 #[allow(clippy::let_and_return, dead_code)]
15297 fn get_form(self, form: Form) -> Form {
15298 let form = if let Some(for_channels) = self.for_channels {
15299 form.text("for_channels", for_channels.to_string())
15300 } else {
15301 form
15302 };
15303 form
15304 }
15305}
15306impl<'a> GetBusinessAccountStarBalanceOpts<'a> {
15307 #[allow(clippy::let_and_return, dead_code)]
15308 fn get_form(self, form: Form) -> Form {
15309 let form = form.text(
15310 "business_connection_id",
15311 self.business_connection_id.to_string(),
15312 );
15313 form
15314 }
15315}
15316impl<V: Into<ChatHandle> + Serialize> DeleteChatStickerSetOpts<V> {
15317 #[allow(clippy::let_and_return, dead_code)]
15318 fn get_form(self, form: Form) -> Form {
15319 let v: ChatHandle = self.chat_id.into();
15320 let form = form.text("chat_id", v.to_string());
15321 form
15322 }
15323}
15324impl<'a, V: Into<ChatHandle> + Serialize> SendAnimationOpts<'a, V> {
15325 #[allow(clippy::let_and_return, dead_code)]
15326 fn get_form(self, form: Form) -> Form {
15327 let form = if let Some(caption_entities) = self.caption_entities {
15328 form.text("caption_entities", caption_entities)
15329 } else {
15330 form
15331 };
15332 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
15333 form.text("suggested_post_parameters", suggested_post_parameters)
15334 } else {
15335 form
15336 };
15337 let form = if let Some(reply_parameters) = self.reply_parameters {
15338 form.text("reply_parameters", reply_parameters)
15339 } else {
15340 form
15341 };
15342 let form = if let Some(reply_markup) = self.reply_markup {
15343 form.text("reply_markup", reply_markup)
15344 } else {
15345 form
15346 };
15347 let form = if let Some(business_connection_id) = self.business_connection_id {
15348 form.text("business_connection_id", business_connection_id.to_string())
15349 } else {
15350 form
15351 };
15352 let form = if let Some(message_thread_id) = self.message_thread_id {
15353 form.text("message_thread_id", message_thread_id.to_string())
15354 } else {
15355 form
15356 };
15357 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
15358 form.text(
15359 "direct_messages_topic_id",
15360 direct_messages_topic_id.to_string(),
15361 )
15362 } else {
15363 form
15364 };
15365 let form = form.text("animation", self.animation.to_string());
15366 let form = if let Some(duration) = self.duration {
15367 form.text("duration", duration.to_string())
15368 } else {
15369 form
15370 };
15371 let form = if let Some(width) = self.width {
15372 form.text("width", width.to_string())
15373 } else {
15374 form
15375 };
15376 let form = if let Some(height) = self.height {
15377 form.text("height", height.to_string())
15378 } else {
15379 form
15380 };
15381 let form = if let Some(thumbnail) = self.thumbnail {
15382 form.text("thumbnail", thumbnail.to_string())
15383 } else {
15384 form
15385 };
15386 let form = if let Some(caption) = self.caption {
15387 form.text("caption", caption.to_string())
15388 } else {
15389 form
15390 };
15391 let form = if let Some(parse_mode) = self.parse_mode {
15392 form.text("parse_mode", parse_mode.to_string())
15393 } else {
15394 form
15395 };
15396 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
15397 form.text(
15398 "show_caption_above_media",
15399 show_caption_above_media.to_string(),
15400 )
15401 } else {
15402 form
15403 };
15404 let form = if let Some(has_spoiler) = self.has_spoiler {
15405 form.text("has_spoiler", has_spoiler.to_string())
15406 } else {
15407 form
15408 };
15409 let form = if let Some(disable_notification) = self.disable_notification {
15410 form.text("disable_notification", disable_notification.to_string())
15411 } else {
15412 form
15413 };
15414 let form = if let Some(protect_content) = self.protect_content {
15415 form.text("protect_content", protect_content.to_string())
15416 } else {
15417 form
15418 };
15419 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
15420 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
15421 } else {
15422 form
15423 };
15424 let form = if let Some(message_effect_id) = self.message_effect_id {
15425 form.text("message_effect_id", message_effect_id.to_string())
15426 } else {
15427 form
15428 };
15429 let v: ChatHandle = self.chat_id.into();
15430 let form = form.text("chat_id", v.to_string());
15431 form
15432 }
15433}
15434impl<'a> AddStickerToSetOpts<'a> {
15435 #[allow(clippy::let_and_return, dead_code)]
15436 fn get_form(self, form: Form) -> Form {
15437 let form = form.text("sticker", self.sticker);
15438 let form = form.text("user_id", self.user_id.to_string());
15439 let form = form.text("name", self.name.to_string());
15440 form
15441 }
15442}
15443impl DeleteWebhookOpts {
15444 #[allow(clippy::let_and_return, dead_code)]
15445 fn get_form(self, form: Form) -> Form {
15446 let form = if let Some(drop_pending_updates) = self.drop_pending_updates {
15447 form.text("drop_pending_updates", drop_pending_updates.to_string())
15448 } else {
15449 form
15450 };
15451 form
15452 }
15453}
15454impl<V: Into<ChatHandle> + Serialize> UnpinAllChatMessagesOpts<V> {
15455 #[allow(clippy::let_and_return, dead_code)]
15456 fn get_form(self, form: Form) -> Form {
15457 let v: ChatHandle = self.chat_id.into();
15458 let form = form.text("chat_id", v.to_string());
15459 form
15460 }
15461}
15462impl<V: Into<ChatHandle> + Serialize> DeclineChatJoinRequestOpts<V> {
15463 #[allow(clippy::let_and_return, dead_code)]
15464 fn get_form(self, form: Form) -> Form {
15465 let form = form.text("user_id", self.user_id.to_string());
15466 let v: ChatHandle = self.chat_id.into();
15467 let form = form.text("chat_id", v.to_string());
15468 form
15469 }
15470}
15471impl<'a> ReadBusinessMessageOpts<'a> {
15472 #[allow(clippy::let_and_return, dead_code)]
15473 fn get_form(self, form: Form) -> Form {
15474 let form = form.text(
15475 "business_connection_id",
15476 self.business_connection_id.to_string(),
15477 );
15478 let form = form.text("chat_id", self.chat_id.to_string());
15479 let form = form.text("message_id", self.message_id.to_string());
15480 form
15481 }
15482}
15483impl<'a> SetStickerMaskPositionOpts<'a> {
15484 #[allow(clippy::let_and_return, dead_code)]
15485 fn get_form(self, form: Form) -> Form {
15486 let form = if let Some(mask_position) = self.mask_position {
15487 form.text("mask_position", mask_position)
15488 } else {
15489 form
15490 };
15491 let form = form.text("sticker", self.sticker.to_string());
15492 form
15493 }
15494}
15495impl SetMyDefaultAdministratorRightsOpts {
15496 #[allow(clippy::let_and_return, dead_code)]
15497 fn get_form(self, form: Form) -> Form {
15498 let form = if let Some(rights) = self.rights {
15499 form.text("rights", rights)
15500 } else {
15501 form
15502 };
15503 let form = if let Some(for_channels) = self.for_channels {
15504 form.text("for_channels", for_channels.to_string())
15505 } else {
15506 form
15507 };
15508 form
15509 }
15510}
15511impl<'a> EditUserStarSubscriptionOpts<'a> {
15512 #[allow(clippy::let_and_return, dead_code)]
15513 fn get_form(self, form: Form) -> Form {
15514 let form = form.text("user_id", self.user_id.to_string());
15515 let form = form.text(
15516 "telegram_payment_charge_id",
15517 self.telegram_payment_charge_id.to_string(),
15518 );
15519 let form = form.text("is_canceled", self.is_canceled.to_string());
15520 form
15521 }
15522}
15523impl<'a> GetGameHighScoresOpts<'a> {
15524 #[allow(clippy::let_and_return, dead_code)]
15525 fn get_form(self, form: Form) -> Form {
15526 let form = form.text("user_id", self.user_id.to_string());
15527 let form = if let Some(chat_id) = self.chat_id {
15528 form.text("chat_id", chat_id.to_string())
15529 } else {
15530 form
15531 };
15532 let form = if let Some(message_id) = self.message_id {
15533 form.text("message_id", message_id.to_string())
15534 } else {
15535 form
15536 };
15537 let form = if let Some(inline_message_id) = self.inline_message_id {
15538 form.text("inline_message_id", inline_message_id.to_string())
15539 } else {
15540 form
15541 };
15542 form
15543 }
15544}
15545impl<'a, V: Into<ChatHandle> + Serialize> SendChatActionOpts<'a, V> {
15546 #[allow(clippy::let_and_return, dead_code)]
15547 fn get_form(self, form: Form) -> Form {
15548 let form = if let Some(business_connection_id) = self.business_connection_id {
15549 form.text("business_connection_id", business_connection_id.to_string())
15550 } else {
15551 form
15552 };
15553 let form = if let Some(message_thread_id) = self.message_thread_id {
15554 form.text("message_thread_id", message_thread_id.to_string())
15555 } else {
15556 form
15557 };
15558 let form = form.text("action", self.action.to_string());
15559 let v: ChatHandle = self.chat_id.into();
15560 let form = form.text("chat_id", v.to_string());
15561 form
15562 }
15563}
15564impl<'a> GetMyNameOpts<'a> {
15565 #[allow(clippy::let_and_return, dead_code)]
15566 fn get_form(self, form: Form) -> Form {
15567 let form = if let Some(language_code) = self.language_code {
15568 form.text("language_code", language_code.to_string())
15569 } else {
15570 form
15571 };
15572 form
15573 }
15574}
15575impl<'a, V: Into<ChatHandle> + Serialize> SetChatStickerSetOpts<'a, V> {
15576 #[allow(clippy::let_and_return, dead_code)]
15577 fn get_form(self, form: Form) -> Form {
15578 let form = form.text("sticker_set_name", self.sticker_set_name.to_string());
15579 let v: ChatHandle = self.chat_id.into();
15580 let form = form.text("chat_id", v.to_string());
15581 form
15582 }
15583}
15584impl<'a> SetWebhookOpts<'a> {
15585 #[allow(clippy::let_and_return, dead_code)]
15586 fn get_form(self, form: Form) -> Form {
15587 let form = if let Some(certificate) = self.certificate {
15588 form.text("certificate", certificate)
15589 } else {
15590 form
15591 };
15592 let form = if let Some(allowed_updates) = self.allowed_updates {
15593 form.text("allowed_updates", allowed_updates)
15594 } else {
15595 form
15596 };
15597 let form = form.text("url", self.url.to_string());
15598 let form = if let Some(ip_address) = self.ip_address {
15599 form.text("ip_address", ip_address.to_string())
15600 } else {
15601 form
15602 };
15603 let form = if let Some(max_connections) = self.max_connections {
15604 form.text("max_connections", max_connections.to_string())
15605 } else {
15606 form
15607 };
15608 let form = if let Some(drop_pending_updates) = self.drop_pending_updates {
15609 form.text("drop_pending_updates", drop_pending_updates.to_string())
15610 } else {
15611 form
15612 };
15613 let form = if let Some(secret_token) = self.secret_token {
15614 form.text("secret_token", secret_token.to_string())
15615 } else {
15616 form
15617 };
15618 form
15619 }
15620}
15621impl<'a, V: Into<ChatHandle> + Serialize> VerifyChatOpts<'a, V> {
15622 #[allow(clippy::let_and_return, dead_code)]
15623 fn get_form(self, form: Form) -> Form {
15624 let form = if let Some(custom_description) = self.custom_description {
15625 form.text("custom_description", custom_description.to_string())
15626 } else {
15627 form
15628 };
15629 let v: ChatHandle = self.chat_id.into();
15630 let form = form.text("chat_id", v.to_string());
15631 form
15632 }
15633}
15634impl CloseOpts {
15635 #[allow(clippy::let_and_return, dead_code)]
15636 fn get_form(self, form: Form) -> Form {
15637 form
15638 }
15639}
15640impl<'a> AnswerWebAppQueryOpts<'a> {
15641 #[allow(clippy::let_and_return, dead_code)]
15642 fn get_form(self, form: Form) -> Form {
15643 let form = form.text("result", self.result);
15644 let form = form.text("web_app_query_id", self.web_app_query_id.to_string());
15645 form
15646 }
15647}
15648impl<V: Into<ChatHandle> + Serialize> LeaveChatOpts<V> {
15649 #[allow(clippy::let_and_return, dead_code)]
15650 fn get_form(self, form: Form) -> Form {
15651 let v: ChatHandle = self.chat_id.into();
15652 let form = form.text("chat_id", v.to_string());
15653 form
15654 }
15655}
15656impl<'a, V: Into<ChatHandle> + Serialize> SendVoiceOpts<'a, V> {
15657 #[allow(clippy::let_and_return, dead_code)]
15658 fn get_form(self, form: Form) -> Form {
15659 let form = if let Some(caption_entities) = self.caption_entities {
15660 form.text("caption_entities", caption_entities)
15661 } else {
15662 form
15663 };
15664 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
15665 form.text("suggested_post_parameters", suggested_post_parameters)
15666 } else {
15667 form
15668 };
15669 let form = if let Some(reply_parameters) = self.reply_parameters {
15670 form.text("reply_parameters", reply_parameters)
15671 } else {
15672 form
15673 };
15674 let form = if let Some(reply_markup) = self.reply_markup {
15675 form.text("reply_markup", reply_markup)
15676 } else {
15677 form
15678 };
15679 let form = if let Some(business_connection_id) = self.business_connection_id {
15680 form.text("business_connection_id", business_connection_id.to_string())
15681 } else {
15682 form
15683 };
15684 let form = if let Some(message_thread_id) = self.message_thread_id {
15685 form.text("message_thread_id", message_thread_id.to_string())
15686 } else {
15687 form
15688 };
15689 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
15690 form.text(
15691 "direct_messages_topic_id",
15692 direct_messages_topic_id.to_string(),
15693 )
15694 } else {
15695 form
15696 };
15697 let form = form.text("voice", self.voice.to_string());
15698 let form = if let Some(caption) = self.caption {
15699 form.text("caption", caption.to_string())
15700 } else {
15701 form
15702 };
15703 let form = if let Some(parse_mode) = self.parse_mode {
15704 form.text("parse_mode", parse_mode.to_string())
15705 } else {
15706 form
15707 };
15708 let form = if let Some(duration) = self.duration {
15709 form.text("duration", duration.to_string())
15710 } else {
15711 form
15712 };
15713 let form = if let Some(disable_notification) = self.disable_notification {
15714 form.text("disable_notification", disable_notification.to_string())
15715 } else {
15716 form
15717 };
15718 let form = if let Some(protect_content) = self.protect_content {
15719 form.text("protect_content", protect_content.to_string())
15720 } else {
15721 form
15722 };
15723 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
15724 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
15725 } else {
15726 form
15727 };
15728 let form = if let Some(message_effect_id) = self.message_effect_id {
15729 form.text("message_effect_id", message_effect_id.to_string())
15730 } else {
15731 form
15732 };
15733 let v: ChatHandle = self.chat_id.into();
15734 let form = form.text("chat_id", v.to_string());
15735 form
15736 }
15737}
15738impl<'a, V: Into<ChatHandle> + Serialize> EditGeneralForumTopicOpts<'a, V> {
15739 #[allow(clippy::let_and_return, dead_code)]
15740 fn get_form(self, form: Form) -> Form {
15741 let form = form.text("name", self.name.to_string());
15742 let v: ChatHandle = self.chat_id.into();
15743 let form = form.text("chat_id", v.to_string());
15744 form
15745 }
15746}
15747impl SavePreparedInlineMessageOpts {
15748 #[allow(clippy::let_and_return, dead_code)]
15749 fn get_form(self, form: Form) -> Form {
15750 let form = form.text("result", self.result);
15751 let form = form.text("user_id", self.user_id.to_string());
15752 let form = if let Some(allow_user_chats) = self.allow_user_chats {
15753 form.text("allow_user_chats", allow_user_chats.to_string())
15754 } else {
15755 form
15756 };
15757 let form = if let Some(allow_bot_chats) = self.allow_bot_chats {
15758 form.text("allow_bot_chats", allow_bot_chats.to_string())
15759 } else {
15760 form
15761 };
15762 let form = if let Some(allow_group_chats) = self.allow_group_chats {
15763 form.text("allow_group_chats", allow_group_chats.to_string())
15764 } else {
15765 form
15766 };
15767 let form = if let Some(allow_channel_chats) = self.allow_channel_chats {
15768 form.text("allow_channel_chats", allow_channel_chats.to_string())
15769 } else {
15770 form
15771 };
15772 form
15773 }
15774}
15775impl<'a> TransferBusinessAccountStarsOpts<'a> {
15776 #[allow(clippy::let_and_return, dead_code)]
15777 fn get_form(self, form: Form) -> Form {
15778 let form = form.text(
15779 "business_connection_id",
15780 self.business_connection_id.to_string(),
15781 );
15782 let form = form.text("star_count", self.star_count.to_string());
15783 form
15784 }
15785}
15786impl<V: Into<ChatHandle> + Serialize> PromoteChatMemberOpts<V> {
15787 #[allow(clippy::let_and_return, dead_code)]
15788 fn get_form(self, form: Form) -> Form {
15789 let form = form.text("user_id", self.user_id.to_string());
15790 let form = if let Some(is_anonymous) = self.is_anonymous {
15791 form.text("is_anonymous", is_anonymous.to_string())
15792 } else {
15793 form
15794 };
15795 let form = if let Some(can_manage_chat) = self.can_manage_chat {
15796 form.text("can_manage_chat", can_manage_chat.to_string())
15797 } else {
15798 form
15799 };
15800 let form = if let Some(can_delete_messages) = self.can_delete_messages {
15801 form.text("can_delete_messages", can_delete_messages.to_string())
15802 } else {
15803 form
15804 };
15805 let form = if let Some(can_manage_video_chats) = self.can_manage_video_chats {
15806 form.text("can_manage_video_chats", can_manage_video_chats.to_string())
15807 } else {
15808 form
15809 };
15810 let form = if let Some(can_restrict_members) = self.can_restrict_members {
15811 form.text("can_restrict_members", can_restrict_members.to_string())
15812 } else {
15813 form
15814 };
15815 let form = if let Some(can_promote_members) = self.can_promote_members {
15816 form.text("can_promote_members", can_promote_members.to_string())
15817 } else {
15818 form
15819 };
15820 let form = if let Some(can_change_info) = self.can_change_info {
15821 form.text("can_change_info", can_change_info.to_string())
15822 } else {
15823 form
15824 };
15825 let form = if let Some(can_invite_users) = self.can_invite_users {
15826 form.text("can_invite_users", can_invite_users.to_string())
15827 } else {
15828 form
15829 };
15830 let form = if let Some(can_post_stories) = self.can_post_stories {
15831 form.text("can_post_stories", can_post_stories.to_string())
15832 } else {
15833 form
15834 };
15835 let form = if let Some(can_edit_stories) = self.can_edit_stories {
15836 form.text("can_edit_stories", can_edit_stories.to_string())
15837 } else {
15838 form
15839 };
15840 let form = if let Some(can_delete_stories) = self.can_delete_stories {
15841 form.text("can_delete_stories", can_delete_stories.to_string())
15842 } else {
15843 form
15844 };
15845 let form = if let Some(can_post_messages) = self.can_post_messages {
15846 form.text("can_post_messages", can_post_messages.to_string())
15847 } else {
15848 form
15849 };
15850 let form = if let Some(can_edit_messages) = self.can_edit_messages {
15851 form.text("can_edit_messages", can_edit_messages.to_string())
15852 } else {
15853 form
15854 };
15855 let form = if let Some(can_pin_messages) = self.can_pin_messages {
15856 form.text("can_pin_messages", can_pin_messages.to_string())
15857 } else {
15858 form
15859 };
15860 let form = if let Some(can_manage_topics) = self.can_manage_topics {
15861 form.text("can_manage_topics", can_manage_topics.to_string())
15862 } else {
15863 form
15864 };
15865 let form = if let Some(can_manage_direct_messages) = self.can_manage_direct_messages {
15866 form.text(
15867 "can_manage_direct_messages",
15868 can_manage_direct_messages.to_string(),
15869 )
15870 } else {
15871 form
15872 };
15873 let v: ChatHandle = self.chat_id.into();
15874 let form = form.text("chat_id", v.to_string());
15875 form
15876 }
15877}
15878impl<'a, V: Into<ChatHandle> + Serialize> PinChatMessageOpts<'a, V> {
15879 #[allow(clippy::let_and_return, dead_code)]
15880 fn get_form(self, form: Form) -> Form {
15881 let form = if let Some(business_connection_id) = self.business_connection_id {
15882 form.text("business_connection_id", business_connection_id.to_string())
15883 } else {
15884 form
15885 };
15886 let form = form.text("message_id", self.message_id.to_string());
15887 let form = if let Some(disable_notification) = self.disable_notification {
15888 form.text("disable_notification", disable_notification.to_string())
15889 } else {
15890 form
15891 };
15892 let v: ChatHandle = self.chat_id.into();
15893 let form = form.text("chat_id", v.to_string());
15894 form
15895 }
15896}
15897impl<'a> GetMyShortDescriptionOpts<'a> {
15898 #[allow(clippy::let_and_return, dead_code)]
15899 fn get_form(self, form: Form) -> Form {
15900 let form = if let Some(language_code) = self.language_code {
15901 form.text("language_code", language_code.to_string())
15902 } else {
15903 form
15904 };
15905 form
15906 }
15907}
15908impl<'a> CreateInvoiceLinkOpts<'a> {
15909 #[allow(clippy::let_and_return, dead_code)]
15910 fn get_form(self, form: Form) -> Form {
15911 let form = form.text("prices", self.prices);
15912 let form = if let Some(suggested_tip_amounts) = self.suggested_tip_amounts {
15913 form.text("suggested_tip_amounts", suggested_tip_amounts)
15914 } else {
15915 form
15916 };
15917 let form = if let Some(business_connection_id) = self.business_connection_id {
15918 form.text("business_connection_id", business_connection_id.to_string())
15919 } else {
15920 form
15921 };
15922 let form = form.text("title", self.title.to_string());
15923 let form = form.text("description", self.description.to_string());
15924 let form = form.text("payload", self.payload.to_string());
15925 let form = if let Some(provider_token) = self.provider_token {
15926 form.text("provider_token", provider_token.to_string())
15927 } else {
15928 form
15929 };
15930 let form = form.text("currency", self.currency.to_string());
15931 let form = if let Some(subscription_period) = self.subscription_period {
15932 form.text("subscription_period", subscription_period.to_string())
15933 } else {
15934 form
15935 };
15936 let form = if let Some(max_tip_amount) = self.max_tip_amount {
15937 form.text("max_tip_amount", max_tip_amount.to_string())
15938 } else {
15939 form
15940 };
15941 let form = if let Some(provider_data) = self.provider_data {
15942 form.text("provider_data", provider_data.to_string())
15943 } else {
15944 form
15945 };
15946 let form = if let Some(photo_url) = self.photo_url {
15947 form.text("photo_url", photo_url.to_string())
15948 } else {
15949 form
15950 };
15951 let form = if let Some(photo_size) = self.photo_size {
15952 form.text("photo_size", photo_size.to_string())
15953 } else {
15954 form
15955 };
15956 let form = if let Some(photo_width) = self.photo_width {
15957 form.text("photo_width", photo_width.to_string())
15958 } else {
15959 form
15960 };
15961 let form = if let Some(photo_height) = self.photo_height {
15962 form.text("photo_height", photo_height.to_string())
15963 } else {
15964 form
15965 };
15966 let form = if let Some(need_name) = self.need_name {
15967 form.text("need_name", need_name.to_string())
15968 } else {
15969 form
15970 };
15971 let form = if let Some(need_phone_number) = self.need_phone_number {
15972 form.text("need_phone_number", need_phone_number.to_string())
15973 } else {
15974 form
15975 };
15976 let form = if let Some(need_email) = self.need_email {
15977 form.text("need_email", need_email.to_string())
15978 } else {
15979 form
15980 };
15981 let form = if let Some(need_shipping_address) = self.need_shipping_address {
15982 form.text("need_shipping_address", need_shipping_address.to_string())
15983 } else {
15984 form
15985 };
15986 let form = if let Some(send_phone_number_to_provider) = self.send_phone_number_to_provider {
15987 form.text(
15988 "send_phone_number_to_provider",
15989 send_phone_number_to_provider.to_string(),
15990 )
15991 } else {
15992 form
15993 };
15994 let form = if let Some(send_email_to_provider) = self.send_email_to_provider {
15995 form.text("send_email_to_provider", send_email_to_provider.to_string())
15996 } else {
15997 form
15998 };
15999 let form = if let Some(is_flexible) = self.is_flexible {
16000 form.text("is_flexible", is_flexible.to_string())
16001 } else {
16002 form
16003 };
16004 form
16005 }
16006}
16007impl GetAvailableGiftsOpts {
16008 #[allow(clippy::let_and_return, dead_code)]
16009 fn get_form(self, form: Form) -> Form {
16010 form
16011 }
16012}
16013impl<V: Into<ChatHandle> + Serialize> SetChatPhotoOpts<V> {
16014 #[allow(clippy::let_and_return, dead_code)]
16015 fn get_form(self, form: Form) -> Form {
16016 let form = form.text("photo", self.photo);
16017 let v: ChatHandle = self.chat_id.into();
16018 let form = form.text("chat_id", v.to_string());
16019 form
16020 }
16021}
16022impl<'a> SetMyDescriptionOpts<'a> {
16023 #[allow(clippy::let_and_return, dead_code)]
16024 fn get_form(self, form: Form) -> Form {
16025 let form = if let Some(description) = self.description {
16026 form.text("description", description.to_string())
16027 } else {
16028 form
16029 };
16030 let form = if let Some(language_code) = self.language_code {
16031 form.text("language_code", language_code.to_string())
16032 } else {
16033 form
16034 };
16035 form
16036 }
16037}
16038impl<'a> SetMyNameOpts<'a> {
16039 #[allow(clippy::let_and_return, dead_code)]
16040 fn get_form(self, form: Form) -> Form {
16041 let form = if let Some(name) = self.name {
16042 form.text("name", name.to_string())
16043 } else {
16044 form
16045 };
16046 let form = if let Some(language_code) = self.language_code {
16047 form.text("language_code", language_code.to_string())
16048 } else {
16049 form
16050 };
16051 form
16052 }
16053}
16054impl<'a> SetMyCommandsOpts<'a> {
16055 #[allow(clippy::let_and_return, dead_code)]
16056 fn get_form(self, form: Form) -> Form {
16057 let form = form.text("commands", self.commands);
16058 let form = if let Some(scope) = self.scope {
16059 form.text("scope", scope)
16060 } else {
16061 form
16062 };
16063 let form = if let Some(language_code) = self.language_code {
16064 form.text("language_code", language_code.to_string())
16065 } else {
16066 form
16067 };
16068 form
16069 }
16070}
16071impl<'a, V: Into<ChatHandle> + Serialize> EditMessageCaptionOpts<'a, V> {
16072 #[allow(clippy::let_and_return, dead_code)]
16073 fn get_form(self, form: Form) -> Form {
16074 let form = if let Some(caption_entities) = self.caption_entities {
16075 form.text("caption_entities", caption_entities)
16076 } else {
16077 form
16078 };
16079 let form = if let Some(reply_markup) = self.reply_markup {
16080 form.text("reply_markup", reply_markup)
16081 } else {
16082 form
16083 };
16084 let form = if let Some(business_connection_id) = self.business_connection_id {
16085 form.text("business_connection_id", business_connection_id.to_string())
16086 } else {
16087 form
16088 };
16089 let form = if let Some(message_id) = self.message_id {
16090 form.text("message_id", message_id.to_string())
16091 } else {
16092 form
16093 };
16094 let form = if let Some(inline_message_id) = self.inline_message_id {
16095 form.text("inline_message_id", inline_message_id.to_string())
16096 } else {
16097 form
16098 };
16099 let form = if let Some(caption) = self.caption {
16100 form.text("caption", caption.to_string())
16101 } else {
16102 form
16103 };
16104 let form = if let Some(parse_mode) = self.parse_mode {
16105 form.text("parse_mode", parse_mode.to_string())
16106 } else {
16107 form
16108 };
16109 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
16110 form.text(
16111 "show_caption_above_media",
16112 show_caption_above_media.to_string(),
16113 )
16114 } else {
16115 form
16116 };
16117 let form = if let Some(chat_id) = self.chat_id {
16118 let v: ChatHandle = chat_id.into();
16119 form.text("chat_id", v.to_string())
16120 } else {
16121 form
16122 };
16123 form
16124 }
16125}
16126impl<'a> DeleteStoryOpts<'a> {
16127 #[allow(clippy::let_and_return, dead_code)]
16128 fn get_form(self, form: Form) -> Form {
16129 let form = form.text(
16130 "business_connection_id",
16131 self.business_connection_id.to_string(),
16132 );
16133 let form = form.text("story_id", self.story_id.to_string());
16134 form
16135 }
16136}
16137impl<'a> DeleteBusinessMessagesOpts<'a> {
16138 #[allow(clippy::let_and_return, dead_code)]
16139 fn get_form(self, form: Form) -> Form {
16140 let form = form.text("message_ids", self.message_ids);
16141 let form = form.text(
16142 "business_connection_id",
16143 self.business_connection_id.to_string(),
16144 );
16145 form
16146 }
16147}
16148impl GetUserProfilePhotosOpts {
16149 #[allow(clippy::let_and_return, dead_code)]
16150 fn get_form(self, form: Form) -> Form {
16151 let form = form.text("user_id", self.user_id.to_string());
16152 let form = if let Some(offset) = self.offset {
16153 form.text("offset", offset.to_string())
16154 } else {
16155 form
16156 };
16157 let form = if let Some(limit) = self.limit {
16158 form.text("limit", limit.to_string())
16159 } else {
16160 form
16161 };
16162 form
16163 }
16164}
16165impl<'a> GetBusinessAccountGiftsOpts<'a> {
16166 #[allow(clippy::let_and_return, dead_code)]
16167 fn get_form(self, form: Form) -> Form {
16168 let form = form.text(
16169 "business_connection_id",
16170 self.business_connection_id.to_string(),
16171 );
16172 let form = if let Some(exclude_unsaved) = self.exclude_unsaved {
16173 form.text("exclude_unsaved", exclude_unsaved.to_string())
16174 } else {
16175 form
16176 };
16177 let form = if let Some(exclude_saved) = self.exclude_saved {
16178 form.text("exclude_saved", exclude_saved.to_string())
16179 } else {
16180 form
16181 };
16182 let form = if let Some(exclude_unlimited) = self.exclude_unlimited {
16183 form.text("exclude_unlimited", exclude_unlimited.to_string())
16184 } else {
16185 form
16186 };
16187 let form = if let Some(exclude_limited) = self.exclude_limited {
16188 form.text("exclude_limited", exclude_limited.to_string())
16189 } else {
16190 form
16191 };
16192 let form = if let Some(exclude_unique) = self.exclude_unique {
16193 form.text("exclude_unique", exclude_unique.to_string())
16194 } else {
16195 form
16196 };
16197 let form = if let Some(sort_by_price) = self.sort_by_price {
16198 form.text("sort_by_price", sort_by_price.to_string())
16199 } else {
16200 form
16201 };
16202 let form = if let Some(offset) = self.offset {
16203 form.text("offset", offset.to_string())
16204 } else {
16205 form
16206 };
16207 let form = if let Some(limit) = self.limit {
16208 form.text("limit", limit.to_string())
16209 } else {
16210 form
16211 };
16212 form
16213 }
16214}
16215impl<V: Into<ChatHandle> + Serialize> SetChatPermissionsOpts<V> {
16216 #[allow(clippy::let_and_return, dead_code)]
16217 fn get_form(self, form: Form) -> Form {
16218 let form = form.text("permissions", self.permissions);
16219 let form =
16220 if let Some(use_independent_chat_permissions) = self.use_independent_chat_permissions {
16221 form.text(
16222 "use_independent_chat_permissions",
16223 use_independent_chat_permissions.to_string(),
16224 )
16225 } else {
16226 form
16227 };
16228 let v: ChatHandle = self.chat_id.into();
16229 let form = form.text("chat_id", v.to_string());
16230 form
16231 }
16232}
16233impl<'a> AnswerShippingQueryOpts<'a> {
16234 #[allow(clippy::let_and_return, dead_code)]
16235 fn get_form(self, form: Form) -> Form {
16236 let form = if let Some(shipping_options) = self.shipping_options {
16237 form.text("shipping_options", shipping_options)
16238 } else {
16239 form
16240 };
16241 let form = form.text("shipping_query_id", self.shipping_query_id.to_string());
16242 let form = form.text("ok", self.ok.to_string());
16243 let form = if let Some(error_message) = self.error_message {
16244 form.text("error_message", error_message.to_string())
16245 } else {
16246 form
16247 };
16248 form
16249 }
16250}
16251impl<'a, V: Into<ChatHandle> + Serialize> CreateChatSubscriptionInviteLinkOpts<'a, V> {
16252 #[allow(clippy::let_and_return, dead_code)]
16253 fn get_form(self, form: Form) -> Form {
16254 let form = if let Some(name) = self.name {
16255 form.text("name", name.to_string())
16256 } else {
16257 form
16258 };
16259 let form = form.text("subscription_period", self.subscription_period.to_string());
16260 let form = form.text("subscription_price", self.subscription_price.to_string());
16261 let v: ChatHandle = self.chat_id.into();
16262 let form = form.text("chat_id", v.to_string());
16263 form
16264 }
16265}
16266impl<'a> SetStickerSetTitleOpts<'a> {
16267 #[allow(clippy::let_and_return, dead_code)]
16268 fn get_form(self, form: Form) -> Form {
16269 let form = form.text("name", self.name.to_string());
16270 let form = form.text("title", self.title.to_string());
16271 form
16272 }
16273}
16274impl ApproveSuggestedPostOpts {
16275 #[allow(clippy::let_and_return, dead_code)]
16276 fn get_form(self, form: Form) -> Form {
16277 let form = form.text("chat_id", self.chat_id.to_string());
16278 let form = form.text("message_id", self.message_id.to_string());
16279 let form = if let Some(send_date) = self.send_date {
16280 form.text("send_date", send_date.to_string())
16281 } else {
16282 form
16283 };
16284 form
16285 }
16286}
16287impl<V: Into<ChatHandle> + Serialize> HideGeneralForumTopicOpts<V> {
16288 #[allow(clippy::let_and_return, dead_code)]
16289 fn get_form(self, form: Form) -> Form {
16290 let v: ChatHandle = self.chat_id.into();
16291 let form = form.text("chat_id", v.to_string());
16292 form
16293 }
16294}
16295impl<'a> CreateNewStickerSetOpts<'a> {
16296 #[allow(clippy::let_and_return, dead_code)]
16297 fn get_form(self, form: Form) -> Form {
16298 let form = form.text("stickers", self.stickers);
16299 let form = form.text("user_id", self.user_id.to_string());
16300 let form = form.text("name", self.name.to_string());
16301 let form = form.text("title", self.title.to_string());
16302 let form = if let Some(sticker_type) = self.sticker_type {
16303 form.text("sticker_type", sticker_type.to_string())
16304 } else {
16305 form
16306 };
16307 let form = if let Some(needs_repainting) = self.needs_repainting {
16308 form.text("needs_repainting", needs_repainting.to_string())
16309 } else {
16310 form
16311 };
16312 form
16313 }
16314}
16315impl<'a, V: Into<ChatHandle> + Serialize> SendVideoNoteOpts<'a, V> {
16316 #[allow(clippy::let_and_return, dead_code)]
16317 fn get_form(self, form: Form) -> Form {
16318 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
16319 form.text("suggested_post_parameters", suggested_post_parameters)
16320 } else {
16321 form
16322 };
16323 let form = if let Some(reply_parameters) = self.reply_parameters {
16324 form.text("reply_parameters", reply_parameters)
16325 } else {
16326 form
16327 };
16328 let form = if let Some(reply_markup) = self.reply_markup {
16329 form.text("reply_markup", reply_markup)
16330 } else {
16331 form
16332 };
16333 let form = if let Some(business_connection_id) = self.business_connection_id {
16334 form.text("business_connection_id", business_connection_id.to_string())
16335 } else {
16336 form
16337 };
16338 let form = if let Some(message_thread_id) = self.message_thread_id {
16339 form.text("message_thread_id", message_thread_id.to_string())
16340 } else {
16341 form
16342 };
16343 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
16344 form.text(
16345 "direct_messages_topic_id",
16346 direct_messages_topic_id.to_string(),
16347 )
16348 } else {
16349 form
16350 };
16351 let form = form.text("video_note", self.video_note.to_string());
16352 let form = if let Some(duration) = self.duration {
16353 form.text("duration", duration.to_string())
16354 } else {
16355 form
16356 };
16357 let form = if let Some(length) = self.length {
16358 form.text("length", length.to_string())
16359 } else {
16360 form
16361 };
16362 let form = if let Some(thumbnail) = self.thumbnail {
16363 form.text("thumbnail", thumbnail.to_string())
16364 } else {
16365 form
16366 };
16367 let form = if let Some(disable_notification) = self.disable_notification {
16368 form.text("disable_notification", disable_notification.to_string())
16369 } else {
16370 form
16371 };
16372 let form = if let Some(protect_content) = self.protect_content {
16373 form.text("protect_content", protect_content.to_string())
16374 } else {
16375 form
16376 };
16377 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
16378 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
16379 } else {
16380 form
16381 };
16382 let form = if let Some(message_effect_id) = self.message_effect_id {
16383 form.text("message_effect_id", message_effect_id.to_string())
16384 } else {
16385 form
16386 };
16387 let v: ChatHandle = self.chat_id.into();
16388 let form = form.text("chat_id", v.to_string());
16389 form
16390 }
16391}
16392impl<V: Into<ChatHandle> + Serialize> UnbanChatMemberOpts<V> {
16393 #[allow(clippy::let_and_return, dead_code)]
16394 fn get_form(self, form: Form) -> Form {
16395 let form = form.text("user_id", self.user_id.to_string());
16396 let form = if let Some(only_if_banned) = self.only_if_banned {
16397 form.text("only_if_banned", only_if_banned.to_string())
16398 } else {
16399 form
16400 };
16401 let v: ChatHandle = self.chat_id.into();
16402 let form = form.text("chat_id", v.to_string());
16403 form
16404 }
16405}
16406impl<'a, V: Into<ChatHandle> + Serialize> EditChatSubscriptionInviteLinkOpts<'a, V> {
16407 #[allow(clippy::let_and_return, dead_code)]
16408 fn get_form(self, form: Form) -> Form {
16409 let form = form.text("invite_link", self.invite_link.to_string());
16410 let form = if let Some(name) = self.name {
16411 form.text("name", name.to_string())
16412 } else {
16413 form
16414 };
16415 let v: ChatHandle = self.chat_id.into();
16416 let form = form.text("chat_id", v.to_string());
16417 form
16418 }
16419}
16420impl<V: Into<ChatHandle> + Serialize> UnpinAllForumTopicMessagesOpts<V> {
16421 #[allow(clippy::let_and_return, dead_code)]
16422 fn get_form(self, form: Form) -> Form {
16423 let form = form.text("message_thread_id", self.message_thread_id.to_string());
16424 let v: ChatHandle = self.chat_id.into();
16425 let form = form.text("chat_id", v.to_string());
16426 form
16427 }
16428}
16429impl<'a> SendGameOpts<'a> {
16430 #[allow(clippy::let_and_return, dead_code)]
16431 fn get_form(self, form: Form) -> Form {
16432 let form = if let Some(reply_parameters) = self.reply_parameters {
16433 form.text("reply_parameters", reply_parameters)
16434 } else {
16435 form
16436 };
16437 let form = if let Some(reply_markup) = self.reply_markup {
16438 form.text("reply_markup", reply_markup)
16439 } else {
16440 form
16441 };
16442 let form = if let Some(business_connection_id) = self.business_connection_id {
16443 form.text("business_connection_id", business_connection_id.to_string())
16444 } else {
16445 form
16446 };
16447 let form = form.text("chat_id", self.chat_id.to_string());
16448 let form = if let Some(message_thread_id) = self.message_thread_id {
16449 form.text("message_thread_id", message_thread_id.to_string())
16450 } else {
16451 form
16452 };
16453 let form = form.text("game_short_name", self.game_short_name.to_string());
16454 let form = if let Some(disable_notification) = self.disable_notification {
16455 form.text("disable_notification", disable_notification.to_string())
16456 } else {
16457 form
16458 };
16459 let form = if let Some(protect_content) = self.protect_content {
16460 form.text("protect_content", protect_content.to_string())
16461 } else {
16462 form
16463 };
16464 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
16465 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
16466 } else {
16467 form
16468 };
16469 let form = if let Some(message_effect_id) = self.message_effect_id {
16470 form.text("message_effect_id", message_effect_id.to_string())
16471 } else {
16472 form
16473 };
16474 form
16475 }
16476}
16477impl<V: Into<ChatHandle> + Serialize> CloseGeneralForumTopicOpts<V> {
16478 #[allow(clippy::let_and_return, dead_code)]
16479 fn get_form(self, form: Form) -> Form {
16480 let v: ChatHandle = self.chat_id.into();
16481 let form = form.text("chat_id", v.to_string());
16482 form
16483 }
16484}
16485impl<'a> SetStickerPositionInSetOpts<'a> {
16486 #[allow(clippy::let_and_return, dead_code)]
16487 fn get_form(self, form: Form) -> Form {
16488 let form = form.text("sticker", self.sticker.to_string());
16489 let form = form.text("position", self.position.to_string());
16490 form
16491 }
16492}
16493impl<'a, V: Into<ChatHandle> + Serialize> SendAudioOpts<'a, V> {
16494 #[allow(clippy::let_and_return, dead_code)]
16495 fn get_form(self, form: Form) -> Form {
16496 let form = if let Some(caption_entities) = self.caption_entities {
16497 form.text("caption_entities", caption_entities)
16498 } else {
16499 form
16500 };
16501 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
16502 form.text("suggested_post_parameters", suggested_post_parameters)
16503 } else {
16504 form
16505 };
16506 let form = if let Some(reply_parameters) = self.reply_parameters {
16507 form.text("reply_parameters", reply_parameters)
16508 } else {
16509 form
16510 };
16511 let form = if let Some(reply_markup) = self.reply_markup {
16512 form.text("reply_markup", reply_markup)
16513 } else {
16514 form
16515 };
16516 let form = if let Some(business_connection_id) = self.business_connection_id {
16517 form.text("business_connection_id", business_connection_id.to_string())
16518 } else {
16519 form
16520 };
16521 let form = if let Some(message_thread_id) = self.message_thread_id {
16522 form.text("message_thread_id", message_thread_id.to_string())
16523 } else {
16524 form
16525 };
16526 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
16527 form.text(
16528 "direct_messages_topic_id",
16529 direct_messages_topic_id.to_string(),
16530 )
16531 } else {
16532 form
16533 };
16534 let form = form.text("audio", self.audio.to_string());
16535 let form = if let Some(caption) = self.caption {
16536 form.text("caption", caption.to_string())
16537 } else {
16538 form
16539 };
16540 let form = if let Some(parse_mode) = self.parse_mode {
16541 form.text("parse_mode", parse_mode.to_string())
16542 } else {
16543 form
16544 };
16545 let form = if let Some(duration) = self.duration {
16546 form.text("duration", duration.to_string())
16547 } else {
16548 form
16549 };
16550 let form = if let Some(performer) = self.performer {
16551 form.text("performer", performer.to_string())
16552 } else {
16553 form
16554 };
16555 let form = if let Some(title) = self.title {
16556 form.text("title", title.to_string())
16557 } else {
16558 form
16559 };
16560 let form = if let Some(thumbnail) = self.thumbnail {
16561 form.text("thumbnail", thumbnail.to_string())
16562 } else {
16563 form
16564 };
16565 let form = if let Some(disable_notification) = self.disable_notification {
16566 form.text("disable_notification", disable_notification.to_string())
16567 } else {
16568 form
16569 };
16570 let form = if let Some(protect_content) = self.protect_content {
16571 form.text("protect_content", protect_content.to_string())
16572 } else {
16573 form
16574 };
16575 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
16576 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
16577 } else {
16578 form
16579 };
16580 let form = if let Some(message_effect_id) = self.message_effect_id {
16581 form.text("message_effect_id", message_effect_id.to_string())
16582 } else {
16583 form
16584 };
16585 let v: ChatHandle = self.chat_id.into();
16586 let form = form.text("chat_id", v.to_string());
16587 form
16588 }
16589}
16590impl<'a, V: Into<ChatHandle> + Serialize> EditMessageTextOpts<'a, V> {
16591 #[allow(clippy::let_and_return, dead_code)]
16592 fn get_form(self, form: Form) -> Form {
16593 let form = if let Some(entities) = self.entities {
16594 form.text("entities", entities)
16595 } else {
16596 form
16597 };
16598 let form = if let Some(link_preview_options) = self.link_preview_options {
16599 form.text("link_preview_options", link_preview_options)
16600 } else {
16601 form
16602 };
16603 let form = if let Some(reply_markup) = self.reply_markup {
16604 form.text("reply_markup", reply_markup)
16605 } else {
16606 form
16607 };
16608 let form = if let Some(business_connection_id) = self.business_connection_id {
16609 form.text("business_connection_id", business_connection_id.to_string())
16610 } else {
16611 form
16612 };
16613 let form = if let Some(message_id) = self.message_id {
16614 form.text("message_id", message_id.to_string())
16615 } else {
16616 form
16617 };
16618 let form = if let Some(inline_message_id) = self.inline_message_id {
16619 form.text("inline_message_id", inline_message_id.to_string())
16620 } else {
16621 form
16622 };
16623 let form = form.text("text", self.text.to_string());
16624 let form = if let Some(parse_mode) = self.parse_mode {
16625 form.text("parse_mode", parse_mode.to_string())
16626 } else {
16627 form
16628 };
16629 let form = if let Some(chat_id) = self.chat_id {
16630 let v: ChatHandle = chat_id.into();
16631 form.text("chat_id", v.to_string())
16632 } else {
16633 form
16634 };
16635 form
16636 }
16637}
16638impl GetChatMenuButtonOpts {
16639 #[allow(clippy::let_and_return, dead_code)]
16640 fn get_form(self, form: Form) -> Form {
16641 let form = if let Some(chat_id) = self.chat_id {
16642 form.text("chat_id", chat_id.to_string())
16643 } else {
16644 form
16645 };
16646 form
16647 }
16648}
16649impl<'a, V: Into<ChatHandle> + Serialize> SendStickerOpts<'a, V> {
16650 #[allow(clippy::let_and_return, dead_code)]
16651 fn get_form(self, form: Form) -> Form {
16652 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
16653 form.text("suggested_post_parameters", suggested_post_parameters)
16654 } else {
16655 form
16656 };
16657 let form = if let Some(reply_parameters) = self.reply_parameters {
16658 form.text("reply_parameters", reply_parameters)
16659 } else {
16660 form
16661 };
16662 let form = if let Some(reply_markup) = self.reply_markup {
16663 form.text("reply_markup", reply_markup)
16664 } else {
16665 form
16666 };
16667 let form = if let Some(business_connection_id) = self.business_connection_id {
16668 form.text("business_connection_id", business_connection_id.to_string())
16669 } else {
16670 form
16671 };
16672 let form = if let Some(message_thread_id) = self.message_thread_id {
16673 form.text("message_thread_id", message_thread_id.to_string())
16674 } else {
16675 form
16676 };
16677 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
16678 form.text(
16679 "direct_messages_topic_id",
16680 direct_messages_topic_id.to_string(),
16681 )
16682 } else {
16683 form
16684 };
16685 let form = form.text("sticker", self.sticker.to_string());
16686 let form = if let Some(emoji) = self.emoji {
16687 form.text("emoji", emoji.to_string())
16688 } else {
16689 form
16690 };
16691 let form = if let Some(disable_notification) = self.disable_notification {
16692 form.text("disable_notification", disable_notification.to_string())
16693 } else {
16694 form
16695 };
16696 let form = if let Some(protect_content) = self.protect_content {
16697 form.text("protect_content", protect_content.to_string())
16698 } else {
16699 form
16700 };
16701 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
16702 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
16703 } else {
16704 form
16705 };
16706 let form = if let Some(message_effect_id) = self.message_effect_id {
16707 form.text("message_effect_id", message_effect_id.to_string())
16708 } else {
16709 form
16710 };
16711 let v: ChatHandle = self.chat_id.into();
16712 let form = form.text("chat_id", v.to_string());
16713 form
16714 }
16715}
16716impl<'a, V: Into<ChatHandle> + Serialize> SendVideoOpts<'a, V> {
16717 #[allow(clippy::let_and_return, dead_code)]
16718 fn get_form(self, form: Form) -> Form {
16719 let form = if let Some(caption_entities) = self.caption_entities {
16720 form.text("caption_entities", caption_entities)
16721 } else {
16722 form
16723 };
16724 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
16725 form.text("suggested_post_parameters", suggested_post_parameters)
16726 } else {
16727 form
16728 };
16729 let form = if let Some(reply_parameters) = self.reply_parameters {
16730 form.text("reply_parameters", reply_parameters)
16731 } else {
16732 form
16733 };
16734 let form = if let Some(reply_markup) = self.reply_markup {
16735 form.text("reply_markup", reply_markup)
16736 } else {
16737 form
16738 };
16739 let form = if let Some(business_connection_id) = self.business_connection_id {
16740 form.text("business_connection_id", business_connection_id.to_string())
16741 } else {
16742 form
16743 };
16744 let form = if let Some(message_thread_id) = self.message_thread_id {
16745 form.text("message_thread_id", message_thread_id.to_string())
16746 } else {
16747 form
16748 };
16749 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
16750 form.text(
16751 "direct_messages_topic_id",
16752 direct_messages_topic_id.to_string(),
16753 )
16754 } else {
16755 form
16756 };
16757 let form = form.text("video", self.video.to_string());
16758 let form = if let Some(duration) = self.duration {
16759 form.text("duration", duration.to_string())
16760 } else {
16761 form
16762 };
16763 let form = if let Some(width) = self.width {
16764 form.text("width", width.to_string())
16765 } else {
16766 form
16767 };
16768 let form = if let Some(height) = self.height {
16769 form.text("height", height.to_string())
16770 } else {
16771 form
16772 };
16773 let form = if let Some(thumbnail) = self.thumbnail {
16774 form.text("thumbnail", thumbnail.to_string())
16775 } else {
16776 form
16777 };
16778 let form = if let Some(cover) = self.cover {
16779 form.text("cover", cover.to_string())
16780 } else {
16781 form
16782 };
16783 let form = if let Some(start_timestamp) = self.start_timestamp {
16784 form.text("start_timestamp", start_timestamp.to_string())
16785 } else {
16786 form
16787 };
16788 let form = if let Some(caption) = self.caption {
16789 form.text("caption", caption.to_string())
16790 } else {
16791 form
16792 };
16793 let form = if let Some(parse_mode) = self.parse_mode {
16794 form.text("parse_mode", parse_mode.to_string())
16795 } else {
16796 form
16797 };
16798 let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
16799 form.text(
16800 "show_caption_above_media",
16801 show_caption_above_media.to_string(),
16802 )
16803 } else {
16804 form
16805 };
16806 let form = if let Some(has_spoiler) = self.has_spoiler {
16807 form.text("has_spoiler", has_spoiler.to_string())
16808 } else {
16809 form
16810 };
16811 let form = if let Some(supports_streaming) = self.supports_streaming {
16812 form.text("supports_streaming", supports_streaming.to_string())
16813 } else {
16814 form
16815 };
16816 let form = if let Some(disable_notification) = self.disable_notification {
16817 form.text("disable_notification", disable_notification.to_string())
16818 } else {
16819 form
16820 };
16821 let form = if let Some(protect_content) = self.protect_content {
16822 form.text("protect_content", protect_content.to_string())
16823 } else {
16824 form
16825 };
16826 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
16827 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
16828 } else {
16829 form
16830 };
16831 let form = if let Some(message_effect_id) = self.message_effect_id {
16832 form.text("message_effect_id", message_effect_id.to_string())
16833 } else {
16834 form
16835 };
16836 let v: ChatHandle = self.chat_id.into();
16837 let form = form.text("chat_id", v.to_string());
16838 form
16839 }
16840}
16841impl<V: Into<ChatHandle> + Serialize> BanChatSenderChatOpts<V> {
16842 #[allow(clippy::let_and_return, dead_code)]
16843 fn get_form(self, form: Form) -> Form {
16844 let form = form.text("sender_chat_id", self.sender_chat_id.to_string());
16845 let v: ChatHandle = self.chat_id.into();
16846 let form = form.text("chat_id", v.to_string());
16847 form
16848 }
16849}
16850impl<V: Into<ChatHandle> + Serialize> GetChatAdministratorsOpts<V> {
16851 #[allow(clippy::let_and_return, dead_code)]
16852 fn get_form(self, form: Form) -> Form {
16853 let v: ChatHandle = self.chat_id.into();
16854 let form = form.text("chat_id", v.to_string());
16855 form
16856 }
16857}
16858impl<V: Into<ChatHandle> + Serialize> DeleteForumTopicOpts<V> {
16859 #[allow(clippy::let_and_return, dead_code)]
16860 fn get_form(self, form: Form) -> Form {
16861 let form = form.text("message_thread_id", self.message_thread_id.to_string());
16862 let v: ChatHandle = self.chat_id.into();
16863 let form = form.text("chat_id", v.to_string());
16864 form
16865 }
16866}
16867impl<'a> GetBusinessConnectionOpts<'a> {
16868 #[allow(clippy::let_and_return, dead_code)]
16869 fn get_form(self, form: Form) -> Form {
16870 let form = form.text(
16871 "business_connection_id",
16872 self.business_connection_id.to_string(),
16873 );
16874 form
16875 }
16876}
16877impl<'a> SetBusinessAccountNameOpts<'a> {
16878 #[allow(clippy::let_and_return, dead_code)]
16879 fn get_form(self, form: Form) -> Form {
16880 let form = form.text(
16881 "business_connection_id",
16882 self.business_connection_id.to_string(),
16883 );
16884 let form = form.text("first_name", self.first_name.to_string());
16885 let form = if let Some(last_name) = self.last_name {
16886 form.text("last_name", last_name.to_string())
16887 } else {
16888 form
16889 };
16890 form
16891 }
16892}
16893impl<'a> SetBusinessAccountGiftSettingsOpts<'a> {
16894 #[allow(clippy::let_and_return, dead_code)]
16895 fn get_form(self, form: Form) -> Form {
16896 let form = form.text("accepted_gift_types", self.accepted_gift_types);
16897 let form = form.text(
16898 "business_connection_id",
16899 self.business_connection_id.to_string(),
16900 );
16901 let form = form.text("show_gift_button", self.show_gift_button.to_string());
16902 form
16903 }
16904}
16905impl<'a, V: Into<ChatHandle> + Serialize> StopMessageLiveLocationOpts<'a, V> {
16906 #[allow(clippy::let_and_return, dead_code)]
16907 fn get_form(self, form: Form) -> Form {
16908 let form = if let Some(reply_markup) = self.reply_markup {
16909 form.text("reply_markup", reply_markup)
16910 } else {
16911 form
16912 };
16913 let form = if let Some(business_connection_id) = self.business_connection_id {
16914 form.text("business_connection_id", business_connection_id.to_string())
16915 } else {
16916 form
16917 };
16918 let form = if let Some(message_id) = self.message_id {
16919 form.text("message_id", message_id.to_string())
16920 } else {
16921 form
16922 };
16923 let form = if let Some(inline_message_id) = self.inline_message_id {
16924 form.text("inline_message_id", inline_message_id.to_string())
16925 } else {
16926 form
16927 };
16928 let form = if let Some(chat_id) = self.chat_id {
16929 let v: ChatHandle = chat_id.into();
16930 form.text("chat_id", v.to_string())
16931 } else {
16932 form
16933 };
16934 form
16935 }
16936}
16937impl<'a, V: Into<ChatHandle> + Serialize> SendPollOpts<'a, V> {
16938 #[allow(clippy::let_and_return, dead_code)]
16939 fn get_form(self, form: Form) -> Form {
16940 let form = if let Some(question_entities) = self.question_entities {
16941 form.text("question_entities", question_entities)
16942 } else {
16943 form
16944 };
16945 let form = form.text("options", self.options);
16946 let form = if let Some(explanation_entities) = self.explanation_entities {
16947 form.text("explanation_entities", explanation_entities)
16948 } else {
16949 form
16950 };
16951 let form = if let Some(reply_parameters) = self.reply_parameters {
16952 form.text("reply_parameters", reply_parameters)
16953 } else {
16954 form
16955 };
16956 let form = if let Some(reply_markup) = self.reply_markup {
16957 form.text("reply_markup", reply_markup)
16958 } else {
16959 form
16960 };
16961 let form = if let Some(business_connection_id) = self.business_connection_id {
16962 form.text("business_connection_id", business_connection_id.to_string())
16963 } else {
16964 form
16965 };
16966 let form = if let Some(message_thread_id) = self.message_thread_id {
16967 form.text("message_thread_id", message_thread_id.to_string())
16968 } else {
16969 form
16970 };
16971 let form = form.text("question", self.question.to_string());
16972 let form = if let Some(question_parse_mode) = self.question_parse_mode {
16973 form.text("question_parse_mode", question_parse_mode.to_string())
16974 } else {
16975 form
16976 };
16977 let form = if let Some(is_anonymous) = self.is_anonymous {
16978 form.text("is_anonymous", is_anonymous.to_string())
16979 } else {
16980 form
16981 };
16982 let form = if let Some(tg_type) = self.tg_type {
16983 form.text("tg_type", tg_type.to_string())
16984 } else {
16985 form
16986 };
16987 let form = if let Some(allows_multiple_answers) = self.allows_multiple_answers {
16988 form.text(
16989 "allows_multiple_answers",
16990 allows_multiple_answers.to_string(),
16991 )
16992 } else {
16993 form
16994 };
16995 let form = if let Some(correct_option_id) = self.correct_option_id {
16996 form.text("correct_option_id", correct_option_id.to_string())
16997 } else {
16998 form
16999 };
17000 let form = if let Some(explanation) = self.explanation {
17001 form.text("explanation", explanation.to_string())
17002 } else {
17003 form
17004 };
17005 let form = if let Some(explanation_parse_mode) = self.explanation_parse_mode {
17006 form.text("explanation_parse_mode", explanation_parse_mode.to_string())
17007 } else {
17008 form
17009 };
17010 let form = if let Some(open_period) = self.open_period {
17011 form.text("open_period", open_period.to_string())
17012 } else {
17013 form
17014 };
17015 let form = if let Some(close_date) = self.close_date {
17016 form.text("close_date", close_date.to_string())
17017 } else {
17018 form
17019 };
17020 let form = if let Some(is_closed) = self.is_closed {
17021 form.text("is_closed", is_closed.to_string())
17022 } else {
17023 form
17024 };
17025 let form = if let Some(disable_notification) = self.disable_notification {
17026 form.text("disable_notification", disable_notification.to_string())
17027 } else {
17028 form
17029 };
17030 let form = if let Some(protect_content) = self.protect_content {
17031 form.text("protect_content", protect_content.to_string())
17032 } else {
17033 form
17034 };
17035 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
17036 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
17037 } else {
17038 form
17039 };
17040 let form = if let Some(message_effect_id) = self.message_effect_id {
17041 form.text("message_effect_id", message_effect_id.to_string())
17042 } else {
17043 form
17044 };
17045 let v: ChatHandle = self.chat_id.into();
17046 let form = form.text("chat_id", v.to_string());
17047 form
17048 }
17049}
17050impl<'a> AnswerCallbackQueryOpts<'a> {
17051 #[allow(clippy::let_and_return, dead_code)]
17052 fn get_form(self, form: Form) -> Form {
17053 let form = form.text("callback_query_id", self.callback_query_id.to_string());
17054 let form = if let Some(text) = self.text {
17055 form.text("text", text.to_string())
17056 } else {
17057 form
17058 };
17059 let form = if let Some(show_alert) = self.show_alert {
17060 form.text("show_alert", show_alert.to_string())
17061 } else {
17062 form
17063 };
17064 let form = if let Some(url) = self.url {
17065 form.text("url", url.to_string())
17066 } else {
17067 form
17068 };
17069 let form = if let Some(cache_time) = self.cache_time {
17070 form.text("cache_time", cache_time.to_string())
17071 } else {
17072 form
17073 };
17074 form
17075 }
17076}
17077impl<V: Into<ChatHandle> + Serialize> ForwardMessageOpts<V> {
17078 #[allow(clippy::let_and_return, dead_code)]
17079 fn get_form(self, form: Form) -> Form {
17080 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
17081 form.text("suggested_post_parameters", suggested_post_parameters)
17082 } else {
17083 form
17084 };
17085 let form = if let Some(message_thread_id) = self.message_thread_id {
17086 form.text("message_thread_id", message_thread_id.to_string())
17087 } else {
17088 form
17089 };
17090 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
17091 form.text(
17092 "direct_messages_topic_id",
17093 direct_messages_topic_id.to_string(),
17094 )
17095 } else {
17096 form
17097 };
17098 let form = if let Some(video_start_timestamp) = self.video_start_timestamp {
17099 form.text("video_start_timestamp", video_start_timestamp.to_string())
17100 } else {
17101 form
17102 };
17103 let form = if let Some(disable_notification) = self.disable_notification {
17104 form.text("disable_notification", disable_notification.to_string())
17105 } else {
17106 form
17107 };
17108 let form = if let Some(protect_content) = self.protect_content {
17109 form.text("protect_content", protect_content.to_string())
17110 } else {
17111 form
17112 };
17113 let form = form.text("message_id", self.message_id.to_string());
17114 let v: ChatHandle = self.chat_id.into();
17115 let form = form.text("chat_id", v.to_string());
17116 let v: ChatHandle = self.from_chat_id.into();
17117 let form = form.text("from_chat_id", v.to_string());
17118 form
17119 }
17120}
17121impl<'a, V: Into<ChatHandle> + Serialize> RevokeChatInviteLinkOpts<'a, V> {
17122 #[allow(clippy::let_and_return, dead_code)]
17123 fn get_form(self, form: Form) -> Form {
17124 let form = form.text("invite_link", self.invite_link.to_string());
17125 let v: ChatHandle = self.chat_id.into();
17126 let form = form.text("chat_id", v.to_string());
17127 form
17128 }
17129}
17130impl<'a, V: Into<ChatHandle> + Serialize> StopPollOpts<'a, V> {
17131 #[allow(clippy::let_and_return, dead_code)]
17132 fn get_form(self, form: Form) -> Form {
17133 let form = if let Some(reply_markup) = self.reply_markup {
17134 form.text("reply_markup", reply_markup)
17135 } else {
17136 form
17137 };
17138 let form = if let Some(business_connection_id) = self.business_connection_id {
17139 form.text("business_connection_id", business_connection_id.to_string())
17140 } else {
17141 form
17142 };
17143 let form = form.text("message_id", self.message_id.to_string());
17144 let v: ChatHandle = self.chat_id.into();
17145 let form = form.text("chat_id", v.to_string());
17146 form
17147 }
17148}
17149impl<V: Into<ChatHandle> + Serialize> UnhideGeneralForumTopicOpts<V> {
17150 #[allow(clippy::let_and_return, dead_code)]
17151 fn get_form(self, form: Form) -> Form {
17152 let v: ChatHandle = self.chat_id.into();
17153 let form = form.text("chat_id", v.to_string());
17154 form
17155 }
17156}
17157impl<'a> UploadStickerFileOpts<'a> {
17158 #[allow(clippy::let_and_return, dead_code)]
17159 fn get_form(self, form: Form) -> Form {
17160 let form = form.text("sticker", self.sticker);
17161 let form = form.text("user_id", self.user_id.to_string());
17162 let form = form.text("sticker_format", self.sticker_format.to_string());
17163 form
17164 }
17165}
17166impl<'a> SetStickerKeywordsOpts<'a> {
17167 #[allow(clippy::let_and_return, dead_code)]
17168 fn get_form(self, form: Form) -> Form {
17169 let form = if let Some(keywords) = self.keywords {
17170 form.text("keywords", keywords)
17171 } else {
17172 form
17173 };
17174 let form = form.text("sticker", self.sticker.to_string());
17175 form
17176 }
17177}
17178impl SetChatMenuButtonOpts {
17179 #[allow(clippy::let_and_return, dead_code)]
17180 fn get_form(self, form: Form) -> Form {
17181 let form = if let Some(menu_button) = self.menu_button {
17182 form.text("menu_button", menu_button)
17183 } else {
17184 form
17185 };
17186 let form = if let Some(chat_id) = self.chat_id {
17187 form.text("chat_id", chat_id.to_string())
17188 } else {
17189 form
17190 };
17191 form
17192 }
17193}
17194impl<'a> EditStoryOpts<'a> {
17195 #[allow(clippy::let_and_return, dead_code)]
17196 fn get_form(self, form: Form) -> Form {
17197 let form = form.text("content", self.content);
17198 let form = if let Some(caption_entities) = self.caption_entities {
17199 form.text("caption_entities", caption_entities)
17200 } else {
17201 form
17202 };
17203 let form = if let Some(areas) = self.areas {
17204 form.text("areas", areas)
17205 } else {
17206 form
17207 };
17208 let form = form.text(
17209 "business_connection_id",
17210 self.business_connection_id.to_string(),
17211 );
17212 let form = form.text("story_id", self.story_id.to_string());
17213 let form = if let Some(caption) = self.caption {
17214 form.text("caption", caption.to_string())
17215 } else {
17216 form
17217 };
17218 let form = if let Some(parse_mode) = self.parse_mode {
17219 form.text("parse_mode", parse_mode.to_string())
17220 } else {
17221 form
17222 };
17223 form
17224 }
17225}
17226impl<'a, V: Into<ChatHandle> + Serialize> SendDocumentOpts<'a, V> {
17227 #[allow(clippy::let_and_return, dead_code)]
17228 fn get_form(self, form: Form) -> Form {
17229 let form = if let Some(caption_entities) = self.caption_entities {
17230 form.text("caption_entities", caption_entities)
17231 } else {
17232 form
17233 };
17234 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
17235 form.text("suggested_post_parameters", suggested_post_parameters)
17236 } else {
17237 form
17238 };
17239 let form = if let Some(reply_parameters) = self.reply_parameters {
17240 form.text("reply_parameters", reply_parameters)
17241 } else {
17242 form
17243 };
17244 let form = if let Some(reply_markup) = self.reply_markup {
17245 form.text("reply_markup", reply_markup)
17246 } else {
17247 form
17248 };
17249 let form = if let Some(business_connection_id) = self.business_connection_id {
17250 form.text("business_connection_id", business_connection_id.to_string())
17251 } else {
17252 form
17253 };
17254 let form = if let Some(message_thread_id) = self.message_thread_id {
17255 form.text("message_thread_id", message_thread_id.to_string())
17256 } else {
17257 form
17258 };
17259 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
17260 form.text(
17261 "direct_messages_topic_id",
17262 direct_messages_topic_id.to_string(),
17263 )
17264 } else {
17265 form
17266 };
17267 let form = form.text("document", self.document.to_string());
17268 let form = if let Some(thumbnail) = self.thumbnail {
17269 form.text("thumbnail", thumbnail.to_string())
17270 } else {
17271 form
17272 };
17273 let form = if let Some(caption) = self.caption {
17274 form.text("caption", caption.to_string())
17275 } else {
17276 form
17277 };
17278 let form = if let Some(parse_mode) = self.parse_mode {
17279 form.text("parse_mode", parse_mode.to_string())
17280 } else {
17281 form
17282 };
17283 let form = if let Some(disable_content_type_detection) = self.disable_content_type_detection
17284 {
17285 form.text(
17286 "disable_content_type_detection",
17287 disable_content_type_detection.to_string(),
17288 )
17289 } else {
17290 form
17291 };
17292 let form = if let Some(disable_notification) = self.disable_notification {
17293 form.text("disable_notification", disable_notification.to_string())
17294 } else {
17295 form
17296 };
17297 let form = if let Some(protect_content) = self.protect_content {
17298 form.text("protect_content", protect_content.to_string())
17299 } else {
17300 form
17301 };
17302 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
17303 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
17304 } else {
17305 form
17306 };
17307 let form = if let Some(message_effect_id) = self.message_effect_id {
17308 form.text("message_effect_id", message_effect_id.to_string())
17309 } else {
17310 form
17311 };
17312 let v: ChatHandle = self.chat_id.into();
17313 let form = form.text("chat_id", v.to_string());
17314 form
17315 }
17316}
17317impl<'a, V: Into<ChatHandle> + Serialize> SendVenueOpts<'a, V> {
17318 #[allow(clippy::let_and_return, dead_code)]
17319 fn get_form(self, form: Form) -> Form {
17320 let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
17321 form.text("suggested_post_parameters", suggested_post_parameters)
17322 } else {
17323 form
17324 };
17325 let form = if let Some(reply_parameters) = self.reply_parameters {
17326 form.text("reply_parameters", reply_parameters)
17327 } else {
17328 form
17329 };
17330 let form = if let Some(reply_markup) = self.reply_markup {
17331 form.text("reply_markup", reply_markup)
17332 } else {
17333 form
17334 };
17335 let form = if let Some(business_connection_id) = self.business_connection_id {
17336 form.text("business_connection_id", business_connection_id.to_string())
17337 } else {
17338 form
17339 };
17340 let form = if let Some(message_thread_id) = self.message_thread_id {
17341 form.text("message_thread_id", message_thread_id.to_string())
17342 } else {
17343 form
17344 };
17345 let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
17346 form.text(
17347 "direct_messages_topic_id",
17348 direct_messages_topic_id.to_string(),
17349 )
17350 } else {
17351 form
17352 };
17353 let form = form.text("latitude", self.latitude.to_string());
17354 let form = form.text("longitude", self.longitude.to_string());
17355 let form = form.text("title", self.title.to_string());
17356 let form = form.text("address", self.address.to_string());
17357 let form = if let Some(foursquare_id) = self.foursquare_id {
17358 form.text("foursquare_id", foursquare_id.to_string())
17359 } else {
17360 form
17361 };
17362 let form = if let Some(foursquare_type) = self.foursquare_type {
17363 form.text("foursquare_type", foursquare_type.to_string())
17364 } else {
17365 form
17366 };
17367 let form = if let Some(google_place_id) = self.google_place_id {
17368 form.text("google_place_id", google_place_id.to_string())
17369 } else {
17370 form
17371 };
17372 let form = if let Some(google_place_type) = self.google_place_type {
17373 form.text("google_place_type", google_place_type.to_string())
17374 } else {
17375 form
17376 };
17377 let form = if let Some(disable_notification) = self.disable_notification {
17378 form.text("disable_notification", disable_notification.to_string())
17379 } else {
17380 form
17381 };
17382 let form = if let Some(protect_content) = self.protect_content {
17383 form.text("protect_content", protect_content.to_string())
17384 } else {
17385 form
17386 };
17387 let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
17388 form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
17389 } else {
17390 form
17391 };
17392 let form = if let Some(message_effect_id) = self.message_effect_id {
17393 form.text("message_effect_id", message_effect_id.to_string())
17394 } else {
17395 form
17396 };
17397 let v: ChatHandle = self.chat_id.into();
17398 let form = form.text("chat_id", v.to_string());
17399 form
17400 }
17401}
17402impl<'a, V: Into<ChatHandle> + Serialize> CreateForumTopicOpts<'a, V> {
17403 #[allow(clippy::let_and_return, dead_code)]
17404 fn get_form(self, form: Form) -> Form {
17405 let form = form.text("name", self.name.to_string());
17406 let form = if let Some(icon_color) = self.icon_color {
17407 form.text("icon_color", icon_color.to_string())
17408 } else {
17409 form
17410 };
17411 let form = if let Some(icon_custom_emoji_id) = self.icon_custom_emoji_id {
17412 form.text("icon_custom_emoji_id", icon_custom_emoji_id.to_string())
17413 } else {
17414 form
17415 };
17416 let v: ChatHandle = self.chat_id.into();
17417 let form = form.text("chat_id", v.to_string());
17418 form
17419 }
17420}
17421impl RemoveUserVerificationOpts {
17422 #[allow(clippy::let_and_return, dead_code)]
17423 fn get_form(self, form: Form) -> Form {
17424 let form = form.text("user_id", self.user_id.to_string());
17425 form
17426 }
17427}
17428impl<V: Into<ChatHandle> + Serialize> RestrictChatMemberOpts<V> {
17429 #[allow(clippy::let_and_return, dead_code)]
17430 fn get_form(self, form: Form) -> Form {
17431 let form = form.text("permissions", self.permissions);
17432 let form = form.text("user_id", self.user_id.to_string());
17433 let form =
17434 if let Some(use_independent_chat_permissions) = self.use_independent_chat_permissions {
17435 form.text(
17436 "use_independent_chat_permissions",
17437 use_independent_chat_permissions.to_string(),
17438 )
17439 } else {
17440 form
17441 };
17442 let form = if let Some(until_date) = self.until_date {
17443 form.text("until_date", until_date.to_string())
17444 } else {
17445 form
17446 };
17447 let v: ChatHandle = self.chat_id.into();
17448 let form = form.text("chat_id", v.to_string());
17449 form
17450 }
17451}
17452impl Bot {
17453 #[allow(clippy::too_many_arguments)]
17454 #[allow(rustdoc::invalid_html_tags)]
17455 #[doc = "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
17456 pub async fn edit_message_reply_markup<'a, V: Into<ChatHandle> + Serialize>(
17457 &self,
17458 business_connection_id: Option<&'a str>,
17459 chat_id: Option<V>,
17460 message_id: Option<i64>,
17461 inline_message_id: Option<&'a str>,
17462 reply_markup: Option<&'a InlineKeyboardMarkup>,
17463 ) -> BotResult<MessageBool> {
17464 let form = EditMessageReplyMarkupOpts {
17465 business_connection_id,
17466 chat_id,
17467 message_id,
17468 inline_message_id,
17469 reply_markup: if let Some(reply_markup) = reply_markup {
17470 Some(serde_json::to_string(&reply_markup)?)
17471 } else {
17472 None
17473 },
17474 };
17475 let resp = self.post("editMessageReplyMarkup", form).await?;
17476 if resp.ok {
17477 let res = resp.result.unwrap_or_default();
17478 let resp = serde_json::from_value(res)?;
17479 Ok(resp)
17480 } else {
17481 Err(ApiError::from_response(resp))
17482 }
17483 }
17484 #[allow(clippy::too_many_arguments)]
17485 #[allow(rustdoc::invalid_html_tags)]
17486 #[doc = "Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
17487 pub async fn post_story<'a>(
17488 &self,
17489 business_connection_id: &'a str,
17490 content: &'a InputStoryContent,
17491 active_period: i64,
17492 caption: Option<&'a str>,
17493 parse_mode: Option<&'a str>,
17494 caption_entities: Option<&'a Vec<MessageEntity>>,
17495 areas: Option<&'a Vec<StoryArea>>,
17496 post_to_chat_page: Option<bool>,
17497 protect_content: Option<bool>,
17498 ) -> BotResult<Story> {
17499 let form = PostStoryOpts {
17500 business_connection_id,
17501 content: serde_json::to_string(&content)?,
17502 active_period,
17503 caption,
17504 parse_mode,
17505 caption_entities: if let Some(caption_entities) = caption_entities {
17506 Some(serde_json::to_string(&caption_entities)?)
17507 } else {
17508 None
17509 },
17510 areas: if let Some(areas) = areas {
17511 Some(serde_json::to_string(&areas)?)
17512 } else {
17513 None
17514 },
17515 post_to_chat_page,
17516 protect_content,
17517 };
17518 let resp = self.post("postStory", form).await?;
17519 if resp.ok {
17520 let res = resp.result.unwrap_or_default();
17521 let resp = serde_json::from_value(res)?;
17522 Ok(resp)
17523 } else {
17524 Err(ApiError::from_response(resp))
17525 }
17526 }
17527 #[allow(clippy::too_many_arguments)]
17528 #[allow(rustdoc::invalid_html_tags)]
17529 #[doc = "Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success."]
17530 pub async fn unban_chat_sender_chat<'a, V: Into<ChatHandle> + Serialize>(
17531 &self,
17532 chat_id: V,
17533 sender_chat_id: i64,
17534 ) -> BotResult<bool> {
17535 let form = UnbanChatSenderChatOpts {
17536 chat_id,
17537 sender_chat_id,
17538 };
17539 let resp = self.post("unbanChatSenderChat", form).await?;
17540 if resp.ok {
17541 let res = resp.result.unwrap_or_default();
17542 let resp = serde_json::from_value(res)?;
17543 Ok(resp)
17544 } else {
17545 Err(ApiError::from_response(resp))
17546 }
17547 }
17548 #[allow(clippy::too_many_arguments)]
17549 #[allow(rustdoc::invalid_html_tags)]
17550 #[doc = "A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object."]
17551 pub async fn get_me<'a>(&self) -> BotResult<User> {
17552 let resp = self.post_empty("getMe").await?;
17553 if resp.ok {
17554 let res = resp.result.unwrap_or_default();
17555 let resp = serde_json::from_value(res)?;
17556 Ok(resp)
17557 } else {
17558 Err(ApiError::from_response(resp))
17559 }
17560 }
17561 #[allow(clippy::too_many_arguments)]
17562 #[allow(rustdoc::invalid_html_tags)]
17563 #[doc = "Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success."]
17564 pub async fn export_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
17565 &self,
17566 chat_id: V,
17567 ) -> BotResult<String> {
17568 let form = ExportChatInviteLinkOpts { chat_id };
17569 let resp = self.post("exportChatInviteLink", form).await?;
17570 if resp.ok {
17571 let res = resp.result.unwrap_or_default();
17572 let resp = serde_json::from_value(res)?;
17573 Ok(resp)
17574 } else {
17575 Err(ApiError::from_response(resp))
17576 }
17577 }
17578 #[allow(clippy::too_many_arguments)]
17579 #[allow(rustdoc::invalid_html_tags)]
17580 #[doc = "Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success."]
17581 pub async fn get_chat_member<'a, V: Into<ChatHandle> + Serialize>(
17582 &self,
17583 chat_id: V,
17584 user_id: i64,
17585 ) -> BotResult<ChatMember> {
17586 let form = GetChatMemberOpts { chat_id, user_id };
17587 let resp = self.post("getChatMember", form).await?;
17588 if resp.ok {
17589 let res = resp.result.unwrap_or_default();
17590 let resp = serde_json::from_value(res)?;
17591 Ok(resp)
17592 } else {
17593 Err(ApiError::from_response(resp))
17594 }
17595 }
17596 #[allow(clippy::too_many_arguments)]
17597 #[allow(rustdoc::invalid_html_tags)]
17598 #[doc = "Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success."]
17599 pub async fn set_custom_emoji_sticker_set_thumbnail<'a>(
17600 &self,
17601 name: &'a str,
17602 custom_emoji_id: Option<&'a str>,
17603 ) -> BotResult<bool> {
17604 let form = SetCustomEmojiStickerSetThumbnailOpts {
17605 name,
17606 custom_emoji_id,
17607 };
17608 let resp = self.post("setCustomEmojiStickerSetThumbnail", form).await?;
17609 if resp.ok {
17610 let res = resp.result.unwrap_or_default();
17611 let resp = serde_json::from_value(res)?;
17612 Ok(resp)
17613 } else {
17614 Err(ApiError::from_response(resp))
17615 }
17616 }
17617 #[allow(clippy::too_many_arguments)]
17618 #[allow(rustdoc::invalid_html_tags)]
17619 #[doc = "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success."]
17620 pub async fn set_user_emoji_status<'a>(
17621 &self,
17622 user_id: i64,
17623 emoji_status_custom_emoji_id: Option<&'a str>,
17624 emoji_status_expiration_date: Option<i64>,
17625 ) -> BotResult<bool> {
17626 let form = SetUserEmojiStatusOpts {
17627 user_id,
17628 emoji_status_custom_emoji_id,
17629 emoji_status_expiration_date,
17630 };
17631 let resp = self.post("setUserEmojiStatus", form).await?;
17632 if resp.ok {
17633 let res = resp.result.unwrap_or_default();
17634 let resp = serde_json::from_value(res)?;
17635 Ok(resp)
17636 } else {
17637 Err(ApiError::from_response(resp))
17638 }
17639 }
17640 #[allow(clippy::too_many_arguments)]
17641 #[allow(rustdoc::invalid_html_tags)]
17642 #[doc = "Use this method to send phone contacts. On success, the sent Message is returned."]
17643 pub async fn send_contact<'a, V: Into<ChatHandle> + Serialize>(
17644 &self,
17645 business_connection_id: Option<&'a str>,
17646 chat_id: V,
17647 message_thread_id: Option<i64>,
17648 direct_messages_topic_id: Option<i64>,
17649 phone_number: &'a str,
17650 first_name: &'a str,
17651 last_name: Option<&'a str>,
17652 vcard: Option<&'a str>,
17653 disable_notification: Option<bool>,
17654 protect_content: Option<bool>,
17655 allow_paid_broadcast: Option<bool>,
17656 message_effect_id: Option<&'a str>,
17657 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
17658 reply_parameters: Option<&'a ReplyParameters>,
17659 reply_markup: Option<&'a EReplyMarkup>,
17660 ) -> BotResult<Message> {
17661 let form = SendContactOpts {
17662 business_connection_id,
17663 chat_id,
17664 message_thread_id,
17665 direct_messages_topic_id,
17666 phone_number,
17667 first_name,
17668 last_name,
17669 vcard,
17670 disable_notification,
17671 protect_content,
17672 allow_paid_broadcast,
17673 message_effect_id,
17674 suggested_post_parameters: if let Some(suggested_post_parameters) =
17675 suggested_post_parameters
17676 {
17677 Some(serde_json::to_string(&suggested_post_parameters)?)
17678 } else {
17679 None
17680 },
17681 reply_parameters: if let Some(reply_parameters) = reply_parameters {
17682 Some(serde_json::to_string(&reply_parameters)?)
17683 } else {
17684 None
17685 },
17686 reply_markup: if let Some(reply_markup) = reply_markup {
17687 Some(serde_json::to_string(&reply_markup)?)
17688 } else {
17689 None
17690 },
17691 };
17692 let resp = self.post("sendContact", form).await?;
17693 if resp.ok {
17694 let res = resp.result.unwrap_or_default();
17695 let resp = serde_json::from_value(res)?;
17696 Ok(resp)
17697 } else {
17698 Err(ApiError::from_response(resp))
17699 }
17700 }
17701 #[allow(clippy::too_many_arguments)]
17702 #[allow(rustdoc::invalid_html_tags)]
17703 #[doc = "Use this method to send text messages. On success, the sent Message is returned."]
17704 pub async fn send_message<'a, V: Into<ChatHandle> + Serialize>(
17705 &self,
17706 business_connection_id: Option<&'a str>,
17707 chat_id: V,
17708 message_thread_id: Option<i64>,
17709 direct_messages_topic_id: Option<i64>,
17710 text: &'a str,
17711 parse_mode: Option<&'a str>,
17712 entities: Option<&'a Vec<MessageEntity>>,
17713 link_preview_options: Option<&'a LinkPreviewOptions>,
17714 disable_notification: Option<bool>,
17715 protect_content: Option<bool>,
17716 allow_paid_broadcast: Option<bool>,
17717 message_effect_id: Option<&'a str>,
17718 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
17719 reply_parameters: Option<&'a ReplyParameters>,
17720 reply_markup: Option<&'a EReplyMarkup>,
17721 ) -> BotResult<Message> {
17722 let form = SendMessageOpts {
17723 business_connection_id,
17724 chat_id,
17725 message_thread_id,
17726 direct_messages_topic_id,
17727 text,
17728 parse_mode,
17729 entities: if let Some(entities) = entities {
17730 Some(serde_json::to_string(&entities)?)
17731 } else {
17732 None
17733 },
17734 link_preview_options: if let Some(link_preview_options) = link_preview_options {
17735 Some(serde_json::to_string(&link_preview_options)?)
17736 } else {
17737 None
17738 },
17739 disable_notification,
17740 protect_content,
17741 allow_paid_broadcast,
17742 message_effect_id,
17743 suggested_post_parameters: if let Some(suggested_post_parameters) =
17744 suggested_post_parameters
17745 {
17746 Some(serde_json::to_string(&suggested_post_parameters)?)
17747 } else {
17748 None
17749 },
17750 reply_parameters: if let Some(reply_parameters) = reply_parameters {
17751 Some(serde_json::to_string(&reply_parameters)?)
17752 } else {
17753 None
17754 },
17755 reply_markup: if let Some(reply_markup) = reply_markup {
17756 Some(serde_json::to_string(&reply_markup)?)
17757 } else {
17758 None
17759 },
17760 };
17761 let resp = self.post("sendMessage", form).await?;
17762 if resp.ok {
17763 let res = resp.result.unwrap_or_default();
17764 let resp = serde_json::from_value(res)?;
17765 Ok(resp)
17766 } else {
17767 Err(ApiError::from_response(resp))
17768 }
17769 }
17770 #[allow(clippy::too_many_arguments)]
17771 #[allow(rustdoc::invalid_html_tags)]
17772 #[doc = "Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
17773 pub async fn ban_chat_member<'a, V: Into<ChatHandle> + Serialize>(
17774 &self,
17775 chat_id: V,
17776 user_id: i64,
17777 until_date: Option<i64>,
17778 revoke_messages: Option<bool>,
17779 ) -> BotResult<bool> {
17780 let form = BanChatMemberOpts {
17781 chat_id,
17782 user_id,
17783 until_date,
17784 revoke_messages,
17785 };
17786 let resp = self.post("banChatMember", form).await?;
17787 if resp.ok {
17788 let res = resp.result.unwrap_or_default();
17789 let resp = serde_json::from_value(res)?;
17790 Ok(resp)
17791 } else {
17792 Err(ApiError::from_response(resp))
17793 }
17794 }
17795 #[allow(clippy::too_many_arguments)]
17796 #[allow(rustdoc::invalid_html_tags)]
17797 #[doc = "Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object."]
17798 pub async fn edit_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
17799 &self,
17800 chat_id: V,
17801 invite_link: &'a str,
17802 name: Option<&'a str>,
17803 expire_date: Option<i64>,
17804 member_limit: Option<i64>,
17805 creates_join_request: Option<bool>,
17806 ) -> BotResult<ChatInviteLink> {
17807 let form = EditChatInviteLinkOpts {
17808 chat_id,
17809 invite_link,
17810 name,
17811 expire_date,
17812 member_limit,
17813 creates_join_request,
17814 };
17815 let resp = self.post("editChatInviteLink", form).await?;
17816 if resp.ok {
17817 let res = resp.result.unwrap_or_default();
17818 let resp = serde_json::from_value(res)?;
17819 Ok(resp)
17820 } else {
17821 Err(ApiError::from_response(resp))
17822 }
17823 }
17824 #[allow(clippy::too_many_arguments)]
17825 #[allow(rustdoc::invalid_html_tags)]
17826 #[doc = "Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success."]
17827 pub async fn unpin_chat_message<'a, V: Into<ChatHandle> + Serialize>(
17828 &self,
17829 business_connection_id: Option<&'a str>,
17830 chat_id: V,
17831 message_id: Option<i64>,
17832 ) -> BotResult<bool> {
17833 let form = UnpinChatMessageOpts {
17834 business_connection_id,
17835 chat_id,
17836 message_id,
17837 };
17838 let resp = self.post("unpinChatMessage", form).await?;
17839 if resp.ok {
17840 let res = resp.result.unwrap_or_default();
17841 let resp = serde_json::from_value(res)?;
17842 Ok(resp)
17843 } else {
17844 Err(ApiError::from_response(resp))
17845 }
17846 }
17847 #[allow(clippy::too_many_arguments)]
17848 #[allow(rustdoc::invalid_html_tags)]
17849 #[doc = "Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed."]
17850 pub async fn answer_inline_query<'a>(
17851 &self,
17852 inline_query_id: &'a str,
17853 results: &'a Vec<InlineQueryResult>,
17854 cache_time: Option<i64>,
17855 is_personal: Option<bool>,
17856 next_offset: Option<&'a str>,
17857 button: Option<&'a InlineQueryResultsButton>,
17858 ) -> BotResult<bool> {
17859 let form = AnswerInlineQueryOpts {
17860 inline_query_id,
17861 results: serde_json::to_string(&results)?,
17862 cache_time,
17863 is_personal,
17864 next_offset,
17865 button: if let Some(button) = button {
17866 Some(serde_json::to_string(&button)?)
17867 } else {
17868 None
17869 },
17870 };
17871 let resp = self.post("answerInlineQuery", form).await?;
17872 if resp.ok {
17873 let res = resp.result.unwrap_or_default();
17874 let resp = serde_json::from_value(res)?;
17875 Ok(resp)
17876 } else {
17877 Err(ApiError::from_response(resp))
17878 }
17879 }
17880 #[allow(clippy::too_many_arguments)]
17881 #[allow(rustdoc::invalid_html_tags)]
17882 #[doc = "Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received."]
17883 pub async fn get_file<'a>(&self, file_id: &'a str) -> BotResult<File> {
17884 let form = GetFileOpts { file_id };
17885 let resp = self.post("getFile", form).await?;
17886 if resp.ok {
17887 let res = resp.result.unwrap_or_default();
17888 let resp = serde_json::from_value(res)?;
17889 Ok(resp)
17890 } else {
17891 Err(ApiError::from_response(resp))
17892 }
17893 }
17894 #[allow(clippy::too_many_arguments)]
17895 #[allow(rustdoc::invalid_html_tags)]
17896 #[doc = "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object."]
17897 pub async fn get_star_transactions<'a>(
17898 &self,
17899 offset: Option<i64>,
17900 limit: Option<i64>,
17901 ) -> BotResult<StarTransactions> {
17902 let form = GetStarTransactionsOpts { offset, limit };
17903 let resp = self.post("getStarTransactions", form).await?;
17904 if resp.ok {
17905 let res = resp.result.unwrap_or_default();
17906 let resp = serde_json::from_value(res)?;
17907 Ok(resp)
17908 } else {
17909 Err(ApiError::from_response(resp))
17910 }
17911 }
17912 #[allow(clippy::too_many_arguments)]
17913 #[allow(rustdoc::invalid_html_tags)]
17914 #[doc = "Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned."]
17915 pub async fn forward_messages<'a, V: Into<ChatHandle> + Serialize>(
17916 &self,
17917 chat_id: V,
17918 message_thread_id: Option<i64>,
17919 direct_messages_topic_id: Option<i64>,
17920 from_chat_id: V,
17921 message_ids: &'a Vec<i64>,
17922 disable_notification: Option<bool>,
17923 protect_content: Option<bool>,
17924 ) -> BotResult<Vec<MessageId>> {
17925 let form = ForwardMessagesOpts {
17926 chat_id,
17927 message_thread_id,
17928 direct_messages_topic_id,
17929 from_chat_id,
17930 message_ids: serde_json::to_string(&message_ids)?,
17931 disable_notification,
17932 protect_content,
17933 };
17934 let resp = self.post("forwardMessages", form).await?;
17935 if resp.ok {
17936 let res = resp.result.unwrap_or_default();
17937 let resp = serde_json::from_value(res)?;
17938 Ok(resp)
17939 } else {
17940 Err(ApiError::from_response(resp))
17941 }
17942 }
17943 #[allow(clippy::too_many_arguments)]
17944 #[allow(rustdoc::invalid_html_tags)]
17945 #[doc = "Use this method to get a sticker set. On success, a StickerSet object is returned."]
17946 pub async fn get_sticker_set<'a>(&self, name: &'a str) -> BotResult<StickerSet> {
17947 let form = GetStickerSetOpts { name };
17948 let resp = self.post("getStickerSet", form).await?;
17949 if resp.ok {
17950 let res = resp.result.unwrap_or_default();
17951 let resp = serde_json::from_value(res)?;
17952 Ok(resp)
17953 } else {
17954 Err(ApiError::from_response(resp))
17955 }
17956 }
17957 #[allow(clippy::too_many_arguments)]
17958 #[allow(rustdoc::invalid_html_tags)]
17959 #[doc = "Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects."]
17960 pub async fn get_forum_topic_icon_stickers<'a>(&self) -> BotResult<Vec<Sticker>> {
17961 let resp = self.post_empty("getForumTopicIconStickers").await?;
17962 if resp.ok {
17963 let res = resp.result.unwrap_or_default();
17964 let resp = serde_json::from_value(res)?;
17965 Ok(resp)
17966 } else {
17967 Err(ApiError::from_response(resp))
17968 }
17969 }
17970 #[allow(clippy::too_many_arguments)]
17971 #[allow(rustdoc::invalid_html_tags)]
17972 #[doc = "Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success."]
17973 pub async fn transfer_gift<'a>(
17974 &self,
17975 business_connection_id: &'a str,
17976 owned_gift_id: &'a str,
17977 new_owner_chat_id: i64,
17978 star_count: Option<i64>,
17979 ) -> BotResult<bool> {
17980 let form = TransferGiftOpts {
17981 business_connection_id,
17982 owned_gift_id,
17983 new_owner_chat_id,
17984 star_count,
17985 };
17986 let resp = self.post("transferGift", form).await?;
17987 if resp.ok {
17988 let res = resp.result.unwrap_or_default();
17989 let resp = serde_json::from_value(res)?;
17990 Ok(resp)
17991 } else {
17992 Err(ApiError::from_response(resp))
17993 }
17994 }
17995 #[allow(clippy::too_many_arguments)]
17996 #[allow(rustdoc::invalid_html_tags)]
17997 #[doc = "Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success."]
17998 pub async fn delete_messages<'a, V: Into<ChatHandle> + Serialize>(
17999 &self,
18000 chat_id: V,
18001 message_ids: &'a Vec<i64>,
18002 ) -> BotResult<bool> {
18003 let form = DeleteMessagesOpts {
18004 chat_id,
18005 message_ids: serde_json::to_string(&message_ids)?,
18006 };
18007 let resp = self.post("deleteMessages", form).await?;
18008 if resp.ok {
18009 let res = resp.result.unwrap_or_default();
18010 let resp = serde_json::from_value(res)?;
18011 Ok(resp)
18012 } else {
18013 Err(ApiError::from_response(resp))
18014 }
18015 }
18016 #[allow(clippy::too_many_arguments)]
18017 #[allow(rustdoc::invalid_html_tags)]
18018 #[doc = "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success."]
18019 pub async fn reopen_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
18020 &self,
18021 chat_id: V,
18022 ) -> BotResult<bool> {
18023 let form = ReopenGeneralForumTopicOpts { chat_id };
18024 let resp = self.post("reopenGeneralForumTopic", form).await?;
18025 if resp.ok {
18026 let res = resp.result.unwrap_or_default();
18027 let resp = serde_json::from_value(res)?;
18028 Ok(resp)
18029 } else {
18030 Err(ApiError::from_response(resp))
18031 }
18032 }
18033 #[allow(clippy::too_many_arguments)]
18034 #[allow(rustdoc::invalid_html_tags)]
18035 #[doc = "Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned."]
18036 pub async fn send_checklist<'a>(
18037 &self,
18038 business_connection_id: &'a str,
18039 chat_id: i64,
18040 checklist: &'a InputChecklist,
18041 disable_notification: Option<bool>,
18042 protect_content: Option<bool>,
18043 message_effect_id: Option<&'a str>,
18044 reply_parameters: Option<&'a ReplyParameters>,
18045 reply_markup: Option<&'a InlineKeyboardMarkup>,
18046 ) -> BotResult<Message> {
18047 let form = SendChecklistOpts {
18048 business_connection_id,
18049 chat_id,
18050 checklist: serde_json::to_string(&checklist)?,
18051 disable_notification,
18052 protect_content,
18053 message_effect_id,
18054 reply_parameters: if let Some(reply_parameters) = reply_parameters {
18055 Some(serde_json::to_string(&reply_parameters)?)
18056 } else {
18057 None
18058 },
18059 reply_markup: if let Some(reply_markup) = reply_markup {
18060 Some(serde_json::to_string(&reply_markup)?)
18061 } else {
18062 None
18063 },
18064 };
18065 let resp = self.post("sendChecklist", form).await?;
18066 if resp.ok {
18067 let res = resp.result.unwrap_or_default();
18068 let resp = serde_json::from_value(res)?;
18069 Ok(resp)
18070 } else {
18071 Err(ApiError::from_response(resp))
18072 }
18073 }
18074 #[allow(clippy::too_many_arguments)]
18075 #[allow(rustdoc::invalid_html_tags)]
18076 #[doc = "Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
18077 pub async fn delete_chat_photo<'a, V: Into<ChatHandle> + Serialize>(
18078 &self,
18079 chat_id: V,
18080 ) -> BotResult<bool> {
18081 let form = DeleteChatPhotoOpts { chat_id };
18082 let resp = self.post("deleteChatPhoto", form).await?;
18083 if resp.ok {
18084 let res = resp.result.unwrap_or_default();
18085 let resp = serde_json::from_value(res)?;
18086 Ok(resp)
18087 } else {
18088 Err(ApiError::from_response(resp))
18089 }
18090 }
18091 #[allow(clippy::too_many_arguments)]
18092 #[allow(rustdoc::invalid_html_tags)]
18093 #[doc = "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success."]
18094 pub async fn verify_user<'a>(
18095 &self,
18096 user_id: i64,
18097 custom_description: Option<&'a str>,
18098 ) -> BotResult<bool> {
18099 let form = VerifyUserOpts {
18100 user_id,
18101 custom_description,
18102 };
18103 let resp = self.post("verifyUser", form).await?;
18104 if resp.ok {
18105 let res = resp.result.unwrap_or_default();
18106 let resp = serde_json::from_value(res)?;
18107 Ok(resp)
18108 } else {
18109 Err(ApiError::from_response(resp))
18110 }
18111 }
18112 #[allow(clippy::too_many_arguments)]
18113 #[allow(rustdoc::invalid_html_tags)]
18114 #[doc = "Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
18115 pub async fn approve_chat_join_request<'a, V: Into<ChatHandle> + Serialize>(
18116 &self,
18117 chat_id: V,
18118 user_id: i64,
18119 ) -> BotResult<bool> {
18120 let form = ApproveChatJoinRequestOpts { chat_id, user_id };
18121 let resp = self.post("approveChatJoinRequest", form).await?;
18122 if resp.ok {
18123 let res = resp.result.unwrap_or_default();
18124 let resp = serde_json::from_value(res)?;
18125 Ok(resp)
18126 } else {
18127 Err(ApiError::from_response(resp))
18128 }
18129 }
18130 #[allow(clippy::too_many_arguments)]
18131 #[allow(rustdoc::invalid_html_tags)]
18132 #[doc = "Use this method to send invoices. On success, the sent Message is returned."]
18133 pub async fn send_invoice<'a, V: Into<ChatHandle> + Serialize>(
18134 &self,
18135 chat_id: V,
18136 message_thread_id: Option<i64>,
18137 direct_messages_topic_id: Option<i64>,
18138 title: &'a str,
18139 description: &'a str,
18140 payload: &'a str,
18141 provider_token: Option<&'a str>,
18142 currency: &'a str,
18143 prices: &'a Vec<LabeledPrice>,
18144 max_tip_amount: Option<i64>,
18145 suggested_tip_amounts: Option<&'a Vec<i64>>,
18146 start_parameter: Option<&'a str>,
18147 provider_data: Option<&'a str>,
18148 photo_url: Option<&'a str>,
18149 photo_size: Option<i64>,
18150 photo_width: Option<i64>,
18151 photo_height: Option<i64>,
18152 need_name: Option<bool>,
18153 need_phone_number: Option<bool>,
18154 need_email: Option<bool>,
18155 need_shipping_address: Option<bool>,
18156 send_phone_number_to_provider: Option<bool>,
18157 send_email_to_provider: Option<bool>,
18158 is_flexible: Option<bool>,
18159 disable_notification: Option<bool>,
18160 protect_content: Option<bool>,
18161 allow_paid_broadcast: Option<bool>,
18162 message_effect_id: Option<&'a str>,
18163 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
18164 reply_parameters: Option<&'a ReplyParameters>,
18165 reply_markup: Option<&'a InlineKeyboardMarkup>,
18166 ) -> BotResult<Message> {
18167 let form = SendInvoiceOpts {
18168 chat_id,
18169 message_thread_id,
18170 direct_messages_topic_id,
18171 title,
18172 description,
18173 payload,
18174 provider_token,
18175 currency,
18176 prices: serde_json::to_string(&prices)?,
18177 max_tip_amount,
18178 suggested_tip_amounts: if let Some(suggested_tip_amounts) = suggested_tip_amounts {
18179 Some(serde_json::to_string(&suggested_tip_amounts)?)
18180 } else {
18181 None
18182 },
18183 start_parameter,
18184 provider_data,
18185 photo_url,
18186 photo_size,
18187 photo_width,
18188 photo_height,
18189 need_name,
18190 need_phone_number,
18191 need_email,
18192 need_shipping_address,
18193 send_phone_number_to_provider,
18194 send_email_to_provider,
18195 is_flexible,
18196 disable_notification,
18197 protect_content,
18198 allow_paid_broadcast,
18199 message_effect_id,
18200 suggested_post_parameters: if let Some(suggested_post_parameters) =
18201 suggested_post_parameters
18202 {
18203 Some(serde_json::to_string(&suggested_post_parameters)?)
18204 } else {
18205 None
18206 },
18207 reply_parameters: if let Some(reply_parameters) = reply_parameters {
18208 Some(serde_json::to_string(&reply_parameters)?)
18209 } else {
18210 None
18211 },
18212 reply_markup: if let Some(reply_markup) = reply_markup {
18213 Some(serde_json::to_string(&reply_markup)?)
18214 } else {
18215 None
18216 },
18217 };
18218 let resp = self.post("sendInvoice", form).await?;
18219 if resp.ok {
18220 let res = resp.result.unwrap_or_default();
18221 let resp = serde_json::from_value(res)?;
18222 Ok(resp)
18223 } else {
18224 Err(ApiError::from_response(resp))
18225 }
18226 }
18227 #[allow(clippy::too_many_arguments)]
18228 #[allow(rustdoc::invalid_html_tags)]
18229 #[doc = "Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
18230 pub async fn close_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
18231 &self,
18232 chat_id: V,
18233 message_thread_id: i64,
18234 ) -> BotResult<bool> {
18235 let form = CloseForumTopicOpts {
18236 chat_id,
18237 message_thread_id,
18238 };
18239 let resp = self.post("closeForumTopic", form).await?;
18240 if resp.ok {
18241 let res = resp.result.unwrap_or_default();
18242 let resp = serde_json::from_value(res)?;
18243 Ok(resp)
18244 } else {
18245 Err(ApiError::from_response(resp))
18246 }
18247 }
18248 #[allow(clippy::too_many_arguments)]
18249 #[allow(rustdoc::invalid_html_tags)]
18250 #[doc = "Refunds a successful payment in Telegram Stars. Returns True on success."]
18251 pub async fn refund_star_payment<'a>(
18252 &self,
18253 user_id: i64,
18254 telegram_payment_charge_id: &'a str,
18255 ) -> BotResult<bool> {
18256 let form = RefundStarPaymentOpts {
18257 user_id,
18258 telegram_payment_charge_id,
18259 };
18260 let resp = self.post("refundStarPayment", form).await?;
18261 if resp.ok {
18262 let res = resp.result.unwrap_or_default();
18263 let resp = serde_json::from_value(res)?;
18264 Ok(resp)
18265 } else {
18266 Err(ApiError::from_response(resp))
18267 }
18268 }
18269 #[allow(clippy::too_many_arguments)]
18270 #[allow(rustdoc::invalid_html_tags)]
18271 #[doc = "Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects."]
18272 pub async fn get_updates<'a>(
18273 &self,
18274 offset: Option<i64>,
18275 limit: Option<i64>,
18276 timeout: Option<i64>,
18277 allowed_updates: Option<&'a Vec<String>>,
18278 ) -> BotResult<Vec<Update>> {
18279 let form = GetUpdatesOpts {
18280 offset,
18281 limit,
18282 timeout,
18283 allowed_updates: if let Some(allowed_updates) = allowed_updates {
18284 Some(serde_json::to_string(&allowed_updates)?)
18285 } else {
18286 None
18287 },
18288 };
18289 let resp = self.post("getUpdates", form).await?;
18290 if resp.ok {
18291 let res = resp.result.unwrap_or_default();
18292 let resp = serde_json::from_value(res)?;
18293 Ok(resp)
18294 } else {
18295 Err(ApiError::from_response(resp))
18296 }
18297 }
18298 #[allow(clippy::too_many_arguments)]
18299 #[allow(rustdoc::invalid_html_tags)]
18300 #[doc = "Use this method to send paid media. On success, the sent Message is returned."]
18301 pub async fn send_paid_media<'a, V: Into<ChatHandle> + Serialize>(
18302 &self,
18303 business_connection_id: Option<&'a str>,
18304 chat_id: V,
18305 message_thread_id: Option<i64>,
18306 direct_messages_topic_id: Option<i64>,
18307 star_count: i64,
18308 media: &'a Vec<InputPaidMedia>,
18309 payload: Option<&'a str>,
18310 caption: Option<&'a str>,
18311 parse_mode: Option<&'a str>,
18312 caption_entities: Option<&'a Vec<MessageEntity>>,
18313 show_caption_above_media: Option<bool>,
18314 disable_notification: Option<bool>,
18315 protect_content: Option<bool>,
18316 allow_paid_broadcast: Option<bool>,
18317 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
18318 reply_parameters: Option<&'a ReplyParameters>,
18319 reply_markup: Option<&'a EReplyMarkup>,
18320 ) -> BotResult<Message> {
18321 let form = SendPaidMediaOpts {
18322 business_connection_id,
18323 chat_id,
18324 message_thread_id,
18325 direct_messages_topic_id,
18326 star_count,
18327 media: serde_json::to_string(&media)?,
18328 payload,
18329 caption,
18330 parse_mode,
18331 caption_entities: if let Some(caption_entities) = caption_entities {
18332 Some(serde_json::to_string(&caption_entities)?)
18333 } else {
18334 None
18335 },
18336 show_caption_above_media,
18337 disable_notification,
18338 protect_content,
18339 allow_paid_broadcast,
18340 suggested_post_parameters: if let Some(suggested_post_parameters) =
18341 suggested_post_parameters
18342 {
18343 Some(serde_json::to_string(&suggested_post_parameters)?)
18344 } else {
18345 None
18346 },
18347 reply_parameters: if let Some(reply_parameters) = reply_parameters {
18348 Some(serde_json::to_string(&reply_parameters)?)
18349 } else {
18350 None
18351 },
18352 reply_markup: if let Some(reply_markup) = reply_markup {
18353 Some(serde_json::to_string(&reply_markup)?)
18354 } else {
18355 None
18356 },
18357 };
18358 let resp = self.post("sendPaidMedia", form).await?;
18359 if resp.ok {
18360 let res = resp.result.unwrap_or_default();
18361 let resp = serde_json::from_value(res)?;
18362 Ok(resp)
18363 } else {
18364 Err(ApiError::from_response(resp))
18365 }
18366 }
18367 #[allow(clippy::too_many_arguments)]
18368 #[allow(rustdoc::invalid_html_tags)]
18369 #[doc = "Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
18370 pub async fn reopen_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
18371 &self,
18372 chat_id: V,
18373 message_thread_id: i64,
18374 ) -> BotResult<bool> {
18375 let form = ReopenForumTopicOpts {
18376 chat_id,
18377 message_thread_id,
18378 };
18379 let resp = self.post("reopenForumTopic", form).await?;
18380 if resp.ok {
18381 let res = resp.result.unwrap_or_default();
18382 let resp = serde_json::from_value(res)?;
18383 Ok(resp)
18384 } else {
18385 Err(ApiError::from_response(resp))
18386 }
18387 }
18388 #[allow(clippy::too_many_arguments)]
18389 #[allow(rustdoc::invalid_html_tags)]
18390 #[doc = "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned."]
18391 pub async fn edit_message_live_location<'a, V: Into<ChatHandle> + Serialize>(
18392 &self,
18393 business_connection_id: Option<&'a str>,
18394 chat_id: Option<V>,
18395 message_id: Option<i64>,
18396 inline_message_id: Option<&'a str>,
18397 latitude: ::ordered_float::OrderedFloat<f64>,
18398 longitude: ::ordered_float::OrderedFloat<f64>,
18399 live_period: Option<i64>,
18400 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
18401 heading: Option<i64>,
18402 proximity_alert_radius: Option<i64>,
18403 reply_markup: Option<&'a InlineKeyboardMarkup>,
18404 ) -> BotResult<MessageBool> {
18405 let form = EditMessageLiveLocationOpts {
18406 business_connection_id,
18407 chat_id,
18408 message_id,
18409 inline_message_id,
18410 latitude,
18411 longitude,
18412 live_period,
18413 horizontal_accuracy,
18414 heading,
18415 proximity_alert_radius,
18416 reply_markup: if let Some(reply_markup) = reply_markup {
18417 Some(serde_json::to_string(&reply_markup)?)
18418 } else {
18419 None
18420 },
18421 };
18422 let resp = self.post("editMessageLiveLocation", form).await?;
18423 if resp.ok {
18424 let res = resp.result.unwrap_or_default();
18425 let resp = serde_json::from_value(res)?;
18426 Ok(resp)
18427 } else {
18428 Err(ApiError::from_response(resp))
18429 }
18430 }
18431 #[allow(clippy::too_many_arguments)]
18432 #[allow(rustdoc::invalid_html_tags)]
18433 #[doc = "Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned."]
18434 pub async fn edit_message_checklist<'a>(
18435 &self,
18436 business_connection_id: &'a str,
18437 chat_id: i64,
18438 message_id: i64,
18439 checklist: &'a InputChecklist,
18440 reply_markup: Option<&'a InlineKeyboardMarkup>,
18441 ) -> BotResult<Message> {
18442 let form = EditMessageChecklistOpts {
18443 business_connection_id,
18444 chat_id,
18445 message_id,
18446 checklist: serde_json::to_string(&checklist)?,
18447 reply_markup: if let Some(reply_markup) = reply_markup {
18448 Some(serde_json::to_string(&reply_markup)?)
18449 } else {
18450 None
18451 },
18452 };
18453 let resp = self.post("editMessageChecklist", form).await?;
18454 if resp.ok {
18455 let res = resp.result.unwrap_or_default();
18456 let resp = serde_json::from_value(res)?;
18457 Ok(resp)
18458 } else {
18459 Err(ApiError::from_response(resp))
18460 }
18461 }
18462 #[allow(clippy::too_many_arguments)]
18463 #[allow(rustdoc::invalid_html_tags)]
18464 #[doc = "Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success."]
18465 pub async fn set_business_account_username<'a>(
18466 &self,
18467 business_connection_id: &'a str,
18468 username: Option<&'a str>,
18469 ) -> BotResult<bool> {
18470 let form = SetBusinessAccountUsernameOpts {
18471 business_connection_id,
18472 username,
18473 };
18474 let resp = self.post("setBusinessAccountUsername", form).await?;
18475 if resp.ok {
18476 let res = resp.result.unwrap_or_default();
18477 let resp = serde_json::from_value(res)?;
18478 Ok(resp)
18479 } else {
18480 Err(ApiError::from_response(resp))
18481 }
18482 }
18483 #[allow(clippy::too_many_arguments)]
18484 #[allow(rustdoc::invalid_html_tags)]
18485 #[doc = "Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues."]
18486 pub async fn set_passport_data_errors<'a>(
18487 &self,
18488 user_id: i64,
18489 errors: &'a Vec<PassportElementError>,
18490 ) -> BotResult<bool> {
18491 let form = SetPassportDataErrorsOpts {
18492 user_id,
18493 errors: serde_json::to_string(&errors)?,
18494 };
18495 let resp = self.post("setPassportDataErrors", form).await?;
18496 if resp.ok {
18497 let res = resp.result.unwrap_or_default();
18498 let resp = serde_json::from_value(res)?;
18499 Ok(resp)
18500 } else {
18501 Err(ApiError::from_response(resp))
18502 }
18503 }
18504 #[allow(clippy::too_many_arguments)]
18505 #[allow(rustdoc::invalid_html_tags)]
18506 #[doc = "Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
18507 pub async fn remove_business_account_profile_photo<'a>(
18508 &self,
18509 business_connection_id: &'a str,
18510 is_public: Option<bool>,
18511 ) -> BotResult<bool> {
18512 let form = RemoveBusinessAccountProfilePhotoOpts {
18513 business_connection_id,
18514 is_public,
18515 };
18516 let resp = self.post("removeBusinessAccountProfilePhoto", form).await?;
18517 if resp.ok {
18518 let res = resp.result.unwrap_or_default();
18519 let resp = serde_json::from_value(res)?;
18520 Ok(resp)
18521 } else {
18522 Err(ApiError::from_response(resp))
18523 }
18524 }
18525 #[allow(clippy::too_many_arguments)]
18526 #[allow(rustdoc::invalid_html_tags)]
18527 #[doc = "Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success."]
18528 pub async fn set_message_reaction<'a, V: Into<ChatHandle> + Serialize>(
18529 &self,
18530 chat_id: V,
18531 message_id: i64,
18532 reaction: Option<&'a Vec<ReactionType>>,
18533 is_big: Option<bool>,
18534 ) -> BotResult<bool> {
18535 let form = SetMessageReactionOpts {
18536 chat_id,
18537 message_id,
18538 reaction: if let Some(reaction) = reaction {
18539 Some(serde_json::to_string(&reaction)?)
18540 } else {
18541 None
18542 },
18543 is_big,
18544 };
18545 let resp = self.post("setMessageReaction", form).await?;
18546 if resp.ok {
18547 let res = resp.result.unwrap_or_default();
18548 let resp = serde_json::from_value(res)?;
18549 Ok(resp)
18550 } else {
18551 Err(ApiError::from_response(resp))
18552 }
18553 }
18554 #[allow(clippy::too_many_arguments)]
18555 #[allow(rustdoc::invalid_html_tags)]
18556 #[doc = "Use this method to send photos. On success, the sent Message is returned."]
18557 pub async fn send_photo<'a, V: Into<ChatHandle> + Serialize>(
18558 &self,
18559 business_connection_id: Option<&'a str>,
18560 chat_id: V,
18561 message_thread_id: Option<i64>,
18562 direct_messages_topic_id: Option<i64>,
18563 photo: FileData,
18564 caption: Option<&'a str>,
18565 parse_mode: Option<&'a str>,
18566 caption_entities: Option<&'a Vec<MessageEntity>>,
18567 show_caption_above_media: Option<bool>,
18568 has_spoiler: Option<bool>,
18569 disable_notification: Option<bool>,
18570 protect_content: Option<bool>,
18571 allow_paid_broadcast: Option<bool>,
18572 message_effect_id: Option<&'a str>,
18573 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
18574 reply_parameters: Option<&'a ReplyParameters>,
18575 reply_markup: Option<&'a EReplyMarkup>,
18576 ) -> BotResult<Message> {
18577 let data = Form::new();
18578 let (data, photo_json) = photo.convert_form(data, "photo".to_owned())?;
18579 let form = SendPhotoOpts {
18580 business_connection_id,
18581 chat_id,
18582 message_thread_id,
18583 direct_messages_topic_id,
18584 photo: photo_json,
18585 caption,
18586 parse_mode,
18587 caption_entities: if let Some(caption_entities) = caption_entities {
18588 Some(serde_json::to_string(&caption_entities)?)
18589 } else {
18590 None
18591 },
18592 show_caption_above_media,
18593 has_spoiler,
18594 disable_notification,
18595 protect_content,
18596 allow_paid_broadcast,
18597 message_effect_id,
18598 suggested_post_parameters: if let Some(suggested_post_parameters) =
18599 suggested_post_parameters
18600 {
18601 Some(serde_json::to_string(&suggested_post_parameters)?)
18602 } else {
18603 None
18604 },
18605 reply_parameters: if let Some(reply_parameters) = reply_parameters {
18606 Some(serde_json::to_string(&reply_parameters)?)
18607 } else {
18608 None
18609 },
18610 reply_markup: if let Some(reply_markup) = reply_markup {
18611 Some(serde_json::to_string(&reply_markup)?)
18612 } else {
18613 None
18614 },
18615 };
18616 let resp = self.post_data("sendPhoto", form, data).await?;
18617 if resp.ok {
18618 let res = resp.result.unwrap_or_default();
18619 let resp = serde_json::from_value(res)?;
18620 Ok(resp)
18621 } else {
18622 Err(ApiError::from_response(resp))
18623 }
18624 }
18625 #[allow(clippy::too_many_arguments)]
18626 #[allow(rustdoc::invalid_html_tags)]
18627 #[doc = "Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success."]
18628 pub async fn upgrade_gift<'a>(
18629 &self,
18630 business_connection_id: &'a str,
18631 owned_gift_id: &'a str,
18632 keep_original_details: Option<bool>,
18633 star_count: Option<i64>,
18634 ) -> BotResult<bool> {
18635 let form = UpgradeGiftOpts {
18636 business_connection_id,
18637 owned_gift_id,
18638 keep_original_details,
18639 star_count,
18640 };
18641 let resp = self.post("upgradeGift", form).await?;
18642 if resp.ok {
18643 let res = resp.result.unwrap_or_default();
18644 let resp = serde_json::from_value(res)?;
18645 Ok(resp)
18646 } else {
18647 Err(ApiError::from_response(resp))
18648 }
18649 }
18650 #[allow(clippy::too_many_arguments)]
18651 #[allow(rustdoc::invalid_html_tags)]
18652 #[doc = "Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there.- If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat.Returns True on success."]
18653 pub async fn delete_message<'a, V: Into<ChatHandle> + Serialize>(
18654 &self,
18655 chat_id: V,
18656 message_id: i64,
18657 ) -> BotResult<bool> {
18658 let form = DeleteMessageOpts {
18659 chat_id,
18660 message_id,
18661 };
18662 let resp = self.post("deleteMessage", form).await?;
18663 if resp.ok {
18664 let res = resp.result.unwrap_or_default();
18665 let resp = serde_json::from_value(res)?;
18666 Ok(resp)
18667 } else {
18668 Err(ApiError::from_response(resp))
18669 }
18670 }
18671 #[allow(clippy::too_many_arguments)]
18672 #[allow(rustdoc::invalid_html_tags)]
18673 #[doc = "Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object."]
18674 pub async fn get_user_chat_boosts<'a, V: Into<ChatHandle> + Serialize>(
18675 &self,
18676 chat_id: V,
18677 user_id: i64,
18678 ) -> BotResult<UserChatBoosts> {
18679 let form = GetUserChatBoostsOpts { chat_id, user_id };
18680 let resp = self.post("getUserChatBoosts", form).await?;
18681 if resp.ok {
18682 let res = resp.result.unwrap_or_default();
18683 let resp = serde_json::from_value(res)?;
18684 Ok(resp)
18685 } else {
18686 Err(ApiError::from_response(resp))
18687 }
18688 }
18689 #[allow(clippy::too_many_arguments)]
18690 #[allow(rustdoc::invalid_html_tags)]
18691 #[doc = "Gifts a Telegram Premium subscription to the given user. Returns True on success."]
18692 pub async fn gift_premium_subscription<'a>(
18693 &self,
18694 user_id: i64,
18695 month_count: i64,
18696 star_count: i64,
18697 text: Option<&'a str>,
18698 text_parse_mode: Option<&'a str>,
18699 text_entities: Option<&'a Vec<MessageEntity>>,
18700 ) -> BotResult<bool> {
18701 let form = GiftPremiumSubscriptionOpts {
18702 user_id,
18703 month_count,
18704 star_count,
18705 text,
18706 text_parse_mode,
18707 text_entities: if let Some(text_entities) = text_entities {
18708 Some(serde_json::to_string(&text_entities)?)
18709 } else {
18710 None
18711 },
18712 };
18713 let resp = self.post("giftPremiumSubscription", form).await?;
18714 if resp.ok {
18715 let res = resp.result.unwrap_or_default();
18716 let resp = serde_json::from_value(res)?;
18717 Ok(resp)
18718 } else {
18719 Err(ApiError::from_response(resp))
18720 }
18721 }
18722 #[allow(clippy::too_many_arguments)]
18723 #[allow(rustdoc::invalid_html_tags)]
18724 #[doc = "Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters."]
18725 pub async fn log_out<'a>(&self) -> BotResult<bool> {
18726 let resp = self.post_empty("logOut").await?;
18727 if resp.ok {
18728 let res = resp.result.unwrap_or_default();
18729 let resp = serde_json::from_value(res)?;
18730 Ok(resp)
18731 } else {
18732 Err(ApiError::from_response(resp))
18733 }
18734 }
18735 #[allow(clippy::too_many_arguments)]
18736 #[allow(rustdoc::invalid_html_tags)]
18737 #[doc = "Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success."]
18738 pub async fn convert_gift_to_stars<'a>(
18739 &self,
18740 business_connection_id: &'a str,
18741 owned_gift_id: &'a str,
18742 ) -> BotResult<bool> {
18743 let form = ConvertGiftToStarsOpts {
18744 business_connection_id,
18745 owned_gift_id,
18746 };
18747 let resp = self.post("convertGiftToStars", form).await?;
18748 if resp.ok {
18749 let res = resp.result.unwrap_or_default();
18750 let resp = serde_json::from_value(res)?;
18751 Ok(resp)
18752 } else {
18753 Err(ApiError::from_response(resp))
18754 }
18755 }
18756 #[allow(clippy::too_many_arguments)]
18757 #[allow(rustdoc::invalid_html_tags)]
18758 #[doc = "Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success."]
18759 pub async fn copy_message<'a, V: Into<ChatHandle> + Serialize>(
18760 &self,
18761 chat_id: V,
18762 message_thread_id: Option<i64>,
18763 direct_messages_topic_id: Option<i64>,
18764 from_chat_id: V,
18765 message_id: i64,
18766 video_start_timestamp: Option<i64>,
18767 caption: Option<&'a str>,
18768 parse_mode: Option<&'a str>,
18769 caption_entities: Option<&'a Vec<MessageEntity>>,
18770 show_caption_above_media: Option<bool>,
18771 disable_notification: Option<bool>,
18772 protect_content: Option<bool>,
18773 allow_paid_broadcast: Option<bool>,
18774 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
18775 reply_parameters: Option<&'a ReplyParameters>,
18776 reply_markup: Option<&'a EReplyMarkup>,
18777 ) -> BotResult<MessageId> {
18778 let form = CopyMessageOpts {
18779 chat_id,
18780 message_thread_id,
18781 direct_messages_topic_id,
18782 from_chat_id,
18783 message_id,
18784 video_start_timestamp,
18785 caption,
18786 parse_mode,
18787 caption_entities: if let Some(caption_entities) = caption_entities {
18788 Some(serde_json::to_string(&caption_entities)?)
18789 } else {
18790 None
18791 },
18792 show_caption_above_media,
18793 disable_notification,
18794 protect_content,
18795 allow_paid_broadcast,
18796 suggested_post_parameters: if let Some(suggested_post_parameters) =
18797 suggested_post_parameters
18798 {
18799 Some(serde_json::to_string(&suggested_post_parameters)?)
18800 } else {
18801 None
18802 },
18803 reply_parameters: if let Some(reply_parameters) = reply_parameters {
18804 Some(serde_json::to_string(&reply_parameters)?)
18805 } else {
18806 None
18807 },
18808 reply_markup: if let Some(reply_markup) = reply_markup {
18809 Some(serde_json::to_string(&reply_markup)?)
18810 } else {
18811 None
18812 },
18813 };
18814 let resp = self.post("copyMessage", form).await?;
18815 if resp.ok {
18816 let res = resp.result.unwrap_or_default();
18817 let resp = serde_json::from_value(res)?;
18818 Ok(resp)
18819 } else {
18820 Err(ApiError::from_response(resp))
18821 }
18822 }
18823 #[allow(clippy::too_many_arguments)]
18824 #[allow(rustdoc::invalid_html_tags)]
18825 #[doc = "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
18826 pub async fn edit_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
18827 &self,
18828 chat_id: V,
18829 message_thread_id: i64,
18830 name: Option<&'a str>,
18831 icon_custom_emoji_id: Option<&'a str>,
18832 ) -> BotResult<bool> {
18833 let form = EditForumTopicOpts {
18834 chat_id,
18835 message_thread_id,
18836 name,
18837 icon_custom_emoji_id,
18838 };
18839 let resp = self.post("editForumTopic", form).await?;
18840 if resp.ok {
18841 let res = resp.result.unwrap_or_default();
18842 let resp = serde_json::from_value(res)?;
18843 Ok(resp)
18844 } else {
18845 Err(ApiError::from_response(resp))
18846 }
18847 }
18848 #[allow(clippy::too_many_arguments)]
18849 #[allow(rustdoc::invalid_html_tags)]
18850 #[doc = "Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success."]
18851 pub async fn set_business_account_bio<'a>(
18852 &self,
18853 business_connection_id: &'a str,
18854 bio: Option<&'a str>,
18855 ) -> BotResult<bool> {
18856 let form = SetBusinessAccountBioOpts {
18857 business_connection_id,
18858 bio,
18859 };
18860 let resp = self.post("setBusinessAccountBio", form).await?;
18861 if resp.ok {
18862 let res = resp.result.unwrap_or_default();
18863 let resp = serde_json::from_value(res)?;
18864 Ok(resp)
18865 } else {
18866 Err(ApiError::from_response(resp))
18867 }
18868 }
18869 #[allow(clippy::too_many_arguments)]
18870 #[allow(rustdoc::invalid_html_tags)]
18871 #[doc = "Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success."]
18872 pub async fn get_chat<'a, V: Into<ChatHandle> + Serialize>(
18873 &self,
18874 chat_id: V,
18875 ) -> BotResult<ChatFullInfo> {
18876 let form = GetChatOpts { chat_id };
18877 let resp = self.post("getChat", form).await?;
18878 if resp.ok {
18879 let res = resp.result.unwrap_or_default();
18880 let resp = serde_json::from_value(res)?;
18881 Ok(resp)
18882 } else {
18883 Err(ApiError::from_response(resp))
18884 }
18885 }
18886 #[allow(clippy::too_many_arguments)]
18887 #[allow(rustdoc::invalid_html_tags)]
18888 #[doc = "Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
18889 pub async fn edit_message_media<'a, V: Into<ChatHandle> + Serialize>(
18890 &self,
18891 business_connection_id: Option<&'a str>,
18892 chat_id: Option<V>,
18893 message_id: Option<i64>,
18894 inline_message_id: Option<&'a str>,
18895 media: &'a InputMedia,
18896 reply_markup: Option<&'a InlineKeyboardMarkup>,
18897 ) -> BotResult<MessageBool> {
18898 let form = EditMessageMediaOpts {
18899 business_connection_id,
18900 chat_id,
18901 message_id,
18902 inline_message_id,
18903 media: serde_json::to_string(&media)?,
18904 reply_markup: if let Some(reply_markup) = reply_markup {
18905 Some(serde_json::to_string(&reply_markup)?)
18906 } else {
18907 None
18908 },
18909 };
18910 let resp = self.post("editMessageMedia", form).await?;
18911 if resp.ok {
18912 let res = resp.result.unwrap_or_default();
18913 let resp = serde_json::from_value(res)?;
18914 Ok(resp)
18915 } else {
18916 Err(ApiError::from_response(resp))
18917 }
18918 }
18919 #[allow(clippy::too_many_arguments)]
18920 #[allow(rustdoc::invalid_html_tags)]
18921 #[doc = "Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False."]
18922 pub async fn set_game_score<'a>(
18923 &self,
18924 user_id: i64,
18925 score: i64,
18926 force: Option<bool>,
18927 disable_edit_message: Option<bool>,
18928 chat_id: Option<i64>,
18929 message_id: Option<i64>,
18930 inline_message_id: Option<&'a str>,
18931 ) -> BotResult<MessageBool> {
18932 let form = SetGameScoreOpts {
18933 user_id,
18934 score,
18935 force,
18936 disable_edit_message,
18937 chat_id,
18938 message_id,
18939 inline_message_id,
18940 };
18941 let resp = self.post("setGameScore", form).await?;
18942 if resp.ok {
18943 let res = resp.result.unwrap_or_default();
18944 let resp = serde_json::from_value(res)?;
18945 Ok(resp)
18946 } else {
18947 Err(ApiError::from_response(resp))
18948 }
18949 }
18950 #[allow(clippy::too_many_arguments)]
18951 #[allow(rustdoc::invalid_html_tags)]
18952 #[doc = "Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects."]
18953 pub async fn get_custom_emoji_stickers<'a>(
18954 &self,
18955 custom_emoji_ids: &'a Vec<String>,
18956 ) -> BotResult<Vec<Sticker>> {
18957 let form = GetCustomEmojiStickersOpts {
18958 custom_emoji_ids: serde_json::to_string(&custom_emoji_ids)?,
18959 };
18960 let resp = self.post("getCustomEmojiStickers", form).await?;
18961 if resp.ok {
18962 let res = resp.result.unwrap_or_default();
18963 let resp = serde_json::from_value(res)?;
18964 Ok(resp)
18965 } else {
18966 Err(ApiError::from_response(resp))
18967 }
18968 }
18969 #[allow(clippy::too_many_arguments)]
18970 #[allow(rustdoc::invalid_html_tags)]
18971 #[doc = "Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success."]
18972 pub async fn set_chat_administrator_custom_title<'a, V: Into<ChatHandle> + Serialize>(
18973 &self,
18974 chat_id: V,
18975 user_id: i64,
18976 custom_title: &'a str,
18977 ) -> BotResult<bool> {
18978 let form = SetChatAdministratorCustomTitleOpts {
18979 chat_id,
18980 user_id,
18981 custom_title,
18982 };
18983 let resp = self.post("setChatAdministratorCustomTitle", form).await?;
18984 if resp.ok {
18985 let res = resp.result.unwrap_or_default();
18986 let resp = serde_json::from_value(res)?;
18987 Ok(resp)
18988 } else {
18989 Err(ApiError::from_response(resp))
18990 }
18991 }
18992 #[allow(clippy::too_many_arguments)]
18993 #[allow(rustdoc::invalid_html_tags)]
18994 #[doc = "Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success."]
18995 pub async fn send_gift<'a, V: Into<ChatHandle> + Serialize>(
18996 &self,
18997 user_id: Option<i64>,
18998 chat_id: Option<V>,
18999 gift_id: &'a str,
19000 pay_for_upgrade: Option<bool>,
19001 text: Option<&'a str>,
19002 text_parse_mode: Option<&'a str>,
19003 text_entities: Option<&'a Vec<MessageEntity>>,
19004 ) -> BotResult<bool> {
19005 let form = SendGiftOpts {
19006 user_id,
19007 chat_id,
19008 gift_id,
19009 pay_for_upgrade,
19010 text,
19011 text_parse_mode,
19012 text_entities: if let Some(text_entities) = text_entities {
19013 Some(serde_json::to_string(&text_entities)?)
19014 } else {
19015 None
19016 },
19017 };
19018 let resp = self.post("sendGift", form).await?;
19019 if resp.ok {
19020 let res = resp.result.unwrap_or_default();
19021 let resp = serde_json::from_value(res)?;
19022 Ok(resp)
19023 } else {
19024 Err(ApiError::from_response(resp))
19025 }
19026 }
19027 #[allow(clippy::too_many_arguments)]
19028 #[allow(rustdoc::invalid_html_tags)]
19029 #[doc = "Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned."]
19030 pub async fn send_dice<'a, V: Into<ChatHandle> + Serialize>(
19031 &self,
19032 business_connection_id: Option<&'a str>,
19033 chat_id: V,
19034 message_thread_id: Option<i64>,
19035 direct_messages_topic_id: Option<i64>,
19036 emoji: Option<&'a str>,
19037 disable_notification: Option<bool>,
19038 protect_content: Option<bool>,
19039 allow_paid_broadcast: Option<bool>,
19040 message_effect_id: Option<&'a str>,
19041 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
19042 reply_parameters: Option<&'a ReplyParameters>,
19043 reply_markup: Option<&'a EReplyMarkup>,
19044 ) -> BotResult<Message> {
19045 let form = SendDiceOpts {
19046 business_connection_id,
19047 chat_id,
19048 message_thread_id,
19049 direct_messages_topic_id,
19050 emoji,
19051 disable_notification,
19052 protect_content,
19053 allow_paid_broadcast,
19054 message_effect_id,
19055 suggested_post_parameters: if let Some(suggested_post_parameters) =
19056 suggested_post_parameters
19057 {
19058 Some(serde_json::to_string(&suggested_post_parameters)?)
19059 } else {
19060 None
19061 },
19062 reply_parameters: if let Some(reply_parameters) = reply_parameters {
19063 Some(serde_json::to_string(&reply_parameters)?)
19064 } else {
19065 None
19066 },
19067 reply_markup: if let Some(reply_markup) = reply_markup {
19068 Some(serde_json::to_string(&reply_markup)?)
19069 } else {
19070 None
19071 },
19072 };
19073 let resp = self.post("sendDice", form).await?;
19074 if resp.ok {
19075 let res = resp.result.unwrap_or_default();
19076 let resp = serde_json::from_value(res)?;
19077 Ok(resp)
19078 } else {
19079 Err(ApiError::from_response(resp))
19080 }
19081 }
19082 #[allow(clippy::too_many_arguments)]
19083 #[allow(rustdoc::invalid_html_tags)]
19084 #[doc = "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
19085 pub async fn unpin_all_general_forum_topic_messages<'a, V: Into<ChatHandle> + Serialize>(
19086 &self,
19087 chat_id: V,
19088 ) -> BotResult<bool> {
19089 let form = UnpinAllGeneralForumTopicMessagesOpts { chat_id };
19090 let resp = self.post("unpinAllGeneralForumTopicMessages", form).await?;
19091 if resp.ok {
19092 let res = resp.result.unwrap_or_default();
19093 let resp = serde_json::from_value(res)?;
19094 Ok(resp)
19095 } else {
19096 Err(ApiError::from_response(resp))
19097 }
19098 }
19099 #[allow(clippy::too_many_arguments)]
19100 #[allow(rustdoc::invalid_html_tags)]
19101 #[doc = "Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned."]
19102 pub async fn get_my_commands<'a>(
19103 &self,
19104 scope: Option<&'a BotCommandScope>,
19105 language_code: Option<&'a str>,
19106 ) -> BotResult<Vec<BotCommand>> {
19107 let form = GetMyCommandsOpts {
19108 scope: if let Some(scope) = scope {
19109 Some(serde_json::to_string(&scope)?)
19110 } else {
19111 None
19112 },
19113 language_code,
19114 };
19115 let resp = self.post("getMyCommands", form).await?;
19116 if resp.ok {
19117 let res = resp.result.unwrap_or_default();
19118 let resp = serde_json::from_value(res)?;
19119 Ok(resp)
19120 } else {
19121 Err(ApiError::from_response(resp))
19122 }
19123 }
19124 #[allow(clippy::too_many_arguments)]
19125 #[allow(rustdoc::invalid_html_tags)]
19126 #[doc = "Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
19127 pub async fn set_business_account_profile_photo<'a>(
19128 &self,
19129 business_connection_id: &'a str,
19130 photo: &'a InputProfilePhoto,
19131 is_public: Option<bool>,
19132 ) -> BotResult<bool> {
19133 let form = SetBusinessAccountProfilePhotoOpts {
19134 business_connection_id,
19135 photo: serde_json::to_string(&photo)?,
19136 is_public,
19137 };
19138 let resp = self.post("setBusinessAccountProfilePhoto", form).await?;
19139 if resp.ok {
19140 let res = resp.result.unwrap_or_default();
19141 let resp = serde_json::from_value(res)?;
19142 Ok(resp)
19143 } else {
19144 Err(ApiError::from_response(resp))
19145 }
19146 }
19147 #[allow(clippy::too_many_arguments)]
19148 #[allow(rustdoc::invalid_html_tags)]
19149 #[doc = "Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object."]
19150 pub async fn create_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
19151 &self,
19152 chat_id: V,
19153 name: Option<&'a str>,
19154 expire_date: Option<i64>,
19155 member_limit: Option<i64>,
19156 creates_join_request: Option<bool>,
19157 ) -> BotResult<ChatInviteLink> {
19158 let form = CreateChatInviteLinkOpts {
19159 chat_id,
19160 name,
19161 expire_date,
19162 member_limit,
19163 creates_join_request,
19164 };
19165 let resp = self.post("createChatInviteLink", form).await?;
19166 if resp.ok {
19167 let res = resp.result.unwrap_or_default();
19168 let resp = serde_json::from_value(res)?;
19169 Ok(resp)
19170 } else {
19171 Err(ApiError::from_response(resp))
19172 }
19173 }
19174 #[allow(clippy::too_many_arguments)]
19175 #[allow(rustdoc::invalid_html_tags)]
19176 #[doc = "Use this method to delete a sticker from a set created by the bot. Returns True on success."]
19177 pub async fn delete_sticker_from_set<'a>(&self, sticker: &'a str) -> BotResult<bool> {
19178 let form = DeleteStickerFromSetOpts { sticker };
19179 let resp = self.post("deleteStickerFromSet", form).await?;
19180 if resp.ok {
19181 let res = resp.result.unwrap_or_default();
19182 let resp = serde_json::from_value(res)?;
19183 Ok(resp)
19184 } else {
19185 Err(ApiError::from_response(resp))
19186 }
19187 }
19188 #[allow(clippy::too_many_arguments)]
19189 #[allow(rustdoc::invalid_html_tags)]
19190 #[doc = "Use this method to get the current bot description for the given user language. Returns BotDescription on success."]
19191 pub async fn get_my_description<'a>(
19192 &self,
19193 language_code: Option<&'a str>,
19194 ) -> BotResult<BotDescription> {
19195 let form = GetMyDescriptionOpts { language_code };
19196 let resp = self.post("getMyDescription", form).await?;
19197 if resp.ok {
19198 let res = resp.result.unwrap_or_default();
19199 let resp = serde_json::from_value(res)?;
19200 Ok(resp)
19201 } else {
19202 Err(ApiError::from_response(resp))
19203 }
19204 }
19205 #[allow(clippy::too_many_arguments)]
19206 #[allow(rustdoc::invalid_html_tags)]
19207 #[doc = "A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object."]
19208 pub async fn get_my_star_balance<'a>(&self) -> BotResult<StarAmount> {
19209 let resp = self.post_empty("getMyStarBalance").await?;
19210 if resp.ok {
19211 let res = resp.result.unwrap_or_default();
19212 let resp = serde_json::from_value(res)?;
19213 Ok(resp)
19214 } else {
19215 Err(ApiError::from_response(resp))
19216 }
19217 }
19218 #[allow(clippy::too_many_arguments)]
19219 #[allow(rustdoc::invalid_html_tags)]
19220 #[doc = "Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned."]
19221 pub async fn send_media_group<'a, V: Into<ChatHandle> + Serialize>(
19222 &self,
19223 business_connection_id: Option<&'a str>,
19224 chat_id: V,
19225 message_thread_id: Option<i64>,
19226 direct_messages_topic_id: Option<i64>,
19227 media: &'a Vec<EMedia>,
19228 disable_notification: Option<bool>,
19229 protect_content: Option<bool>,
19230 allow_paid_broadcast: Option<bool>,
19231 message_effect_id: Option<&'a str>,
19232 reply_parameters: Option<&'a ReplyParameters>,
19233 ) -> BotResult<Vec<Message>> {
19234 let form = SendMediaGroupOpts {
19235 business_connection_id,
19236 chat_id,
19237 message_thread_id,
19238 direct_messages_topic_id,
19239 media: serde_json::to_string(&media)?,
19240 disable_notification,
19241 protect_content,
19242 allow_paid_broadcast,
19243 message_effect_id,
19244 reply_parameters: if let Some(reply_parameters) = reply_parameters {
19245 Some(serde_json::to_string(&reply_parameters)?)
19246 } else {
19247 None
19248 },
19249 };
19250 let resp = self.post("sendMediaGroup", form).await?;
19251 if resp.ok {
19252 let res = resp.result.unwrap_or_default();
19253 let resp = serde_json::from_value(res)?;
19254 Ok(resp)
19255 } else {
19256 Err(ApiError::from_response(resp))
19257 }
19258 }
19259 #[allow(clippy::too_many_arguments)]
19260 #[allow(rustdoc::invalid_html_tags)]
19261 #[doc = "Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty."]
19262 pub async fn get_webhook_info<'a>(&self) -> BotResult<WebhookInfo> {
19263 let resp = self.post_empty("getWebhookInfo").await?;
19264 if resp.ok {
19265 let res = resp.result.unwrap_or_default();
19266 let resp = serde_json::from_value(res)?;
19267 Ok(resp)
19268 } else {
19269 Err(ApiError::from_response(resp))
19270 }
19271 }
19272 #[allow(clippy::too_many_arguments)]
19273 #[allow(rustdoc::invalid_html_tags)]
19274 #[doc = "Use this method to get the number of members in a chat. Returns Int on success."]
19275 pub async fn get_chat_member_count<'a, V: Into<ChatHandle> + Serialize>(
19276 &self,
19277 chat_id: V,
19278 ) -> BotResult<i64> {
19279 let form = GetChatMemberCountOpts { chat_id };
19280 let resp = self.post("getChatMemberCount", form).await?;
19281 if resp.ok {
19282 let res = resp.result.unwrap_or_default();
19283 let resp = serde_json::from_value(res)?;
19284 Ok(resp)
19285 } else {
19286 Err(ApiError::from_response(resp))
19287 }
19288 }
19289 #[allow(clippy::too_many_arguments)]
19290 #[allow(rustdoc::invalid_html_tags)]
19291 #[doc = "Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent."]
19292 pub async fn answer_pre_checkout_query<'a>(
19293 &self,
19294 pre_checkout_query_id: &'a str,
19295 ok: bool,
19296 error_message: Option<&'a str>,
19297 ) -> BotResult<bool> {
19298 let form = AnswerPreCheckoutQueryOpts {
19299 pre_checkout_query_id,
19300 ok,
19301 error_message,
19302 };
19303 let resp = self.post("answerPreCheckoutQuery", form).await?;
19304 if resp.ok {
19305 let res = resp.result.unwrap_or_default();
19306 let resp = serde_json::from_value(res)?;
19307 Ok(resp)
19308 } else {
19309 Err(ApiError::from_response(resp))
19310 }
19311 }
19312 #[allow(clippy::too_many_arguments)]
19313 #[allow(rustdoc::invalid_html_tags)]
19314 #[doc = "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success."]
19315 pub async fn remove_chat_verification<'a, V: Into<ChatHandle> + Serialize>(
19316 &self,
19317 chat_id: V,
19318 ) -> BotResult<bool> {
19319 let form = RemoveChatVerificationOpts { chat_id };
19320 let resp = self.post("removeChatVerification", form).await?;
19321 if resp.ok {
19322 let res = resp.result.unwrap_or_default();
19323 let resp = serde_json::from_value(res)?;
19324 Ok(resp)
19325 } else {
19326 Err(ApiError::from_response(resp))
19327 }
19328 }
19329 #[allow(clippy::too_many_arguments)]
19330 #[allow(rustdoc::invalid_html_tags)]
19331 #[doc = "Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned."]
19332 pub async fn copy_messages<'a, V: Into<ChatHandle> + Serialize>(
19333 &self,
19334 chat_id: V,
19335 message_thread_id: Option<i64>,
19336 direct_messages_topic_id: Option<i64>,
19337 from_chat_id: V,
19338 message_ids: &'a Vec<i64>,
19339 disable_notification: Option<bool>,
19340 protect_content: Option<bool>,
19341 remove_caption: Option<bool>,
19342 ) -> BotResult<Vec<MessageId>> {
19343 let form = CopyMessagesOpts {
19344 chat_id,
19345 message_thread_id,
19346 direct_messages_topic_id,
19347 from_chat_id,
19348 message_ids: serde_json::to_string(&message_ids)?,
19349 disable_notification,
19350 protect_content,
19351 remove_caption,
19352 };
19353 let resp = self.post("copyMessages", form).await?;
19354 if resp.ok {
19355 let res = resp.result.unwrap_or_default();
19356 let resp = serde_json::from_value(res)?;
19357 Ok(resp)
19358 } else {
19359 Err(ApiError::from_response(resp))
19360 }
19361 }
19362 #[allow(clippy::too_many_arguments)]
19363 #[allow(rustdoc::invalid_html_tags)]
19364 #[doc = "Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success."]
19365 pub async fn set_sticker_set_thumbnail<'a>(
19366 &self,
19367 name: &'a str,
19368 user_id: i64,
19369 thumbnail: Option<FileData>,
19370 format: &'a str,
19371 ) -> BotResult<bool> {
19372 let data = Form::new();
19373 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
19374 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
19375 (data, Some(thumbnail_json))
19376 } else {
19377 (data, None)
19378 };
19379 let form = SetStickerSetThumbnailOpts {
19380 name,
19381 user_id,
19382 thumbnail: thumbnail_json,
19383 format,
19384 };
19385 let resp = self.post_data("setStickerSetThumbnail", form, data).await?;
19386 if resp.ok {
19387 let res = resp.result.unwrap_or_default();
19388 let resp = serde_json::from_value(res)?;
19389 Ok(resp)
19390 } else {
19391 Err(ApiError::from_response(resp))
19392 }
19393 }
19394 #[allow(clippy::too_many_arguments)]
19395 #[allow(rustdoc::invalid_html_tags)]
19396 #[doc = "Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success."]
19397 pub async fn delete_my_commands<'a>(
19398 &self,
19399 scope: Option<&'a BotCommandScope>,
19400 language_code: Option<&'a str>,
19401 ) -> BotResult<bool> {
19402 let form = DeleteMyCommandsOpts {
19403 scope: if let Some(scope) = scope {
19404 Some(serde_json::to_string(&scope)?)
19405 } else {
19406 None
19407 },
19408 language_code,
19409 };
19410 let resp = self.post("deleteMyCommands", form).await?;
19411 if resp.ok {
19412 let res = resp.result.unwrap_or_default();
19413 let resp = serde_json::from_value(res)?;
19414 Ok(resp)
19415 } else {
19416 Err(ApiError::from_response(resp))
19417 }
19418 }
19419 #[allow(clippy::too_many_arguments)]
19420 #[allow(rustdoc::invalid_html_tags)]
19421 #[doc = "Use this method to delete a sticker set that was created by the bot. Returns True on success."]
19422 pub async fn delete_sticker_set<'a>(&self, name: &'a str) -> BotResult<bool> {
19423 let form = DeleteStickerSetOpts { name };
19424 let resp = self.post("deleteStickerSet", form).await?;
19425 if resp.ok {
19426 let res = resp.result.unwrap_or_default();
19427 let resp = serde_json::from_value(res)?;
19428 Ok(resp)
19429 } else {
19430 Err(ApiError::from_response(resp))
19431 }
19432 }
19433 #[allow(clippy::too_many_arguments)]
19434 #[allow(rustdoc::invalid_html_tags)]
19435 #[doc = "Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
19436 pub async fn set_chat_description<'a, V: Into<ChatHandle> + Serialize>(
19437 &self,
19438 chat_id: V,
19439 description: Option<&'a str>,
19440 ) -> BotResult<bool> {
19441 let form = SetChatDescriptionOpts {
19442 chat_id,
19443 description,
19444 };
19445 let resp = self.post("setChatDescription", form).await?;
19446 if resp.ok {
19447 let res = resp.result.unwrap_or_default();
19448 let resp = serde_json::from_value(res)?;
19449 Ok(resp)
19450 } else {
19451 Err(ApiError::from_response(resp))
19452 }
19453 }
19454 #[allow(clippy::too_many_arguments)]
19455 #[allow(rustdoc::invalid_html_tags)]
19456 #[doc = "Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
19457 pub async fn set_sticker_emoji_list<'a>(
19458 &self,
19459 sticker: &'a str,
19460 emoji_list: &'a Vec<String>,
19461 ) -> BotResult<bool> {
19462 let form = SetStickerEmojiListOpts {
19463 sticker,
19464 emoji_list: serde_json::to_string(&emoji_list)?,
19465 };
19466 let resp = self.post("setStickerEmojiList", form).await?;
19467 if resp.ok {
19468 let res = resp.result.unwrap_or_default();
19469 let resp = serde_json::from_value(res)?;
19470 Ok(resp)
19471 } else {
19472 Err(ApiError::from_response(resp))
19473 }
19474 }
19475 #[allow(clippy::too_many_arguments)]
19476 #[allow(rustdoc::invalid_html_tags)]
19477 #[doc = "Use this method to send point on the map. On success, the sent Message is returned."]
19478 pub async fn send_location<'a, V: Into<ChatHandle> + Serialize>(
19479 &self,
19480 business_connection_id: Option<&'a str>,
19481 chat_id: V,
19482 message_thread_id: Option<i64>,
19483 direct_messages_topic_id: Option<i64>,
19484 latitude: ::ordered_float::OrderedFloat<f64>,
19485 longitude: ::ordered_float::OrderedFloat<f64>,
19486 horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
19487 live_period: Option<i64>,
19488 heading: Option<i64>,
19489 proximity_alert_radius: Option<i64>,
19490 disable_notification: Option<bool>,
19491 protect_content: Option<bool>,
19492 allow_paid_broadcast: Option<bool>,
19493 message_effect_id: Option<&'a str>,
19494 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
19495 reply_parameters: Option<&'a ReplyParameters>,
19496 reply_markup: Option<&'a EReplyMarkup>,
19497 ) -> BotResult<Message> {
19498 let form = SendLocationOpts {
19499 business_connection_id,
19500 chat_id,
19501 message_thread_id,
19502 direct_messages_topic_id,
19503 latitude,
19504 longitude,
19505 horizontal_accuracy,
19506 live_period,
19507 heading,
19508 proximity_alert_radius,
19509 disable_notification,
19510 protect_content,
19511 allow_paid_broadcast,
19512 message_effect_id,
19513 suggested_post_parameters: if let Some(suggested_post_parameters) =
19514 suggested_post_parameters
19515 {
19516 Some(serde_json::to_string(&suggested_post_parameters)?)
19517 } else {
19518 None
19519 },
19520 reply_parameters: if let Some(reply_parameters) = reply_parameters {
19521 Some(serde_json::to_string(&reply_parameters)?)
19522 } else {
19523 None
19524 },
19525 reply_markup: if let Some(reply_markup) = reply_markup {
19526 Some(serde_json::to_string(&reply_markup)?)
19527 } else {
19528 None
19529 },
19530 };
19531 let resp = self.post("sendLocation", form).await?;
19532 if resp.ok {
19533 let res = resp.result.unwrap_or_default();
19534 let resp = serde_json::from_value(res)?;
19535 Ok(resp)
19536 } else {
19537 Err(ApiError::from_response(resp))
19538 }
19539 }
19540 #[allow(clippy::too_many_arguments)]
19541 #[allow(rustdoc::invalid_html_tags)]
19542 #[doc = "Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
19543 pub async fn set_chat_title<'a, V: Into<ChatHandle> + Serialize>(
19544 &self,
19545 chat_id: V,
19546 title: &'a str,
19547 ) -> BotResult<bool> {
19548 let form = SetChatTitleOpts { chat_id, title };
19549 let resp = self.post("setChatTitle", form).await?;
19550 if resp.ok {
19551 let res = resp.result.unwrap_or_default();
19552 let resp = serde_json::from_value(res)?;
19553 Ok(resp)
19554 } else {
19555 Err(ApiError::from_response(resp))
19556 }
19557 }
19558 #[allow(clippy::too_many_arguments)]
19559 #[allow(rustdoc::invalid_html_tags)]
19560 #[doc = "Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success."]
19561 pub async fn replace_sticker_in_set<'a>(
19562 &self,
19563 user_id: i64,
19564 name: &'a str,
19565 old_sticker: &'a str,
19566 sticker: &'a InputSticker,
19567 ) -> BotResult<bool> {
19568 let form = ReplaceStickerInSetOpts {
19569 user_id,
19570 name,
19571 old_sticker,
19572 sticker: serde_json::to_string(&sticker)?,
19573 };
19574 let resp = self.post("replaceStickerInSet", form).await?;
19575 if resp.ok {
19576 let res = resp.result.unwrap_or_default();
19577 let resp = serde_json::from_value(res)?;
19578 Ok(resp)
19579 } else {
19580 Err(ApiError::from_response(resp))
19581 }
19582 }
19583 #[allow(clippy::too_many_arguments)]
19584 #[allow(rustdoc::invalid_html_tags)]
19585 #[doc = "Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success."]
19586 pub async fn decline_suggested_post<'a>(
19587 &self,
19588 chat_id: i64,
19589 message_id: i64,
19590 comment: Option<&'a str>,
19591 ) -> BotResult<bool> {
19592 let form = DeclineSuggestedPostOpts {
19593 chat_id,
19594 message_id,
19595 comment,
19596 };
19597 let resp = self.post("declineSuggestedPost", form).await?;
19598 if resp.ok {
19599 let res = resp.result.unwrap_or_default();
19600 let resp = serde_json::from_value(res)?;
19601 Ok(resp)
19602 } else {
19603 Err(ApiError::from_response(resp))
19604 }
19605 }
19606 #[allow(clippy::too_many_arguments)]
19607 #[allow(rustdoc::invalid_html_tags)]
19608 #[doc = "Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success."]
19609 pub async fn set_my_short_description<'a>(
19610 &self,
19611 short_description: Option<&'a str>,
19612 language_code: Option<&'a str>,
19613 ) -> BotResult<bool> {
19614 let form = SetMyShortDescriptionOpts {
19615 short_description,
19616 language_code,
19617 };
19618 let resp = self.post("setMyShortDescription", form).await?;
19619 if resp.ok {
19620 let res = resp.result.unwrap_or_default();
19621 let resp = serde_json::from_value(res)?;
19622 Ok(resp)
19623 } else {
19624 Err(ApiError::from_response(resp))
19625 }
19626 }
19627 #[allow(clippy::too_many_arguments)]
19628 #[allow(rustdoc::invalid_html_tags)]
19629 #[doc = "Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success."]
19630 pub async fn get_my_default_administrator_rights<'a>(
19631 &self,
19632 for_channels: Option<bool>,
19633 ) -> BotResult<ChatAdministratorRights> {
19634 let form = GetMyDefaultAdministratorRightsOpts { for_channels };
19635 let resp = self.post("getMyDefaultAdministratorRights", form).await?;
19636 if resp.ok {
19637 let res = resp.result.unwrap_or_default();
19638 let resp = serde_json::from_value(res)?;
19639 Ok(resp)
19640 } else {
19641 Err(ApiError::from_response(resp))
19642 }
19643 }
19644 #[allow(clippy::too_many_arguments)]
19645 #[allow(rustdoc::invalid_html_tags)]
19646 #[doc = "Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success."]
19647 pub async fn get_business_account_star_balance<'a>(
19648 &self,
19649 business_connection_id: &'a str,
19650 ) -> BotResult<StarAmount> {
19651 let form = GetBusinessAccountStarBalanceOpts {
19652 business_connection_id,
19653 };
19654 let resp = self.post("getBusinessAccountStarBalance", form).await?;
19655 if resp.ok {
19656 let res = resp.result.unwrap_or_default();
19657 let resp = serde_json::from_value(res)?;
19658 Ok(resp)
19659 } else {
19660 Err(ApiError::from_response(resp))
19661 }
19662 }
19663 #[allow(clippy::too_many_arguments)]
19664 #[allow(rustdoc::invalid_html_tags)]
19665 #[doc = "Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
19666 pub async fn delete_chat_sticker_set<'a, V: Into<ChatHandle> + Serialize>(
19667 &self,
19668 chat_id: V,
19669 ) -> BotResult<bool> {
19670 let form = DeleteChatStickerSetOpts { chat_id };
19671 let resp = self.post("deleteChatStickerSet", form).await?;
19672 if resp.ok {
19673 let res = resp.result.unwrap_or_default();
19674 let resp = serde_json::from_value(res)?;
19675 Ok(resp)
19676 } else {
19677 Err(ApiError::from_response(resp))
19678 }
19679 }
19680 #[allow(clippy::too_many_arguments)]
19681 #[allow(rustdoc::invalid_html_tags)]
19682 #[doc = "Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future."]
19683 pub async fn send_animation<'a, V: Into<ChatHandle> + Serialize>(
19684 &self,
19685 business_connection_id: Option<&'a str>,
19686 chat_id: V,
19687 message_thread_id: Option<i64>,
19688 direct_messages_topic_id: Option<i64>,
19689 animation: FileData,
19690 duration: Option<i64>,
19691 width: Option<i64>,
19692 height: Option<i64>,
19693 thumbnail: Option<FileData>,
19694 caption: Option<&'a str>,
19695 parse_mode: Option<&'a str>,
19696 caption_entities: Option<&'a Vec<MessageEntity>>,
19697 show_caption_above_media: Option<bool>,
19698 has_spoiler: Option<bool>,
19699 disable_notification: Option<bool>,
19700 protect_content: Option<bool>,
19701 allow_paid_broadcast: Option<bool>,
19702 message_effect_id: Option<&'a str>,
19703 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
19704 reply_parameters: Option<&'a ReplyParameters>,
19705 reply_markup: Option<&'a EReplyMarkup>,
19706 ) -> BotResult<Message> {
19707 let data = Form::new();
19708 let (data, animation_json) = animation.convert_form(data, "animation".to_owned())?;
19709 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
19710 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
19711 (data, Some(thumbnail_json))
19712 } else {
19713 (data, None)
19714 };
19715 let form = SendAnimationOpts {
19716 business_connection_id,
19717 chat_id,
19718 message_thread_id,
19719 direct_messages_topic_id,
19720 animation: animation_json,
19721 duration,
19722 width,
19723 height,
19724 thumbnail: thumbnail_json,
19725 caption,
19726 parse_mode,
19727 caption_entities: if let Some(caption_entities) = caption_entities {
19728 Some(serde_json::to_string(&caption_entities)?)
19729 } else {
19730 None
19731 },
19732 show_caption_above_media,
19733 has_spoiler,
19734 disable_notification,
19735 protect_content,
19736 allow_paid_broadcast,
19737 message_effect_id,
19738 suggested_post_parameters: if let Some(suggested_post_parameters) =
19739 suggested_post_parameters
19740 {
19741 Some(serde_json::to_string(&suggested_post_parameters)?)
19742 } else {
19743 None
19744 },
19745 reply_parameters: if let Some(reply_parameters) = reply_parameters {
19746 Some(serde_json::to_string(&reply_parameters)?)
19747 } else {
19748 None
19749 },
19750 reply_markup: if let Some(reply_markup) = reply_markup {
19751 Some(serde_json::to_string(&reply_markup)?)
19752 } else {
19753 None
19754 },
19755 };
19756 let resp = self.post_data("sendAnimation", form, data).await?;
19757 if resp.ok {
19758 let res = resp.result.unwrap_or_default();
19759 let resp = serde_json::from_value(res)?;
19760 Ok(resp)
19761 } else {
19762 Err(ApiError::from_response(resp))
19763 }
19764 }
19765 #[allow(clippy::too_many_arguments)]
19766 #[allow(rustdoc::invalid_html_tags)]
19767 #[doc = "Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success."]
19768 pub async fn add_sticker_to_set<'a>(
19769 &self,
19770 user_id: i64,
19771 name: &'a str,
19772 sticker: &'a InputSticker,
19773 ) -> BotResult<bool> {
19774 let form = AddStickerToSetOpts {
19775 user_id,
19776 name,
19777 sticker: serde_json::to_string(&sticker)?,
19778 };
19779 let resp = self.post("addStickerToSet", form).await?;
19780 if resp.ok {
19781 let res = resp.result.unwrap_or_default();
19782 let resp = serde_json::from_value(res)?;
19783 Ok(resp)
19784 } else {
19785 Err(ApiError::from_response(resp))
19786 }
19787 }
19788 #[allow(clippy::too_many_arguments)]
19789 #[allow(rustdoc::invalid_html_tags)]
19790 #[doc = "Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success."]
19791 pub async fn delete_webhook<'a>(&self, drop_pending_updates: Option<bool>) -> BotResult<bool> {
19792 let form = DeleteWebhookOpts {
19793 drop_pending_updates,
19794 };
19795 let resp = self.post("deleteWebhook", form).await?;
19796 if resp.ok {
19797 let res = resp.result.unwrap_or_default();
19798 let resp = serde_json::from_value(res)?;
19799 Ok(resp)
19800 } else {
19801 Err(ApiError::from_response(resp))
19802 }
19803 }
19804 #[allow(clippy::too_many_arguments)]
19805 #[allow(rustdoc::invalid_html_tags)]
19806 #[doc = "Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success."]
19807 pub async fn unpin_all_chat_messages<'a, V: Into<ChatHandle> + Serialize>(
19808 &self,
19809 chat_id: V,
19810 ) -> BotResult<bool> {
19811 let form = UnpinAllChatMessagesOpts { chat_id };
19812 let resp = self.post("unpinAllChatMessages", form).await?;
19813 if resp.ok {
19814 let res = resp.result.unwrap_or_default();
19815 let resp = serde_json::from_value(res)?;
19816 Ok(resp)
19817 } else {
19818 Err(ApiError::from_response(resp))
19819 }
19820 }
19821 #[allow(clippy::too_many_arguments)]
19822 #[allow(rustdoc::invalid_html_tags)]
19823 #[doc = "Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
19824 pub async fn decline_chat_join_request<'a, V: Into<ChatHandle> + Serialize>(
19825 &self,
19826 chat_id: V,
19827 user_id: i64,
19828 ) -> BotResult<bool> {
19829 let form = DeclineChatJoinRequestOpts { chat_id, user_id };
19830 let resp = self.post("declineChatJoinRequest", form).await?;
19831 if resp.ok {
19832 let res = resp.result.unwrap_or_default();
19833 let resp = serde_json::from_value(res)?;
19834 Ok(resp)
19835 } else {
19836 Err(ApiError::from_response(resp))
19837 }
19838 }
19839 #[allow(clippy::too_many_arguments)]
19840 #[allow(rustdoc::invalid_html_tags)]
19841 #[doc = "Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success."]
19842 pub async fn read_business_message<'a>(
19843 &self,
19844 business_connection_id: &'a str,
19845 chat_id: i64,
19846 message_id: i64,
19847 ) -> BotResult<bool> {
19848 let form = ReadBusinessMessageOpts {
19849 business_connection_id,
19850 chat_id,
19851 message_id,
19852 };
19853 let resp = self.post("readBusinessMessage", form).await?;
19854 if resp.ok {
19855 let res = resp.result.unwrap_or_default();
19856 let resp = serde_json::from_value(res)?;
19857 Ok(resp)
19858 } else {
19859 Err(ApiError::from_response(resp))
19860 }
19861 }
19862 #[allow(clippy::too_many_arguments)]
19863 #[allow(rustdoc::invalid_html_tags)]
19864 #[doc = "Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success."]
19865 pub async fn set_sticker_mask_position<'a>(
19866 &self,
19867 sticker: &'a str,
19868 mask_position: Option<&'a MaskPosition>,
19869 ) -> BotResult<bool> {
19870 let form = SetStickerMaskPositionOpts {
19871 sticker,
19872 mask_position: if let Some(mask_position) = mask_position {
19873 Some(serde_json::to_string(&mask_position)?)
19874 } else {
19875 None
19876 },
19877 };
19878 let resp = self.post("setStickerMaskPosition", form).await?;
19879 if resp.ok {
19880 let res = resp.result.unwrap_or_default();
19881 let resp = serde_json::from_value(res)?;
19882 Ok(resp)
19883 } else {
19884 Err(ApiError::from_response(resp))
19885 }
19886 }
19887 #[allow(clippy::too_many_arguments)]
19888 #[allow(rustdoc::invalid_html_tags)]
19889 #[doc = "Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success."]
19890 pub async fn set_my_default_administrator_rights<'a>(
19891 &self,
19892 rights: Option<&'a ChatAdministratorRights>,
19893 for_channels: Option<bool>,
19894 ) -> BotResult<bool> {
19895 let form = SetMyDefaultAdministratorRightsOpts {
19896 rights: if let Some(rights) = rights {
19897 Some(serde_json::to_string(&rights)?)
19898 } else {
19899 None
19900 },
19901 for_channels,
19902 };
19903 let resp = self.post("setMyDefaultAdministratorRights", form).await?;
19904 if resp.ok {
19905 let res = resp.result.unwrap_or_default();
19906 let resp = serde_json::from_value(res)?;
19907 Ok(resp)
19908 } else {
19909 Err(ApiError::from_response(resp))
19910 }
19911 }
19912 #[allow(clippy::too_many_arguments)]
19913 #[allow(rustdoc::invalid_html_tags)]
19914 #[doc = "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success."]
19915 pub async fn edit_user_star_subscription<'a>(
19916 &self,
19917 user_id: i64,
19918 telegram_payment_charge_id: &'a str,
19919 is_canceled: bool,
19920 ) -> BotResult<bool> {
19921 let form = EditUserStarSubscriptionOpts {
19922 user_id,
19923 telegram_payment_charge_id,
19924 is_canceled,
19925 };
19926 let resp = self.post("editUserStarSubscription", form).await?;
19927 if resp.ok {
19928 let res = resp.result.unwrap_or_default();
19929 let resp = serde_json::from_value(res)?;
19930 Ok(resp)
19931 } else {
19932 Err(ApiError::from_response(resp))
19933 }
19934 }
19935 #[allow(clippy::too_many_arguments)]
19936 #[allow(rustdoc::invalid_html_tags)]
19937 #[doc = "Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects."]
19938 pub async fn get_game_high_scores<'a>(
19939 &self,
19940 user_id: i64,
19941 chat_id: Option<i64>,
19942 message_id: Option<i64>,
19943 inline_message_id: Option<&'a str>,
19944 ) -> BotResult<Vec<GameHighScore>> {
19945 let form = GetGameHighScoresOpts {
19946 user_id,
19947 chat_id,
19948 message_id,
19949 inline_message_id,
19950 };
19951 let resp = self.post("getGameHighScores", form).await?;
19952 if resp.ok {
19953 let res = resp.result.unwrap_or_default();
19954 let resp = serde_json::from_value(res)?;
19955 Ok(resp)
19956 } else {
19957 Err(ApiError::from_response(resp))
19958 }
19959 }
19960 #[allow(clippy::too_many_arguments)]
19961 #[allow(rustdoc::invalid_html_tags)]
19962 #[doc = "Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive."]
19963 pub async fn send_chat_action<'a, V: Into<ChatHandle> + Serialize>(
19964 &self,
19965 business_connection_id: Option<&'a str>,
19966 chat_id: V,
19967 message_thread_id: Option<i64>,
19968 action: &'a str,
19969 ) -> BotResult<bool> {
19970 let form = SendChatActionOpts {
19971 business_connection_id,
19972 chat_id,
19973 message_thread_id,
19974 action,
19975 };
19976 let resp = self.post("sendChatAction", form).await?;
19977 if resp.ok {
19978 let res = resp.result.unwrap_or_default();
19979 let resp = serde_json::from_value(res)?;
19980 Ok(resp)
19981 } else {
19982 Err(ApiError::from_response(resp))
19983 }
19984 }
19985 #[allow(clippy::too_many_arguments)]
19986 #[allow(rustdoc::invalid_html_tags)]
19987 #[doc = "Use this method to get the current bot name for the given user language. Returns BotName on success."]
19988 pub async fn get_my_name<'a>(&self, language_code: Option<&'a str>) -> BotResult<BotName> {
19989 let form = GetMyNameOpts { language_code };
19990 let resp = self.post("getMyName", form).await?;
19991 if resp.ok {
19992 let res = resp.result.unwrap_or_default();
19993 let resp = serde_json::from_value(res)?;
19994 Ok(resp)
19995 } else {
19996 Err(ApiError::from_response(resp))
19997 }
19998 }
19999 #[allow(clippy::too_many_arguments)]
20000 #[allow(rustdoc::invalid_html_tags)]
20001 #[doc = "Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
20002 pub async fn set_chat_sticker_set<'a, V: Into<ChatHandle> + Serialize>(
20003 &self,
20004 chat_id: V,
20005 sticker_set_name: &'a str,
20006 ) -> BotResult<bool> {
20007 let form = SetChatStickerSetOpts {
20008 chat_id,
20009 sticker_set_name,
20010 };
20011 let resp = self.post("setChatStickerSet", form).await?;
20012 if resp.ok {
20013 let res = resp.result.unwrap_or_default();
20014 let resp = serde_json::from_value(res)?;
20015 Ok(resp)
20016 } else {
20017 Err(ApiError::from_response(resp))
20018 }
20019 }
20020 #[allow(clippy::too_many_arguments)]
20021 #[allow(rustdoc::invalid_html_tags)]
20022 #[doc = "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header \"X-Telegram-Bot-Api-Secret-Token\" with the secret token as content."]
20023 pub async fn set_webhook<'a>(
20024 &self,
20025 url: &'a str,
20026 certificate: Option<FileData>,
20027 ip_address: Option<&'a str>,
20028 max_connections: Option<i64>,
20029 allowed_updates: Option<&'a Vec<String>>,
20030 drop_pending_updates: Option<bool>,
20031 secret_token: Option<&'a str>,
20032 ) -> BotResult<bool> {
20033 let data = Form::new();
20034 let (data, certificate_json) = if let Some(certificate) = certificate {
20035 let (data, certificate_json) =
20036 certificate.convert_form(data, "certificate".to_owned())?;
20037 (data, Some(certificate_json))
20038 } else {
20039 (data, None)
20040 };
20041 let form = SetWebhookOpts {
20042 url,
20043 certificate: certificate_json,
20044 ip_address,
20045 max_connections,
20046 allowed_updates: if let Some(allowed_updates) = allowed_updates {
20047 Some(serde_json::to_string(&allowed_updates)?)
20048 } else {
20049 None
20050 },
20051 drop_pending_updates,
20052 secret_token,
20053 };
20054 let resp = self.post_data("setWebhook", form, data).await?;
20055 if resp.ok {
20056 let res = resp.result.unwrap_or_default();
20057 let resp = serde_json::from_value(res)?;
20058 Ok(resp)
20059 } else {
20060 Err(ApiError::from_response(resp))
20061 }
20062 }
20063 #[allow(clippy::too_many_arguments)]
20064 #[allow(rustdoc::invalid_html_tags)]
20065 #[doc = "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success."]
20066 pub async fn verify_chat<'a, V: Into<ChatHandle> + Serialize>(
20067 &self,
20068 chat_id: V,
20069 custom_description: Option<&'a str>,
20070 ) -> BotResult<bool> {
20071 let form = VerifyChatOpts {
20072 chat_id,
20073 custom_description,
20074 };
20075 let resp = self.post("verifyChat", form).await?;
20076 if resp.ok {
20077 let res = resp.result.unwrap_or_default();
20078 let resp = serde_json::from_value(res)?;
20079 Ok(resp)
20080 } else {
20081 Err(ApiError::from_response(resp))
20082 }
20083 }
20084 #[allow(clippy::too_many_arguments)]
20085 #[allow(rustdoc::invalid_html_tags)]
20086 #[doc = "Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters."]
20087 pub async fn close<'a>(&self) -> BotResult<bool> {
20088 let resp = self.post_empty("close").await?;
20089 if resp.ok {
20090 let res = resp.result.unwrap_or_default();
20091 let resp = serde_json::from_value(res)?;
20092 Ok(resp)
20093 } else {
20094 Err(ApiError::from_response(resp))
20095 }
20096 }
20097 #[allow(clippy::too_many_arguments)]
20098 #[allow(rustdoc::invalid_html_tags)]
20099 #[doc = "Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned."]
20100 pub async fn answer_web_app_query<'a>(
20101 &self,
20102 web_app_query_id: &'a str,
20103 result: &'a InlineQueryResult,
20104 ) -> BotResult<SentWebAppMessage> {
20105 let form = AnswerWebAppQueryOpts {
20106 web_app_query_id,
20107 result: serde_json::to_string(&result)?,
20108 };
20109 let resp = self.post("answerWebAppQuery", form).await?;
20110 if resp.ok {
20111 let res = resp.result.unwrap_or_default();
20112 let resp = serde_json::from_value(res)?;
20113 Ok(resp)
20114 } else {
20115 Err(ApiError::from_response(resp))
20116 }
20117 }
20118 #[allow(clippy::too_many_arguments)]
20119 #[allow(rustdoc::invalid_html_tags)]
20120 #[doc = "Use this method for your bot to leave a group, supergroup or channel. Returns True on success."]
20121 pub async fn leave_chat<'a, V: Into<ChatHandle> + Serialize>(
20122 &self,
20123 chat_id: V,
20124 ) -> BotResult<bool> {
20125 let form = LeaveChatOpts { chat_id };
20126 let resp = self.post("leaveChat", form).await?;
20127 if resp.ok {
20128 let res = resp.result.unwrap_or_default();
20129 let resp = serde_json::from_value(res)?;
20130 Ok(resp)
20131 } else {
20132 Err(ApiError::from_response(resp))
20133 }
20134 }
20135 #[allow(clippy::too_many_arguments)]
20136 #[allow(rustdoc::invalid_html_tags)]
20137 #[doc = "Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future."]
20138 pub async fn send_voice<'a, V: Into<ChatHandle> + Serialize>(
20139 &self,
20140 business_connection_id: Option<&'a str>,
20141 chat_id: V,
20142 message_thread_id: Option<i64>,
20143 direct_messages_topic_id: Option<i64>,
20144 voice: FileData,
20145 caption: Option<&'a str>,
20146 parse_mode: Option<&'a str>,
20147 caption_entities: Option<&'a Vec<MessageEntity>>,
20148 duration: Option<i64>,
20149 disable_notification: Option<bool>,
20150 protect_content: Option<bool>,
20151 allow_paid_broadcast: Option<bool>,
20152 message_effect_id: Option<&'a str>,
20153 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
20154 reply_parameters: Option<&'a ReplyParameters>,
20155 reply_markup: Option<&'a EReplyMarkup>,
20156 ) -> BotResult<Message> {
20157 let data = Form::new();
20158 let (data, voice_json) = voice.convert_form(data, "voice".to_owned())?;
20159 let form = SendVoiceOpts {
20160 business_connection_id,
20161 chat_id,
20162 message_thread_id,
20163 direct_messages_topic_id,
20164 voice: voice_json,
20165 caption,
20166 parse_mode,
20167 caption_entities: if let Some(caption_entities) = caption_entities {
20168 Some(serde_json::to_string(&caption_entities)?)
20169 } else {
20170 None
20171 },
20172 duration,
20173 disable_notification,
20174 protect_content,
20175 allow_paid_broadcast,
20176 message_effect_id,
20177 suggested_post_parameters: if let Some(suggested_post_parameters) =
20178 suggested_post_parameters
20179 {
20180 Some(serde_json::to_string(&suggested_post_parameters)?)
20181 } else {
20182 None
20183 },
20184 reply_parameters: if let Some(reply_parameters) = reply_parameters {
20185 Some(serde_json::to_string(&reply_parameters)?)
20186 } else {
20187 None
20188 },
20189 reply_markup: if let Some(reply_markup) = reply_markup {
20190 Some(serde_json::to_string(&reply_markup)?)
20191 } else {
20192 None
20193 },
20194 };
20195 let resp = self.post_data("sendVoice", form, data).await?;
20196 if resp.ok {
20197 let res = resp.result.unwrap_or_default();
20198 let resp = serde_json::from_value(res)?;
20199 Ok(resp)
20200 } else {
20201 Err(ApiError::from_response(resp))
20202 }
20203 }
20204 #[allow(clippy::too_many_arguments)]
20205 #[allow(rustdoc::invalid_html_tags)]
20206 #[doc = "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
20207 pub async fn edit_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
20208 &self,
20209 chat_id: V,
20210 name: &'a str,
20211 ) -> BotResult<bool> {
20212 let form = EditGeneralForumTopicOpts { chat_id, name };
20213 let resp = self.post("editGeneralForumTopic", form).await?;
20214 if resp.ok {
20215 let res = resp.result.unwrap_or_default();
20216 let resp = serde_json::from_value(res)?;
20217 Ok(resp)
20218 } else {
20219 Err(ApiError::from_response(resp))
20220 }
20221 }
20222 #[allow(clippy::too_many_arguments)]
20223 #[allow(rustdoc::invalid_html_tags)]
20224 #[doc = "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object."]
20225 pub async fn save_prepared_inline_message<'a>(
20226 &self,
20227 user_id: i64,
20228 result: &'a InlineQueryResult,
20229 allow_user_chats: Option<bool>,
20230 allow_bot_chats: Option<bool>,
20231 allow_group_chats: Option<bool>,
20232 allow_channel_chats: Option<bool>,
20233 ) -> BotResult<PreparedInlineMessage> {
20234 let form = SavePreparedInlineMessageOpts {
20235 user_id,
20236 result: serde_json::to_string(&result)?,
20237 allow_user_chats,
20238 allow_bot_chats,
20239 allow_group_chats,
20240 allow_channel_chats,
20241 };
20242 let resp = self.post("savePreparedInlineMessage", form).await?;
20243 if resp.ok {
20244 let res = resp.result.unwrap_or_default();
20245 let resp = serde_json::from_value(res)?;
20246 Ok(resp)
20247 } else {
20248 Err(ApiError::from_response(resp))
20249 }
20250 }
20251 #[allow(clippy::too_many_arguments)]
20252 #[allow(rustdoc::invalid_html_tags)]
20253 #[doc = "Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success."]
20254 pub async fn transfer_business_account_stars<'a>(
20255 &self,
20256 business_connection_id: &'a str,
20257 star_count: i64,
20258 ) -> BotResult<bool> {
20259 let form = TransferBusinessAccountStarsOpts {
20260 business_connection_id,
20261 star_count,
20262 };
20263 let resp = self.post("transferBusinessAccountStars", form).await?;
20264 if resp.ok {
20265 let res = resp.result.unwrap_or_default();
20266 let resp = serde_json::from_value(res)?;
20267 Ok(resp)
20268 } else {
20269 Err(ApiError::from_response(resp))
20270 }
20271 }
20272 #[allow(clippy::too_many_arguments)]
20273 #[allow(rustdoc::invalid_html_tags)]
20274 #[doc = "Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success."]
20275 pub async fn promote_chat_member<'a, V: Into<ChatHandle> + Serialize>(
20276 &self,
20277 chat_id: V,
20278 user_id: i64,
20279 is_anonymous: Option<bool>,
20280 can_manage_chat: Option<bool>,
20281 can_delete_messages: Option<bool>,
20282 can_manage_video_chats: Option<bool>,
20283 can_restrict_members: Option<bool>,
20284 can_promote_members: Option<bool>,
20285 can_change_info: Option<bool>,
20286 can_invite_users: Option<bool>,
20287 can_post_stories: Option<bool>,
20288 can_edit_stories: Option<bool>,
20289 can_delete_stories: Option<bool>,
20290 can_post_messages: Option<bool>,
20291 can_edit_messages: Option<bool>,
20292 can_pin_messages: Option<bool>,
20293 can_manage_topics: Option<bool>,
20294 can_manage_direct_messages: Option<bool>,
20295 ) -> BotResult<bool> {
20296 let form = PromoteChatMemberOpts {
20297 chat_id,
20298 user_id,
20299 is_anonymous,
20300 can_manage_chat,
20301 can_delete_messages,
20302 can_manage_video_chats,
20303 can_restrict_members,
20304 can_promote_members,
20305 can_change_info,
20306 can_invite_users,
20307 can_post_stories,
20308 can_edit_stories,
20309 can_delete_stories,
20310 can_post_messages,
20311 can_edit_messages,
20312 can_pin_messages,
20313 can_manage_topics,
20314 can_manage_direct_messages,
20315 };
20316 let resp = self.post("promoteChatMember", form).await?;
20317 if resp.ok {
20318 let res = resp.result.unwrap_or_default();
20319 let resp = serde_json::from_value(res)?;
20320 Ok(resp)
20321 } else {
20322 Err(ApiError::from_response(resp))
20323 }
20324 }
20325 #[allow(clippy::too_many_arguments)]
20326 #[allow(rustdoc::invalid_html_tags)]
20327 #[doc = "Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success."]
20328 pub async fn pin_chat_message<'a, V: Into<ChatHandle> + Serialize>(
20329 &self,
20330 business_connection_id: Option<&'a str>,
20331 chat_id: V,
20332 message_id: i64,
20333 disable_notification: Option<bool>,
20334 ) -> BotResult<bool> {
20335 let form = PinChatMessageOpts {
20336 business_connection_id,
20337 chat_id,
20338 message_id,
20339 disable_notification,
20340 };
20341 let resp = self.post("pinChatMessage", form).await?;
20342 if resp.ok {
20343 let res = resp.result.unwrap_or_default();
20344 let resp = serde_json::from_value(res)?;
20345 Ok(resp)
20346 } else {
20347 Err(ApiError::from_response(resp))
20348 }
20349 }
20350 #[allow(clippy::too_many_arguments)]
20351 #[allow(rustdoc::invalid_html_tags)]
20352 #[doc = "Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success."]
20353 pub async fn get_my_short_description<'a>(
20354 &self,
20355 language_code: Option<&'a str>,
20356 ) -> BotResult<BotShortDescription> {
20357 let form = GetMyShortDescriptionOpts { language_code };
20358 let resp = self.post("getMyShortDescription", form).await?;
20359 if resp.ok {
20360 let res = resp.result.unwrap_or_default();
20361 let resp = serde_json::from_value(res)?;
20362 Ok(resp)
20363 } else {
20364 Err(ApiError::from_response(resp))
20365 }
20366 }
20367 #[allow(clippy::too_many_arguments)]
20368 #[allow(rustdoc::invalid_html_tags)]
20369 #[doc = "Use this method to create a link for an invoice. Returns the created invoice link as String on success."]
20370 pub async fn create_invoice_link<'a>(
20371 &self,
20372 business_connection_id: Option<&'a str>,
20373 title: &'a str,
20374 description: &'a str,
20375 payload: &'a str,
20376 provider_token: Option<&'a str>,
20377 currency: &'a str,
20378 prices: &'a Vec<LabeledPrice>,
20379 subscription_period: Option<i64>,
20380 max_tip_amount: Option<i64>,
20381 suggested_tip_amounts: Option<&'a Vec<i64>>,
20382 provider_data: Option<&'a str>,
20383 photo_url: Option<&'a str>,
20384 photo_size: Option<i64>,
20385 photo_width: Option<i64>,
20386 photo_height: Option<i64>,
20387 need_name: Option<bool>,
20388 need_phone_number: Option<bool>,
20389 need_email: Option<bool>,
20390 need_shipping_address: Option<bool>,
20391 send_phone_number_to_provider: Option<bool>,
20392 send_email_to_provider: Option<bool>,
20393 is_flexible: Option<bool>,
20394 ) -> BotResult<String> {
20395 let form = CreateInvoiceLinkOpts {
20396 business_connection_id,
20397 title,
20398 description,
20399 payload,
20400 provider_token,
20401 currency,
20402 prices: serde_json::to_string(&prices)?,
20403 subscription_period,
20404 max_tip_amount,
20405 suggested_tip_amounts: if let Some(suggested_tip_amounts) = suggested_tip_amounts {
20406 Some(serde_json::to_string(&suggested_tip_amounts)?)
20407 } else {
20408 None
20409 },
20410 provider_data,
20411 photo_url,
20412 photo_size,
20413 photo_width,
20414 photo_height,
20415 need_name,
20416 need_phone_number,
20417 need_email,
20418 need_shipping_address,
20419 send_phone_number_to_provider,
20420 send_email_to_provider,
20421 is_flexible,
20422 };
20423 let resp = self.post("createInvoiceLink", form).await?;
20424 if resp.ok {
20425 let res = resp.result.unwrap_or_default();
20426 let resp = serde_json::from_value(res)?;
20427 Ok(resp)
20428 } else {
20429 Err(ApiError::from_response(resp))
20430 }
20431 }
20432 #[allow(clippy::too_many_arguments)]
20433 #[allow(rustdoc::invalid_html_tags)]
20434 #[doc = "Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object."]
20435 pub async fn get_available_gifts<'a>(&self) -> BotResult<Gifts> {
20436 let resp = self.post_empty("getAvailableGifts").await?;
20437 if resp.ok {
20438 let res = resp.result.unwrap_or_default();
20439 let resp = serde_json::from_value(res)?;
20440 Ok(resp)
20441 } else {
20442 Err(ApiError::from_response(resp))
20443 }
20444 }
20445 #[allow(clippy::too_many_arguments)]
20446 #[allow(rustdoc::invalid_html_tags)]
20447 #[doc = "Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
20448 pub async fn set_chat_photo<'a, V: Into<ChatHandle> + Serialize>(
20449 &self,
20450 chat_id: V,
20451 photo: FileData,
20452 ) -> BotResult<bool> {
20453 let data = Form::new();
20454 let (data, photo_json) = photo.convert_form(data, "photo".to_owned())?;
20455 let form = SetChatPhotoOpts {
20456 chat_id,
20457 photo: photo_json,
20458 };
20459 let resp = self.post_data("setChatPhoto", form, data).await?;
20460 if resp.ok {
20461 let res = resp.result.unwrap_or_default();
20462 let resp = serde_json::from_value(res)?;
20463 Ok(resp)
20464 } else {
20465 Err(ApiError::from_response(resp))
20466 }
20467 }
20468 #[allow(clippy::too_many_arguments)]
20469 #[allow(rustdoc::invalid_html_tags)]
20470 #[doc = "Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success."]
20471 pub async fn set_my_description<'a>(
20472 &self,
20473 description: Option<&'a str>,
20474 language_code: Option<&'a str>,
20475 ) -> BotResult<bool> {
20476 let form = SetMyDescriptionOpts {
20477 description,
20478 language_code,
20479 };
20480 let resp = self.post("setMyDescription", form).await?;
20481 if resp.ok {
20482 let res = resp.result.unwrap_or_default();
20483 let resp = serde_json::from_value(res)?;
20484 Ok(resp)
20485 } else {
20486 Err(ApiError::from_response(resp))
20487 }
20488 }
20489 #[allow(clippy::too_many_arguments)]
20490 #[allow(rustdoc::invalid_html_tags)]
20491 #[doc = "Use this method to change the bot's name. Returns True on success."]
20492 pub async fn set_my_name<'a>(
20493 &self,
20494 name: Option<&'a str>,
20495 language_code: Option<&'a str>,
20496 ) -> BotResult<bool> {
20497 let form = SetMyNameOpts {
20498 name,
20499 language_code,
20500 };
20501 let resp = self.post("setMyName", form).await?;
20502 if resp.ok {
20503 let res = resp.result.unwrap_or_default();
20504 let resp = serde_json::from_value(res)?;
20505 Ok(resp)
20506 } else {
20507 Err(ApiError::from_response(resp))
20508 }
20509 }
20510 #[allow(clippy::too_many_arguments)]
20511 #[allow(rustdoc::invalid_html_tags)]
20512 #[doc = "Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success."]
20513 pub async fn set_my_commands<'a>(
20514 &self,
20515 commands: &'a Vec<BotCommand>,
20516 scope: Option<&'a BotCommandScope>,
20517 language_code: Option<&'a str>,
20518 ) -> BotResult<bool> {
20519 let form = SetMyCommandsOpts {
20520 commands: serde_json::to_string(&commands)?,
20521 scope: if let Some(scope) = scope {
20522 Some(serde_json::to_string(&scope)?)
20523 } else {
20524 None
20525 },
20526 language_code,
20527 };
20528 let resp = self.post("setMyCommands", form).await?;
20529 if resp.ok {
20530 let res = resp.result.unwrap_or_default();
20531 let resp = serde_json::from_value(res)?;
20532 Ok(resp)
20533 } else {
20534 Err(ApiError::from_response(resp))
20535 }
20536 }
20537 #[allow(clippy::too_many_arguments)]
20538 #[allow(rustdoc::invalid_html_tags)]
20539 #[doc = "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
20540 pub async fn edit_message_caption<'a, V: Into<ChatHandle> + Serialize>(
20541 &self,
20542 business_connection_id: Option<&'a str>,
20543 chat_id: Option<V>,
20544 message_id: Option<i64>,
20545 inline_message_id: Option<&'a str>,
20546 caption: Option<&'a str>,
20547 parse_mode: Option<&'a str>,
20548 caption_entities: Option<&'a Vec<MessageEntity>>,
20549 show_caption_above_media: Option<bool>,
20550 reply_markup: Option<&'a InlineKeyboardMarkup>,
20551 ) -> BotResult<MessageBool> {
20552 let form = EditMessageCaptionOpts {
20553 business_connection_id,
20554 chat_id,
20555 message_id,
20556 inline_message_id,
20557 caption,
20558 parse_mode,
20559 caption_entities: if let Some(caption_entities) = caption_entities {
20560 Some(serde_json::to_string(&caption_entities)?)
20561 } else {
20562 None
20563 },
20564 show_caption_above_media,
20565 reply_markup: if let Some(reply_markup) = reply_markup {
20566 Some(serde_json::to_string(&reply_markup)?)
20567 } else {
20568 None
20569 },
20570 };
20571 let resp = self.post("editMessageCaption", form).await?;
20572 if resp.ok {
20573 let res = resp.result.unwrap_or_default();
20574 let resp = serde_json::from_value(res)?;
20575 Ok(resp)
20576 } else {
20577 Err(ApiError::from_response(resp))
20578 }
20579 }
20580 #[allow(clippy::too_many_arguments)]
20581 #[allow(rustdoc::invalid_html_tags)]
20582 #[doc = "Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success."]
20583 pub async fn delete_story<'a>(
20584 &self,
20585 business_connection_id: &'a str,
20586 story_id: i64,
20587 ) -> BotResult<bool> {
20588 let form = DeleteStoryOpts {
20589 business_connection_id,
20590 story_id,
20591 };
20592 let resp = self.post("deleteStory", form).await?;
20593 if resp.ok {
20594 let res = resp.result.unwrap_or_default();
20595 let resp = serde_json::from_value(res)?;
20596 Ok(resp)
20597 } else {
20598 Err(ApiError::from_response(resp))
20599 }
20600 }
20601 #[allow(clippy::too_many_arguments)]
20602 #[allow(rustdoc::invalid_html_tags)]
20603 #[doc = "Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success."]
20604 pub async fn delete_business_messages<'a>(
20605 &self,
20606 business_connection_id: &'a str,
20607 message_ids: &'a Vec<i64>,
20608 ) -> BotResult<bool> {
20609 let form = DeleteBusinessMessagesOpts {
20610 business_connection_id,
20611 message_ids: serde_json::to_string(&message_ids)?,
20612 };
20613 let resp = self.post("deleteBusinessMessages", form).await?;
20614 if resp.ok {
20615 let res = resp.result.unwrap_or_default();
20616 let resp = serde_json::from_value(res)?;
20617 Ok(resp)
20618 } else {
20619 Err(ApiError::from_response(resp))
20620 }
20621 }
20622 #[allow(clippy::too_many_arguments)]
20623 #[allow(rustdoc::invalid_html_tags)]
20624 #[doc = "Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object."]
20625 pub async fn get_user_profile_photos<'a>(
20626 &self,
20627 user_id: i64,
20628 offset: Option<i64>,
20629 limit: Option<i64>,
20630 ) -> BotResult<UserProfilePhotos> {
20631 let form = GetUserProfilePhotosOpts {
20632 user_id,
20633 offset,
20634 limit,
20635 };
20636 let resp = self.post("getUserProfilePhotos", form).await?;
20637 if resp.ok {
20638 let res = resp.result.unwrap_or_default();
20639 let resp = serde_json::from_value(res)?;
20640 Ok(resp)
20641 } else {
20642 Err(ApiError::from_response(resp))
20643 }
20644 }
20645 #[allow(clippy::too_many_arguments)]
20646 #[allow(rustdoc::invalid_html_tags)]
20647 #[doc = "Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success."]
20648 pub async fn get_business_account_gifts<'a>(
20649 &self,
20650 business_connection_id: &'a str,
20651 exclude_unsaved: Option<bool>,
20652 exclude_saved: Option<bool>,
20653 exclude_unlimited: Option<bool>,
20654 exclude_limited: Option<bool>,
20655 exclude_unique: Option<bool>,
20656 sort_by_price: Option<bool>,
20657 offset: Option<&'a str>,
20658 limit: Option<i64>,
20659 ) -> BotResult<OwnedGifts> {
20660 let form = GetBusinessAccountGiftsOpts {
20661 business_connection_id,
20662 exclude_unsaved,
20663 exclude_saved,
20664 exclude_unlimited,
20665 exclude_limited,
20666 exclude_unique,
20667 sort_by_price,
20668 offset,
20669 limit,
20670 };
20671 let resp = self.post("getBusinessAccountGifts", form).await?;
20672 if resp.ok {
20673 let res = resp.result.unwrap_or_default();
20674 let resp = serde_json::from_value(res)?;
20675 Ok(resp)
20676 } else {
20677 Err(ApiError::from_response(resp))
20678 }
20679 }
20680 #[allow(clippy::too_many_arguments)]
20681 #[allow(rustdoc::invalid_html_tags)]
20682 #[doc = "Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success."]
20683 pub async fn set_chat_permissions<'a, V: Into<ChatHandle> + Serialize>(
20684 &self,
20685 chat_id: V,
20686 permissions: &'a ChatPermissions,
20687 use_independent_chat_permissions: Option<bool>,
20688 ) -> BotResult<bool> {
20689 let form = SetChatPermissionsOpts {
20690 chat_id,
20691 permissions: serde_json::to_string(&permissions)?,
20692 use_independent_chat_permissions,
20693 };
20694 let resp = self.post("setChatPermissions", form).await?;
20695 if resp.ok {
20696 let res = resp.result.unwrap_or_default();
20697 let resp = serde_json::from_value(res)?;
20698 Ok(resp)
20699 } else {
20700 Err(ApiError::from_response(resp))
20701 }
20702 }
20703 #[allow(clippy::too_many_arguments)]
20704 #[allow(rustdoc::invalid_html_tags)]
20705 #[doc = "If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned."]
20706 pub async fn answer_shipping_query<'a>(
20707 &self,
20708 shipping_query_id: &'a str,
20709 ok: bool,
20710 shipping_options: Option<&'a Vec<ShippingOption>>,
20711 error_message: Option<&'a str>,
20712 ) -> BotResult<bool> {
20713 let form = AnswerShippingQueryOpts {
20714 shipping_query_id,
20715 ok,
20716 shipping_options: if let Some(shipping_options) = shipping_options {
20717 Some(serde_json::to_string(&shipping_options)?)
20718 } else {
20719 None
20720 },
20721 error_message,
20722 };
20723 let resp = self.post("answerShippingQuery", form).await?;
20724 if resp.ok {
20725 let res = resp.result.unwrap_or_default();
20726 let resp = serde_json::from_value(res)?;
20727 Ok(resp)
20728 } else {
20729 Err(ApiError::from_response(resp))
20730 }
20731 }
20732 #[allow(clippy::too_many_arguments)]
20733 #[allow(rustdoc::invalid_html_tags)]
20734 #[doc = "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object."]
20735 pub async fn create_chat_subscription_invite_link<'a, V: Into<ChatHandle> + Serialize>(
20736 &self,
20737 chat_id: V,
20738 name: Option<&'a str>,
20739 subscription_period: i64,
20740 subscription_price: i64,
20741 ) -> BotResult<ChatInviteLink> {
20742 let form = CreateChatSubscriptionInviteLinkOpts {
20743 chat_id,
20744 name,
20745 subscription_period,
20746 subscription_price,
20747 };
20748 let resp = self.post("createChatSubscriptionInviteLink", form).await?;
20749 if resp.ok {
20750 let res = resp.result.unwrap_or_default();
20751 let resp = serde_json::from_value(res)?;
20752 Ok(resp)
20753 } else {
20754 Err(ApiError::from_response(resp))
20755 }
20756 }
20757 #[allow(clippy::too_many_arguments)]
20758 #[allow(rustdoc::invalid_html_tags)]
20759 #[doc = "Use this method to set the title of a created sticker set. Returns True on success."]
20760 pub async fn set_sticker_set_title<'a>(
20761 &self,
20762 name: &'a str,
20763 title: &'a str,
20764 ) -> BotResult<bool> {
20765 let form = SetStickerSetTitleOpts { name, title };
20766 let resp = self.post("setStickerSetTitle", form).await?;
20767 if resp.ok {
20768 let res = resp.result.unwrap_or_default();
20769 let resp = serde_json::from_value(res)?;
20770 Ok(resp)
20771 } else {
20772 Err(ApiError::from_response(resp))
20773 }
20774 }
20775 #[allow(clippy::too_many_arguments)]
20776 #[allow(rustdoc::invalid_html_tags)]
20777 #[doc = "Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success."]
20778 pub async fn approve_suggested_post<'a>(
20779 &self,
20780 chat_id: i64,
20781 message_id: i64,
20782 send_date: Option<i64>,
20783 ) -> BotResult<bool> {
20784 let form = ApproveSuggestedPostOpts {
20785 chat_id,
20786 message_id,
20787 send_date,
20788 };
20789 let resp = self.post("approveSuggestedPost", form).await?;
20790 if resp.ok {
20791 let res = resp.result.unwrap_or_default();
20792 let resp = serde_json::from_value(res)?;
20793 Ok(resp)
20794 } else {
20795 Err(ApiError::from_response(resp))
20796 }
20797 }
20798 #[allow(clippy::too_many_arguments)]
20799 #[allow(rustdoc::invalid_html_tags)]
20800 #[doc = "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success."]
20801 pub async fn hide_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
20802 &self,
20803 chat_id: V,
20804 ) -> BotResult<bool> {
20805 let form = HideGeneralForumTopicOpts { chat_id };
20806 let resp = self.post("hideGeneralForumTopic", form).await?;
20807 if resp.ok {
20808 let res = resp.result.unwrap_or_default();
20809 let resp = serde_json::from_value(res)?;
20810 Ok(resp)
20811 } else {
20812 Err(ApiError::from_response(resp))
20813 }
20814 }
20815 #[allow(clippy::too_many_arguments)]
20816 #[allow(rustdoc::invalid_html_tags)]
20817 #[doc = "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success."]
20818 pub async fn create_new_sticker_set<'a>(
20819 &self,
20820 user_id: i64,
20821 name: &'a str,
20822 title: &'a str,
20823 stickers: &'a Vec<InputSticker>,
20824 sticker_type: Option<&'a str>,
20825 needs_repainting: Option<bool>,
20826 ) -> BotResult<bool> {
20827 let form = CreateNewStickerSetOpts {
20828 user_id,
20829 name,
20830 title,
20831 stickers: serde_json::to_string(&stickers)?,
20832 sticker_type,
20833 needs_repainting,
20834 };
20835 let resp = self.post("createNewStickerSet", form).await?;
20836 if resp.ok {
20837 let res = resp.result.unwrap_or_default();
20838 let resp = serde_json::from_value(res)?;
20839 Ok(resp)
20840 } else {
20841 Err(ApiError::from_response(resp))
20842 }
20843 }
20844 #[allow(clippy::too_many_arguments)]
20845 #[allow(rustdoc::invalid_html_tags)]
20846 #[doc = "As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned."]
20847 pub async fn send_video_note<'a, V: Into<ChatHandle> + Serialize>(
20848 &self,
20849 business_connection_id: Option<&'a str>,
20850 chat_id: V,
20851 message_thread_id: Option<i64>,
20852 direct_messages_topic_id: Option<i64>,
20853 video_note: FileData,
20854 duration: Option<i64>,
20855 length: Option<i64>,
20856 thumbnail: Option<FileData>,
20857 disable_notification: Option<bool>,
20858 protect_content: Option<bool>,
20859 allow_paid_broadcast: Option<bool>,
20860 message_effect_id: Option<&'a str>,
20861 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
20862 reply_parameters: Option<&'a ReplyParameters>,
20863 reply_markup: Option<&'a EReplyMarkup>,
20864 ) -> BotResult<Message> {
20865 let data = Form::new();
20866 let (data, video_note_json) = video_note.convert_form(data, "video_note".to_owned())?;
20867 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
20868 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
20869 (data, Some(thumbnail_json))
20870 } else {
20871 (data, None)
20872 };
20873 let form = SendVideoNoteOpts {
20874 business_connection_id,
20875 chat_id,
20876 message_thread_id,
20877 direct_messages_topic_id,
20878 video_note: video_note_json,
20879 duration,
20880 length,
20881 thumbnail: thumbnail_json,
20882 disable_notification,
20883 protect_content,
20884 allow_paid_broadcast,
20885 message_effect_id,
20886 suggested_post_parameters: if let Some(suggested_post_parameters) =
20887 suggested_post_parameters
20888 {
20889 Some(serde_json::to_string(&suggested_post_parameters)?)
20890 } else {
20891 None
20892 },
20893 reply_parameters: if let Some(reply_parameters) = reply_parameters {
20894 Some(serde_json::to_string(&reply_parameters)?)
20895 } else {
20896 None
20897 },
20898 reply_markup: if let Some(reply_markup) = reply_markup {
20899 Some(serde_json::to_string(&reply_markup)?)
20900 } else {
20901 None
20902 },
20903 };
20904 let resp = self.post_data("sendVideoNote", form, data).await?;
20905 if resp.ok {
20906 let res = resp.result.unwrap_or_default();
20907 let resp = serde_json::from_value(res)?;
20908 Ok(resp)
20909 } else {
20910 Err(ApiError::from_response(resp))
20911 }
20912 }
20913 #[allow(clippy::too_many_arguments)]
20914 #[allow(rustdoc::invalid_html_tags)]
20915 #[doc = "Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success."]
20916 pub async fn unban_chat_member<'a, V: Into<ChatHandle> + Serialize>(
20917 &self,
20918 chat_id: V,
20919 user_id: i64,
20920 only_if_banned: Option<bool>,
20921 ) -> BotResult<bool> {
20922 let form = UnbanChatMemberOpts {
20923 chat_id,
20924 user_id,
20925 only_if_banned,
20926 };
20927 let resp = self.post("unbanChatMember", form).await?;
20928 if resp.ok {
20929 let res = resp.result.unwrap_or_default();
20930 let resp = serde_json::from_value(res)?;
20931 Ok(resp)
20932 } else {
20933 Err(ApiError::from_response(resp))
20934 }
20935 }
20936 #[allow(clippy::too_many_arguments)]
20937 #[allow(rustdoc::invalid_html_tags)]
20938 #[doc = "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object."]
20939 pub async fn edit_chat_subscription_invite_link<'a, V: Into<ChatHandle> + Serialize>(
20940 &self,
20941 chat_id: V,
20942 invite_link: &'a str,
20943 name: Option<&'a str>,
20944 ) -> BotResult<ChatInviteLink> {
20945 let form = EditChatSubscriptionInviteLinkOpts {
20946 chat_id,
20947 invite_link,
20948 name,
20949 };
20950 let resp = self.post("editChatSubscriptionInviteLink", form).await?;
20951 if resp.ok {
20952 let res = resp.result.unwrap_or_default();
20953 let resp = serde_json::from_value(res)?;
20954 Ok(resp)
20955 } else {
20956 Err(ApiError::from_response(resp))
20957 }
20958 }
20959 #[allow(clippy::too_many_arguments)]
20960 #[allow(rustdoc::invalid_html_tags)]
20961 #[doc = "Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
20962 pub async fn unpin_all_forum_topic_messages<'a, V: Into<ChatHandle> + Serialize>(
20963 &self,
20964 chat_id: V,
20965 message_thread_id: i64,
20966 ) -> BotResult<bool> {
20967 let form = UnpinAllForumTopicMessagesOpts {
20968 chat_id,
20969 message_thread_id,
20970 };
20971 let resp = self.post("unpinAllForumTopicMessages", form).await?;
20972 if resp.ok {
20973 let res = resp.result.unwrap_or_default();
20974 let resp = serde_json::from_value(res)?;
20975 Ok(resp)
20976 } else {
20977 Err(ApiError::from_response(resp))
20978 }
20979 }
20980 #[allow(clippy::too_many_arguments)]
20981 #[allow(rustdoc::invalid_html_tags)]
20982 #[doc = "Use this method to send a game. On success, the sent Message is returned."]
20983 pub async fn send_game<'a>(
20984 &self,
20985 business_connection_id: Option<&'a str>,
20986 chat_id: i64,
20987 message_thread_id: Option<i64>,
20988 game_short_name: &'a str,
20989 disable_notification: Option<bool>,
20990 protect_content: Option<bool>,
20991 allow_paid_broadcast: Option<bool>,
20992 message_effect_id: Option<&'a str>,
20993 reply_parameters: Option<&'a ReplyParameters>,
20994 reply_markup: Option<&'a InlineKeyboardMarkup>,
20995 ) -> BotResult<Message> {
20996 let form = SendGameOpts {
20997 business_connection_id,
20998 chat_id,
20999 message_thread_id,
21000 game_short_name,
21001 disable_notification,
21002 protect_content,
21003 allow_paid_broadcast,
21004 message_effect_id,
21005 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21006 Some(serde_json::to_string(&reply_parameters)?)
21007 } else {
21008 None
21009 },
21010 reply_markup: if let Some(reply_markup) = reply_markup {
21011 Some(serde_json::to_string(&reply_markup)?)
21012 } else {
21013 None
21014 },
21015 };
21016 let resp = self.post("sendGame", form).await?;
21017 if resp.ok {
21018 let res = resp.result.unwrap_or_default();
21019 let resp = serde_json::from_value(res)?;
21020 Ok(resp)
21021 } else {
21022 Err(ApiError::from_response(resp))
21023 }
21024 }
21025 #[allow(clippy::too_many_arguments)]
21026 #[allow(rustdoc::invalid_html_tags)]
21027 #[doc = "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
21028 pub async fn close_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
21029 &self,
21030 chat_id: V,
21031 ) -> BotResult<bool> {
21032 let form = CloseGeneralForumTopicOpts { chat_id };
21033 let resp = self.post("closeGeneralForumTopic", form).await?;
21034 if resp.ok {
21035 let res = resp.result.unwrap_or_default();
21036 let resp = serde_json::from_value(res)?;
21037 Ok(resp)
21038 } else {
21039 Err(ApiError::from_response(resp))
21040 }
21041 }
21042 #[allow(clippy::too_many_arguments)]
21043 #[allow(rustdoc::invalid_html_tags)]
21044 #[doc = "Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success."]
21045 pub async fn set_sticker_position_in_set<'a>(
21046 &self,
21047 sticker: &'a str,
21048 position: i64,
21049 ) -> BotResult<bool> {
21050 let form = SetStickerPositionInSetOpts { sticker, position };
21051 let resp = self.post("setStickerPositionInSet", form).await?;
21052 if resp.ok {
21053 let res = resp.result.unwrap_or_default();
21054 let resp = serde_json::from_value(res)?;
21055 Ok(resp)
21056 } else {
21057 Err(ApiError::from_response(resp))
21058 }
21059 }
21060 #[allow(clippy::too_many_arguments)]
21061 #[allow(rustdoc::invalid_html_tags)]
21062 #[doc = "Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.For sending voice messages, use the sendVoice method instead."]
21063 pub async fn send_audio<'a, V: Into<ChatHandle> + Serialize>(
21064 &self,
21065 business_connection_id: Option<&'a str>,
21066 chat_id: V,
21067 message_thread_id: Option<i64>,
21068 direct_messages_topic_id: Option<i64>,
21069 audio: FileData,
21070 caption: Option<&'a str>,
21071 parse_mode: Option<&'a str>,
21072 caption_entities: Option<&'a Vec<MessageEntity>>,
21073 duration: Option<i64>,
21074 performer: Option<&'a str>,
21075 title: Option<&'a str>,
21076 thumbnail: Option<FileData>,
21077 disable_notification: Option<bool>,
21078 protect_content: Option<bool>,
21079 allow_paid_broadcast: Option<bool>,
21080 message_effect_id: Option<&'a str>,
21081 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21082 reply_parameters: Option<&'a ReplyParameters>,
21083 reply_markup: Option<&'a EReplyMarkup>,
21084 ) -> BotResult<Message> {
21085 let data = Form::new();
21086 let (data, audio_json) = audio.convert_form(data, "audio".to_owned())?;
21087 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
21088 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
21089 (data, Some(thumbnail_json))
21090 } else {
21091 (data, None)
21092 };
21093 let form = SendAudioOpts {
21094 business_connection_id,
21095 chat_id,
21096 message_thread_id,
21097 direct_messages_topic_id,
21098 audio: audio_json,
21099 caption,
21100 parse_mode,
21101 caption_entities: if let Some(caption_entities) = caption_entities {
21102 Some(serde_json::to_string(&caption_entities)?)
21103 } else {
21104 None
21105 },
21106 duration,
21107 performer,
21108 title,
21109 thumbnail: thumbnail_json,
21110 disable_notification,
21111 protect_content,
21112 allow_paid_broadcast,
21113 message_effect_id,
21114 suggested_post_parameters: if let Some(suggested_post_parameters) =
21115 suggested_post_parameters
21116 {
21117 Some(serde_json::to_string(&suggested_post_parameters)?)
21118 } else {
21119 None
21120 },
21121 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21122 Some(serde_json::to_string(&reply_parameters)?)
21123 } else {
21124 None
21125 },
21126 reply_markup: if let Some(reply_markup) = reply_markup {
21127 Some(serde_json::to_string(&reply_markup)?)
21128 } else {
21129 None
21130 },
21131 };
21132 let resp = self.post_data("sendAudio", form, data).await?;
21133 if resp.ok {
21134 let res = resp.result.unwrap_or_default();
21135 let resp = serde_json::from_value(res)?;
21136 Ok(resp)
21137 } else {
21138 Err(ApiError::from_response(resp))
21139 }
21140 }
21141 #[allow(clippy::too_many_arguments)]
21142 #[allow(rustdoc::invalid_html_tags)]
21143 #[doc = "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
21144 pub async fn edit_message_text<'a, V: Into<ChatHandle> + Serialize>(
21145 &self,
21146 business_connection_id: Option<&'a str>,
21147 chat_id: Option<V>,
21148 message_id: Option<i64>,
21149 inline_message_id: Option<&'a str>,
21150 text: &'a str,
21151 parse_mode: Option<&'a str>,
21152 entities: Option<&'a Vec<MessageEntity>>,
21153 link_preview_options: Option<&'a LinkPreviewOptions>,
21154 reply_markup: Option<&'a InlineKeyboardMarkup>,
21155 ) -> BotResult<MessageBool> {
21156 let form = EditMessageTextOpts {
21157 business_connection_id,
21158 chat_id,
21159 message_id,
21160 inline_message_id,
21161 text,
21162 parse_mode,
21163 entities: if let Some(entities) = entities {
21164 Some(serde_json::to_string(&entities)?)
21165 } else {
21166 None
21167 },
21168 link_preview_options: if let Some(link_preview_options) = link_preview_options {
21169 Some(serde_json::to_string(&link_preview_options)?)
21170 } else {
21171 None
21172 },
21173 reply_markup: if let Some(reply_markup) = reply_markup {
21174 Some(serde_json::to_string(&reply_markup)?)
21175 } else {
21176 None
21177 },
21178 };
21179 let resp = self.post("editMessageText", form).await?;
21180 if resp.ok {
21181 let res = resp.result.unwrap_or_default();
21182 let resp = serde_json::from_value(res)?;
21183 Ok(resp)
21184 } else {
21185 Err(ApiError::from_response(resp))
21186 }
21187 }
21188 #[allow(clippy::too_many_arguments)]
21189 #[allow(rustdoc::invalid_html_tags)]
21190 #[doc = "Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success."]
21191 pub async fn get_chat_menu_button<'a>(&self, chat_id: Option<i64>) -> BotResult<MenuButton> {
21192 let form = GetChatMenuButtonOpts { chat_id };
21193 let resp = self.post("getChatMenuButton", form).await?;
21194 if resp.ok {
21195 let res = resp.result.unwrap_or_default();
21196 let resp = serde_json::from_value(res)?;
21197 Ok(resp)
21198 } else {
21199 Err(ApiError::from_response(resp))
21200 }
21201 }
21202 #[allow(clippy::too_many_arguments)]
21203 #[allow(rustdoc::invalid_html_tags)]
21204 #[doc = "Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned."]
21205 pub async fn send_sticker<'a, V: Into<ChatHandle> + Serialize>(
21206 &self,
21207 business_connection_id: Option<&'a str>,
21208 chat_id: V,
21209 message_thread_id: Option<i64>,
21210 direct_messages_topic_id: Option<i64>,
21211 sticker: FileData,
21212 emoji: Option<&'a str>,
21213 disable_notification: Option<bool>,
21214 protect_content: Option<bool>,
21215 allow_paid_broadcast: Option<bool>,
21216 message_effect_id: Option<&'a str>,
21217 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21218 reply_parameters: Option<&'a ReplyParameters>,
21219 reply_markup: Option<&'a EReplyMarkup>,
21220 ) -> BotResult<Message> {
21221 let data = Form::new();
21222 let (data, sticker_json) = sticker.convert_form(data, "sticker".to_owned())?;
21223 let form = SendStickerOpts {
21224 business_connection_id,
21225 chat_id,
21226 message_thread_id,
21227 direct_messages_topic_id,
21228 sticker: sticker_json,
21229 emoji,
21230 disable_notification,
21231 protect_content,
21232 allow_paid_broadcast,
21233 message_effect_id,
21234 suggested_post_parameters: if let Some(suggested_post_parameters) =
21235 suggested_post_parameters
21236 {
21237 Some(serde_json::to_string(&suggested_post_parameters)?)
21238 } else {
21239 None
21240 },
21241 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21242 Some(serde_json::to_string(&reply_parameters)?)
21243 } else {
21244 None
21245 },
21246 reply_markup: if let Some(reply_markup) = reply_markup {
21247 Some(serde_json::to_string(&reply_markup)?)
21248 } else {
21249 None
21250 },
21251 };
21252 let resp = self.post_data("sendSticker", form, data).await?;
21253 if resp.ok {
21254 let res = resp.result.unwrap_or_default();
21255 let resp = serde_json::from_value(res)?;
21256 Ok(resp)
21257 } else {
21258 Err(ApiError::from_response(resp))
21259 }
21260 }
21261 #[allow(clippy::too_many_arguments)]
21262 #[allow(rustdoc::invalid_html_tags)]
21263 #[doc = "Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future."]
21264 pub async fn send_video<'a, V: Into<ChatHandle> + Serialize>(
21265 &self,
21266 business_connection_id: Option<&'a str>,
21267 chat_id: V,
21268 message_thread_id: Option<i64>,
21269 direct_messages_topic_id: Option<i64>,
21270 video: FileData,
21271 duration: Option<i64>,
21272 width: Option<i64>,
21273 height: Option<i64>,
21274 thumbnail: Option<FileData>,
21275 cover: Option<FileData>,
21276 start_timestamp: Option<i64>,
21277 caption: Option<&'a str>,
21278 parse_mode: Option<&'a str>,
21279 caption_entities: Option<&'a Vec<MessageEntity>>,
21280 show_caption_above_media: Option<bool>,
21281 has_spoiler: Option<bool>,
21282 supports_streaming: Option<bool>,
21283 disable_notification: Option<bool>,
21284 protect_content: Option<bool>,
21285 allow_paid_broadcast: Option<bool>,
21286 message_effect_id: Option<&'a str>,
21287 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21288 reply_parameters: Option<&'a ReplyParameters>,
21289 reply_markup: Option<&'a EReplyMarkup>,
21290 ) -> BotResult<Message> {
21291 let data = Form::new();
21292 let (data, video_json) = video.convert_form(data, "video".to_owned())?;
21293 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
21294 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
21295 (data, Some(thumbnail_json))
21296 } else {
21297 (data, None)
21298 };
21299 let (data, cover_json) = if let Some(cover) = cover {
21300 let (data, cover_json) = cover.convert_form(data, "cover".to_owned())?;
21301 (data, Some(cover_json))
21302 } else {
21303 (data, None)
21304 };
21305 let form = SendVideoOpts {
21306 business_connection_id,
21307 chat_id,
21308 message_thread_id,
21309 direct_messages_topic_id,
21310 video: video_json,
21311 duration,
21312 width,
21313 height,
21314 thumbnail: thumbnail_json,
21315 cover: cover_json,
21316 start_timestamp,
21317 caption,
21318 parse_mode,
21319 caption_entities: if let Some(caption_entities) = caption_entities {
21320 Some(serde_json::to_string(&caption_entities)?)
21321 } else {
21322 None
21323 },
21324 show_caption_above_media,
21325 has_spoiler,
21326 supports_streaming,
21327 disable_notification,
21328 protect_content,
21329 allow_paid_broadcast,
21330 message_effect_id,
21331 suggested_post_parameters: if let Some(suggested_post_parameters) =
21332 suggested_post_parameters
21333 {
21334 Some(serde_json::to_string(&suggested_post_parameters)?)
21335 } else {
21336 None
21337 },
21338 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21339 Some(serde_json::to_string(&reply_parameters)?)
21340 } else {
21341 None
21342 },
21343 reply_markup: if let Some(reply_markup) = reply_markup {
21344 Some(serde_json::to_string(&reply_markup)?)
21345 } else {
21346 None
21347 },
21348 };
21349 let resp = self.post_data("sendVideo", form, data).await?;
21350 if resp.ok {
21351 let res = resp.result.unwrap_or_default();
21352 let resp = serde_json::from_value(res)?;
21353 Ok(resp)
21354 } else {
21355 Err(ApiError::from_response(resp))
21356 }
21357 }
21358 #[allow(clippy::too_many_arguments)]
21359 #[allow(rustdoc::invalid_html_tags)]
21360 #[doc = "Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success."]
21361 pub async fn ban_chat_sender_chat<'a, V: Into<ChatHandle> + Serialize>(
21362 &self,
21363 chat_id: V,
21364 sender_chat_id: i64,
21365 ) -> BotResult<bool> {
21366 let form = BanChatSenderChatOpts {
21367 chat_id,
21368 sender_chat_id,
21369 };
21370 let resp = self.post("banChatSenderChat", form).await?;
21371 if resp.ok {
21372 let res = resp.result.unwrap_or_default();
21373 let resp = serde_json::from_value(res)?;
21374 Ok(resp)
21375 } else {
21376 Err(ApiError::from_response(resp))
21377 }
21378 }
21379 #[allow(clippy::too_many_arguments)]
21380 #[allow(rustdoc::invalid_html_tags)]
21381 #[doc = "Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects."]
21382 pub async fn get_chat_administrators<'a, V: Into<ChatHandle> + Serialize>(
21383 &self,
21384 chat_id: V,
21385 ) -> BotResult<Vec<ChatMember>> {
21386 let form = GetChatAdministratorsOpts { chat_id };
21387 let resp = self.post("getChatAdministrators", form).await?;
21388 if resp.ok {
21389 let res = resp.result.unwrap_or_default();
21390 let resp = serde_json::from_value(res)?;
21391 Ok(resp)
21392 } else {
21393 Err(ApiError::from_response(resp))
21394 }
21395 }
21396 #[allow(clippy::too_many_arguments)]
21397 #[allow(rustdoc::invalid_html_tags)]
21398 #[doc = "Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success."]
21399 pub async fn delete_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
21400 &self,
21401 chat_id: V,
21402 message_thread_id: i64,
21403 ) -> BotResult<bool> {
21404 let form = DeleteForumTopicOpts {
21405 chat_id,
21406 message_thread_id,
21407 };
21408 let resp = self.post("deleteForumTopic", form).await?;
21409 if resp.ok {
21410 let res = resp.result.unwrap_or_default();
21411 let resp = serde_json::from_value(res)?;
21412 Ok(resp)
21413 } else {
21414 Err(ApiError::from_response(resp))
21415 }
21416 }
21417 #[allow(clippy::too_many_arguments)]
21418 #[allow(rustdoc::invalid_html_tags)]
21419 #[doc = "Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success."]
21420 pub async fn get_business_connection<'a>(
21421 &self,
21422 business_connection_id: &'a str,
21423 ) -> BotResult<BusinessConnection> {
21424 let form = GetBusinessConnectionOpts {
21425 business_connection_id,
21426 };
21427 let resp = self.post("getBusinessConnection", form).await?;
21428 if resp.ok {
21429 let res = resp.result.unwrap_or_default();
21430 let resp = serde_json::from_value(res)?;
21431 Ok(resp)
21432 } else {
21433 Err(ApiError::from_response(resp))
21434 }
21435 }
21436 #[allow(clippy::too_many_arguments)]
21437 #[allow(rustdoc::invalid_html_tags)]
21438 #[doc = "Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success."]
21439 pub async fn set_business_account_name<'a>(
21440 &self,
21441 business_connection_id: &'a str,
21442 first_name: &'a str,
21443 last_name: Option<&'a str>,
21444 ) -> BotResult<bool> {
21445 let form = SetBusinessAccountNameOpts {
21446 business_connection_id,
21447 first_name,
21448 last_name,
21449 };
21450 let resp = self.post("setBusinessAccountName", form).await?;
21451 if resp.ok {
21452 let res = resp.result.unwrap_or_default();
21453 let resp = serde_json::from_value(res)?;
21454 Ok(resp)
21455 } else {
21456 Err(ApiError::from_response(resp))
21457 }
21458 }
21459 #[allow(clippy::too_many_arguments)]
21460 #[allow(rustdoc::invalid_html_tags)]
21461 #[doc = "Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success."]
21462 pub async fn set_business_account_gift_settings<'a>(
21463 &self,
21464 business_connection_id: &'a str,
21465 show_gift_button: bool,
21466 accepted_gift_types: &'a AcceptedGiftTypes,
21467 ) -> BotResult<bool> {
21468 let form = SetBusinessAccountGiftSettingsOpts {
21469 business_connection_id,
21470 show_gift_button,
21471 accepted_gift_types: serde_json::to_string(&accepted_gift_types)?,
21472 };
21473 let resp = self.post("setBusinessAccountGiftSettings", form).await?;
21474 if resp.ok {
21475 let res = resp.result.unwrap_or_default();
21476 let resp = serde_json::from_value(res)?;
21477 Ok(resp)
21478 } else {
21479 Err(ApiError::from_response(resp))
21480 }
21481 }
21482 #[allow(clippy::too_many_arguments)]
21483 #[allow(rustdoc::invalid_html_tags)]
21484 #[doc = "Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned."]
21485 pub async fn stop_message_live_location<'a, V: Into<ChatHandle> + Serialize>(
21486 &self,
21487 business_connection_id: Option<&'a str>,
21488 chat_id: Option<V>,
21489 message_id: Option<i64>,
21490 inline_message_id: Option<&'a str>,
21491 reply_markup: Option<&'a InlineKeyboardMarkup>,
21492 ) -> BotResult<MessageBool> {
21493 let form = StopMessageLiveLocationOpts {
21494 business_connection_id,
21495 chat_id,
21496 message_id,
21497 inline_message_id,
21498 reply_markup: if let Some(reply_markup) = reply_markup {
21499 Some(serde_json::to_string(&reply_markup)?)
21500 } else {
21501 None
21502 },
21503 };
21504 let resp = self.post("stopMessageLiveLocation", form).await?;
21505 if resp.ok {
21506 let res = resp.result.unwrap_or_default();
21507 let resp = serde_json::from_value(res)?;
21508 Ok(resp)
21509 } else {
21510 Err(ApiError::from_response(resp))
21511 }
21512 }
21513 #[allow(clippy::too_many_arguments)]
21514 #[allow(rustdoc::invalid_html_tags)]
21515 #[doc = "Use this method to send a native poll. On success, the sent Message is returned."]
21516 pub async fn send_poll<'a, V: Into<ChatHandle> + Serialize>(
21517 &self,
21518 business_connection_id: Option<&'a str>,
21519 chat_id: V,
21520 message_thread_id: Option<i64>,
21521 question: &'a str,
21522 question_parse_mode: Option<&'a str>,
21523 question_entities: Option<&'a Vec<MessageEntity>>,
21524 options: &'a Vec<InputPollOption>,
21525 is_anonymous: Option<bool>,
21526 tg_type: Option<&'a str>,
21527 allows_multiple_answers: Option<bool>,
21528 correct_option_id: Option<i64>,
21529 explanation: Option<&'a str>,
21530 explanation_parse_mode: Option<&'a str>,
21531 explanation_entities: Option<&'a Vec<MessageEntity>>,
21532 open_period: Option<i64>,
21533 close_date: Option<i64>,
21534 is_closed: Option<bool>,
21535 disable_notification: Option<bool>,
21536 protect_content: Option<bool>,
21537 allow_paid_broadcast: Option<bool>,
21538 message_effect_id: Option<&'a str>,
21539 reply_parameters: Option<&'a ReplyParameters>,
21540 reply_markup: Option<&'a EReplyMarkup>,
21541 ) -> BotResult<Message> {
21542 let form = SendPollOpts {
21543 business_connection_id,
21544 chat_id,
21545 message_thread_id,
21546 question,
21547 question_parse_mode,
21548 question_entities: if let Some(question_entities) = question_entities {
21549 Some(serde_json::to_string(&question_entities)?)
21550 } else {
21551 None
21552 },
21553 options: serde_json::to_string(&options)?,
21554 is_anonymous,
21555 tg_type,
21556 allows_multiple_answers,
21557 correct_option_id,
21558 explanation,
21559 explanation_parse_mode,
21560 explanation_entities: if let Some(explanation_entities) = explanation_entities {
21561 Some(serde_json::to_string(&explanation_entities)?)
21562 } else {
21563 None
21564 },
21565 open_period,
21566 close_date,
21567 is_closed,
21568 disable_notification,
21569 protect_content,
21570 allow_paid_broadcast,
21571 message_effect_id,
21572 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21573 Some(serde_json::to_string(&reply_parameters)?)
21574 } else {
21575 None
21576 },
21577 reply_markup: if let Some(reply_markup) = reply_markup {
21578 Some(serde_json::to_string(&reply_markup)?)
21579 } else {
21580 None
21581 },
21582 };
21583 let resp = self.post("sendPoll", form).await?;
21584 if resp.ok {
21585 let res = resp.result.unwrap_or_default();
21586 let resp = serde_json::from_value(res)?;
21587 Ok(resp)
21588 } else {
21589 Err(ApiError::from_response(resp))
21590 }
21591 }
21592 #[allow(clippy::too_many_arguments)]
21593 #[allow(rustdoc::invalid_html_tags)]
21594 #[doc = "Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned."]
21595 pub async fn answer_callback_query<'a>(
21596 &self,
21597 callback_query_id: &'a str,
21598 text: Option<&'a str>,
21599 show_alert: Option<bool>,
21600 url: Option<&'a str>,
21601 cache_time: Option<i64>,
21602 ) -> BotResult<bool> {
21603 let form = AnswerCallbackQueryOpts {
21604 callback_query_id,
21605 text,
21606 show_alert,
21607 url,
21608 cache_time,
21609 };
21610 let resp = self.post("answerCallbackQuery", form).await?;
21611 if resp.ok {
21612 let res = resp.result.unwrap_or_default();
21613 let resp = serde_json::from_value(res)?;
21614 Ok(resp)
21615 } else {
21616 Err(ApiError::from_response(resp))
21617 }
21618 }
21619 #[allow(clippy::too_many_arguments)]
21620 #[allow(rustdoc::invalid_html_tags)]
21621 #[doc = "Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned."]
21622 pub async fn forward_message<'a, V: Into<ChatHandle> + Serialize>(
21623 &self,
21624 chat_id: V,
21625 message_thread_id: Option<i64>,
21626 direct_messages_topic_id: Option<i64>,
21627 from_chat_id: V,
21628 video_start_timestamp: Option<i64>,
21629 disable_notification: Option<bool>,
21630 protect_content: Option<bool>,
21631 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21632 message_id: i64,
21633 ) -> BotResult<Message> {
21634 let form = ForwardMessageOpts {
21635 chat_id,
21636 message_thread_id,
21637 direct_messages_topic_id,
21638 from_chat_id,
21639 video_start_timestamp,
21640 disable_notification,
21641 protect_content,
21642 suggested_post_parameters: if let Some(suggested_post_parameters) =
21643 suggested_post_parameters
21644 {
21645 Some(serde_json::to_string(&suggested_post_parameters)?)
21646 } else {
21647 None
21648 },
21649 message_id,
21650 };
21651 let resp = self.post("forwardMessage", form).await?;
21652 if resp.ok {
21653 let res = resp.result.unwrap_or_default();
21654 let resp = serde_json::from_value(res)?;
21655 Ok(resp)
21656 } else {
21657 Err(ApiError::from_response(resp))
21658 }
21659 }
21660 #[allow(clippy::too_many_arguments)]
21661 #[allow(rustdoc::invalid_html_tags)]
21662 #[doc = "Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object."]
21663 pub async fn revoke_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
21664 &self,
21665 chat_id: V,
21666 invite_link: &'a str,
21667 ) -> BotResult<ChatInviteLink> {
21668 let form = RevokeChatInviteLinkOpts {
21669 chat_id,
21670 invite_link,
21671 };
21672 let resp = self.post("revokeChatInviteLink", form).await?;
21673 if resp.ok {
21674 let res = resp.result.unwrap_or_default();
21675 let resp = serde_json::from_value(res)?;
21676 Ok(resp)
21677 } else {
21678 Err(ApiError::from_response(resp))
21679 }
21680 }
21681 #[allow(clippy::too_many_arguments)]
21682 #[allow(rustdoc::invalid_html_tags)]
21683 #[doc = "Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned."]
21684 pub async fn stop_poll<'a, V: Into<ChatHandle> + Serialize>(
21685 &self,
21686 business_connection_id: Option<&'a str>,
21687 chat_id: V,
21688 message_id: i64,
21689 reply_markup: Option<&'a InlineKeyboardMarkup>,
21690 ) -> BotResult<Poll> {
21691 let form = StopPollOpts {
21692 business_connection_id,
21693 chat_id,
21694 message_id,
21695 reply_markup: if let Some(reply_markup) = reply_markup {
21696 Some(serde_json::to_string(&reply_markup)?)
21697 } else {
21698 None
21699 },
21700 };
21701 let resp = self.post("stopPoll", form).await?;
21702 if resp.ok {
21703 let res = resp.result.unwrap_or_default();
21704 let resp = serde_json::from_value(res)?;
21705 Ok(resp)
21706 } else {
21707 Err(ApiError::from_response(resp))
21708 }
21709 }
21710 #[allow(clippy::too_many_arguments)]
21711 #[allow(rustdoc::invalid_html_tags)]
21712 #[doc = "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
21713 pub async fn unhide_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
21714 &self,
21715 chat_id: V,
21716 ) -> BotResult<bool> {
21717 let form = UnhideGeneralForumTopicOpts { chat_id };
21718 let resp = self.post("unhideGeneralForumTopic", form).await?;
21719 if resp.ok {
21720 let res = resp.result.unwrap_or_default();
21721 let resp = serde_json::from_value(res)?;
21722 Ok(resp)
21723 } else {
21724 Err(ApiError::from_response(resp))
21725 }
21726 }
21727 #[allow(clippy::too_many_arguments)]
21728 #[allow(rustdoc::invalid_html_tags)]
21729 #[doc = "Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success."]
21730 pub async fn upload_sticker_file<'a>(
21731 &self,
21732 user_id: i64,
21733 sticker: FileData,
21734 sticker_format: &'a str,
21735 ) -> BotResult<File> {
21736 let data = Form::new();
21737 let (data, sticker_json) = sticker.convert_form(data, "sticker".to_owned())?;
21738 let form = UploadStickerFileOpts {
21739 user_id,
21740 sticker: sticker_json,
21741 sticker_format,
21742 };
21743 let resp = self.post_data("uploadStickerFile", form, data).await?;
21744 if resp.ok {
21745 let res = resp.result.unwrap_or_default();
21746 let resp = serde_json::from_value(res)?;
21747 Ok(resp)
21748 } else {
21749 Err(ApiError::from_response(resp))
21750 }
21751 }
21752 #[allow(clippy::too_many_arguments)]
21753 #[allow(rustdoc::invalid_html_tags)]
21754 #[doc = "Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
21755 pub async fn set_sticker_keywords<'a>(
21756 &self,
21757 sticker: &'a str,
21758 keywords: Option<&'a Vec<String>>,
21759 ) -> BotResult<bool> {
21760 let form = SetStickerKeywordsOpts {
21761 sticker,
21762 keywords: if let Some(keywords) = keywords {
21763 Some(serde_json::to_string(&keywords)?)
21764 } else {
21765 None
21766 },
21767 };
21768 let resp = self.post("setStickerKeywords", form).await?;
21769 if resp.ok {
21770 let res = resp.result.unwrap_or_default();
21771 let resp = serde_json::from_value(res)?;
21772 Ok(resp)
21773 } else {
21774 Err(ApiError::from_response(resp))
21775 }
21776 }
21777 #[allow(clippy::too_many_arguments)]
21778 #[allow(rustdoc::invalid_html_tags)]
21779 #[doc = "Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success."]
21780 pub async fn set_chat_menu_button<'a>(
21781 &self,
21782 chat_id: Option<i64>,
21783 menu_button: Option<&'a MenuButton>,
21784 ) -> BotResult<bool> {
21785 let form = SetChatMenuButtonOpts {
21786 chat_id,
21787 menu_button: if let Some(menu_button) = menu_button {
21788 Some(serde_json::to_string(&menu_button)?)
21789 } else {
21790 None
21791 },
21792 };
21793 let resp = self.post("setChatMenuButton", form).await?;
21794 if resp.ok {
21795 let res = resp.result.unwrap_or_default();
21796 let resp = serde_json::from_value(res)?;
21797 Ok(resp)
21798 } else {
21799 Err(ApiError::from_response(resp))
21800 }
21801 }
21802 #[allow(clippy::too_many_arguments)]
21803 #[allow(rustdoc::invalid_html_tags)]
21804 #[doc = "Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
21805 pub async fn edit_story<'a>(
21806 &self,
21807 business_connection_id: &'a str,
21808 story_id: i64,
21809 content: &'a InputStoryContent,
21810 caption: Option<&'a str>,
21811 parse_mode: Option<&'a str>,
21812 caption_entities: Option<&'a Vec<MessageEntity>>,
21813 areas: Option<&'a Vec<StoryArea>>,
21814 ) -> BotResult<Story> {
21815 let form = EditStoryOpts {
21816 business_connection_id,
21817 story_id,
21818 content: serde_json::to_string(&content)?,
21819 caption,
21820 parse_mode,
21821 caption_entities: if let Some(caption_entities) = caption_entities {
21822 Some(serde_json::to_string(&caption_entities)?)
21823 } else {
21824 None
21825 },
21826 areas: if let Some(areas) = areas {
21827 Some(serde_json::to_string(&areas)?)
21828 } else {
21829 None
21830 },
21831 };
21832 let resp = self.post("editStory", form).await?;
21833 if resp.ok {
21834 let res = resp.result.unwrap_or_default();
21835 let resp = serde_json::from_value(res)?;
21836 Ok(resp)
21837 } else {
21838 Err(ApiError::from_response(resp))
21839 }
21840 }
21841 #[allow(clippy::too_many_arguments)]
21842 #[allow(rustdoc::invalid_html_tags)]
21843 #[doc = "Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future."]
21844 pub async fn send_document<'a, V: Into<ChatHandle> + Serialize>(
21845 &self,
21846 business_connection_id: Option<&'a str>,
21847 chat_id: V,
21848 message_thread_id: Option<i64>,
21849 direct_messages_topic_id: Option<i64>,
21850 document: FileData,
21851 thumbnail: Option<FileData>,
21852 caption: Option<&'a str>,
21853 parse_mode: Option<&'a str>,
21854 caption_entities: Option<&'a Vec<MessageEntity>>,
21855 disable_content_type_detection: Option<bool>,
21856 disable_notification: Option<bool>,
21857 protect_content: Option<bool>,
21858 allow_paid_broadcast: Option<bool>,
21859 message_effect_id: Option<&'a str>,
21860 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21861 reply_parameters: Option<&'a ReplyParameters>,
21862 reply_markup: Option<&'a EReplyMarkup>,
21863 ) -> BotResult<Message> {
21864 let data = Form::new();
21865 let (data, document_json) = document.convert_form(data, "document".to_owned())?;
21866 let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
21867 let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
21868 (data, Some(thumbnail_json))
21869 } else {
21870 (data, None)
21871 };
21872 let form = SendDocumentOpts {
21873 business_connection_id,
21874 chat_id,
21875 message_thread_id,
21876 direct_messages_topic_id,
21877 document: document_json,
21878 thumbnail: thumbnail_json,
21879 caption,
21880 parse_mode,
21881 caption_entities: if let Some(caption_entities) = caption_entities {
21882 Some(serde_json::to_string(&caption_entities)?)
21883 } else {
21884 None
21885 },
21886 disable_content_type_detection,
21887 disable_notification,
21888 protect_content,
21889 allow_paid_broadcast,
21890 message_effect_id,
21891 suggested_post_parameters: if let Some(suggested_post_parameters) =
21892 suggested_post_parameters
21893 {
21894 Some(serde_json::to_string(&suggested_post_parameters)?)
21895 } else {
21896 None
21897 },
21898 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21899 Some(serde_json::to_string(&reply_parameters)?)
21900 } else {
21901 None
21902 },
21903 reply_markup: if let Some(reply_markup) = reply_markup {
21904 Some(serde_json::to_string(&reply_markup)?)
21905 } else {
21906 None
21907 },
21908 };
21909 let resp = self.post_data("sendDocument", form, data).await?;
21910 if resp.ok {
21911 let res = resp.result.unwrap_or_default();
21912 let resp = serde_json::from_value(res)?;
21913 Ok(resp)
21914 } else {
21915 Err(ApiError::from_response(resp))
21916 }
21917 }
21918 #[allow(clippy::too_many_arguments)]
21919 #[allow(rustdoc::invalid_html_tags)]
21920 #[doc = "Use this method to send information about a venue. On success, the sent Message is returned."]
21921 pub async fn send_venue<'a, V: Into<ChatHandle> + Serialize>(
21922 &self,
21923 business_connection_id: Option<&'a str>,
21924 chat_id: V,
21925 message_thread_id: Option<i64>,
21926 direct_messages_topic_id: Option<i64>,
21927 latitude: ::ordered_float::OrderedFloat<f64>,
21928 longitude: ::ordered_float::OrderedFloat<f64>,
21929 title: &'a str,
21930 address: &'a str,
21931 foursquare_id: Option<&'a str>,
21932 foursquare_type: Option<&'a str>,
21933 google_place_id: Option<&'a str>,
21934 google_place_type: Option<&'a str>,
21935 disable_notification: Option<bool>,
21936 protect_content: Option<bool>,
21937 allow_paid_broadcast: Option<bool>,
21938 message_effect_id: Option<&'a str>,
21939 suggested_post_parameters: Option<&'a SuggestedPostParameters>,
21940 reply_parameters: Option<&'a ReplyParameters>,
21941 reply_markup: Option<&'a EReplyMarkup>,
21942 ) -> BotResult<Message> {
21943 let form = SendVenueOpts {
21944 business_connection_id,
21945 chat_id,
21946 message_thread_id,
21947 direct_messages_topic_id,
21948 latitude,
21949 longitude,
21950 title,
21951 address,
21952 foursquare_id,
21953 foursquare_type,
21954 google_place_id,
21955 google_place_type,
21956 disable_notification,
21957 protect_content,
21958 allow_paid_broadcast,
21959 message_effect_id,
21960 suggested_post_parameters: if let Some(suggested_post_parameters) =
21961 suggested_post_parameters
21962 {
21963 Some(serde_json::to_string(&suggested_post_parameters)?)
21964 } else {
21965 None
21966 },
21967 reply_parameters: if let Some(reply_parameters) = reply_parameters {
21968 Some(serde_json::to_string(&reply_parameters)?)
21969 } else {
21970 None
21971 },
21972 reply_markup: if let Some(reply_markup) = reply_markup {
21973 Some(serde_json::to_string(&reply_markup)?)
21974 } else {
21975 None
21976 },
21977 };
21978 let resp = self.post("sendVenue", form).await?;
21979 if resp.ok {
21980 let res = resp.result.unwrap_or_default();
21981 let resp = serde_json::from_value(res)?;
21982 Ok(resp)
21983 } else {
21984 Err(ApiError::from_response(resp))
21985 }
21986 }
21987 #[allow(clippy::too_many_arguments)]
21988 #[allow(rustdoc::invalid_html_tags)]
21989 #[doc = "Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object."]
21990 pub async fn create_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
21991 &self,
21992 chat_id: V,
21993 name: &'a str,
21994 icon_color: Option<i64>,
21995 icon_custom_emoji_id: Option<&'a str>,
21996 ) -> BotResult<ForumTopic> {
21997 let form = CreateForumTopicOpts {
21998 chat_id,
21999 name,
22000 icon_color,
22001 icon_custom_emoji_id,
22002 };
22003 let resp = self.post("createForumTopic", form).await?;
22004 if resp.ok {
22005 let res = resp.result.unwrap_or_default();
22006 let resp = serde_json::from_value(res)?;
22007 Ok(resp)
22008 } else {
22009 Err(ApiError::from_response(resp))
22010 }
22011 }
22012 #[allow(clippy::too_many_arguments)]
22013 #[allow(rustdoc::invalid_html_tags)]
22014 #[doc = "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success."]
22015 pub async fn remove_user_verification<'a>(&self, user_id: i64) -> BotResult<bool> {
22016 let form = RemoveUserVerificationOpts { user_id };
22017 let resp = self.post("removeUserVerification", form).await?;
22018 if resp.ok {
22019 let res = resp.result.unwrap_or_default();
22020 let resp = serde_json::from_value(res)?;
22021 Ok(resp)
22022 } else {
22023 Err(ApiError::from_response(resp))
22024 }
22025 }
22026 #[allow(clippy::too_many_arguments)]
22027 #[allow(rustdoc::invalid_html_tags)]
22028 #[doc = "Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success."]
22029 pub async fn restrict_chat_member<'a, V: Into<ChatHandle> + Serialize>(
22030 &self,
22031 chat_id: V,
22032 user_id: i64,
22033 permissions: &'a ChatPermissions,
22034 use_independent_chat_permissions: Option<bool>,
22035 until_date: Option<i64>,
22036 ) -> BotResult<bool> {
22037 let form = RestrictChatMemberOpts {
22038 chat_id,
22039 user_id,
22040 permissions: serde_json::to_string(&permissions)?,
22041 use_independent_chat_permissions,
22042 until_date,
22043 };
22044 let resp = self.post("restrictChatMember", form).await?;
22045 if resp.ok {
22046 let res = resp.result.unwrap_or_default();
22047 let resp = serde_json::from_value(res)?;
22048 Ok(resp)
22049 } else {
22050 Err(ApiError::from_response(resp))
22051 }
22052 }
22053 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22054 #[allow(rustdoc::invalid_html_tags)]
22055 #[doc = "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
22056 pub fn build_edit_message_reply_markup<'a, V>(&'a self) -> CallEditMessageReplyMarkup<'a, V> {
22057 CallEditMessageReplyMarkup {
22058 bot: self,
22059 business_connection_id: None,
22060 chat_id: None,
22061 message_id: None,
22062 inline_message_id: None,
22063 reply_markup: None,
22064 }
22065 }
22066 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22067 #[allow(rustdoc::invalid_html_tags)]
22068 #[doc = "Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
22069 pub fn build_post_story<'a, A: Into<&'a InputStoryContent>>(
22070 &'a self,
22071 business_connection_id: &'a str,
22072 content: A,
22073 active_period: i64,
22074 ) -> CallPostStory<'a> {
22075 CallPostStory {
22076 bot: self,
22077 business_connection_id,
22078 content: content.into(),
22079 active_period,
22080 caption: None,
22081 parse_mode: None,
22082 caption_entities: None,
22083 areas: None,
22084 post_to_chat_page: None,
22085 protect_content: None,
22086 }
22087 }
22088 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22089 #[allow(rustdoc::invalid_html_tags)]
22090 #[doc = "Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success."]
22091 pub fn build_unban_chat_sender_chat<'a, V>(
22092 &'a self,
22093 chat_id: V,
22094 sender_chat_id: i64,
22095 ) -> CallUnbanChatSenderChat<'a, V> {
22096 CallUnbanChatSenderChat {
22097 bot: self,
22098 chat_id,
22099 sender_chat_id,
22100 }
22101 }
22102 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22103 #[allow(rustdoc::invalid_html_tags)]
22104 #[doc = "A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object."]
22105 pub fn build_get_me<'a>(&'a self) -> CallGetMe<'a> {
22106 CallGetMe { bot: self }
22107 }
22108 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22109 #[allow(rustdoc::invalid_html_tags)]
22110 #[doc = "Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success."]
22111 pub fn build_export_chat_invite_link<'a, V>(
22112 &'a self,
22113 chat_id: V,
22114 ) -> CallExportChatInviteLink<'a, V> {
22115 CallExportChatInviteLink { bot: self, chat_id }
22116 }
22117 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22118 #[allow(rustdoc::invalid_html_tags)]
22119 #[doc = "Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success."]
22120 pub fn build_get_chat_member<'a, V>(
22121 &'a self,
22122 chat_id: V,
22123 user_id: i64,
22124 ) -> CallGetChatMember<'a, V> {
22125 CallGetChatMember {
22126 bot: self,
22127 chat_id,
22128 user_id,
22129 }
22130 }
22131 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22132 #[allow(rustdoc::invalid_html_tags)]
22133 #[doc = "Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success."]
22134 pub fn build_set_custom_emoji_sticker_set_thumbnail<'a>(
22135 &'a self,
22136 name: &'a str,
22137 ) -> CallSetCustomEmojiStickerSetThumbnail<'a> {
22138 CallSetCustomEmojiStickerSetThumbnail {
22139 bot: self,
22140 name,
22141 custom_emoji_id: None,
22142 }
22143 }
22144 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22145 #[allow(rustdoc::invalid_html_tags)]
22146 #[doc = "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success."]
22147 pub fn build_set_user_emoji_status<'a>(&'a self, user_id: i64) -> CallSetUserEmojiStatus<'a> {
22148 CallSetUserEmojiStatus {
22149 bot: self,
22150 user_id,
22151 emoji_status_custom_emoji_id: None,
22152 emoji_status_expiration_date: None,
22153 }
22154 }
22155 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22156 #[allow(rustdoc::invalid_html_tags)]
22157 #[doc = "Use this method to send phone contacts. On success, the sent Message is returned."]
22158 pub fn build_send_contact<'a, V>(
22159 &'a self,
22160 chat_id: V,
22161 phone_number: &'a str,
22162 first_name: &'a str,
22163 ) -> CallSendContact<'a, V> {
22164 CallSendContact {
22165 bot: self,
22166 chat_id,
22167 phone_number,
22168 first_name,
22169 business_connection_id: None,
22170 message_thread_id: None,
22171 direct_messages_topic_id: None,
22172 last_name: None,
22173 vcard: None,
22174 disable_notification: None,
22175 protect_content: None,
22176 allow_paid_broadcast: None,
22177 message_effect_id: None,
22178 suggested_post_parameters: None,
22179 reply_parameters: None,
22180 reply_markup: None,
22181 }
22182 }
22183 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22184 #[allow(rustdoc::invalid_html_tags)]
22185 #[doc = "Use this method to send text messages. On success, the sent Message is returned."]
22186 pub fn build_send_message<'a, V>(
22187 &'a self,
22188 chat_id: V,
22189 text: &'a str,
22190 ) -> CallSendMessage<'a, V> {
22191 CallSendMessage {
22192 bot: self,
22193 chat_id,
22194 text,
22195 business_connection_id: None,
22196 message_thread_id: None,
22197 direct_messages_topic_id: None,
22198 parse_mode: None,
22199 entities: None,
22200 link_preview_options: None,
22201 disable_notification: None,
22202 protect_content: None,
22203 allow_paid_broadcast: None,
22204 message_effect_id: None,
22205 suggested_post_parameters: None,
22206 reply_parameters: None,
22207 reply_markup: None,
22208 }
22209 }
22210 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22211 #[allow(rustdoc::invalid_html_tags)]
22212 #[doc = "Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
22213 pub fn build_ban_chat_member<'a, V>(
22214 &'a self,
22215 chat_id: V,
22216 user_id: i64,
22217 ) -> CallBanChatMember<'a, V> {
22218 CallBanChatMember {
22219 bot: self,
22220 chat_id,
22221 user_id,
22222 until_date: None,
22223 revoke_messages: None,
22224 }
22225 }
22226 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22227 #[allow(rustdoc::invalid_html_tags)]
22228 #[doc = "Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object."]
22229 pub fn build_edit_chat_invite_link<'a, V>(
22230 &'a self,
22231 chat_id: V,
22232 invite_link: &'a str,
22233 ) -> CallEditChatInviteLink<'a, V> {
22234 CallEditChatInviteLink {
22235 bot: self,
22236 chat_id,
22237 invite_link,
22238 name: None,
22239 expire_date: None,
22240 member_limit: None,
22241 creates_join_request: None,
22242 }
22243 }
22244 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22245 #[allow(rustdoc::invalid_html_tags)]
22246 #[doc = "Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success."]
22247 pub fn build_unpin_chat_message<'a, V>(&'a self, chat_id: V) -> CallUnpinChatMessage<'a, V> {
22248 CallUnpinChatMessage {
22249 bot: self,
22250 chat_id,
22251 business_connection_id: None,
22252 message_id: None,
22253 }
22254 }
22255 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22256 #[allow(rustdoc::invalid_html_tags)]
22257 #[doc = "Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed."]
22258 pub fn build_answer_inline_query<'a>(
22259 &'a self,
22260 inline_query_id: &'a str,
22261 results: &'a Vec<InlineQueryResult>,
22262 ) -> CallAnswerInlineQuery<'a> {
22263 CallAnswerInlineQuery {
22264 bot: self,
22265 inline_query_id,
22266 results,
22267 cache_time: None,
22268 is_personal: None,
22269 next_offset: None,
22270 button: None,
22271 }
22272 }
22273 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22274 #[allow(rustdoc::invalid_html_tags)]
22275 #[doc = "Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received."]
22276 pub fn build_get_file<'a>(&'a self, file_id: &'a str) -> CallGetFile<'a> {
22277 CallGetFile { bot: self, file_id }
22278 }
22279 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22280 #[allow(rustdoc::invalid_html_tags)]
22281 #[doc = "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object."]
22282 pub fn build_get_star_transactions<'a>(&'a self) -> CallGetStarTransactions<'a> {
22283 CallGetStarTransactions {
22284 bot: self,
22285 offset: None,
22286 limit: None,
22287 }
22288 }
22289 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22290 #[allow(rustdoc::invalid_html_tags)]
22291 #[doc = "Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned."]
22292 pub fn build_forward_messages<'a, V>(
22293 &'a self,
22294 chat_id: V,
22295 from_chat_id: V,
22296 message_ids: &'a Vec<i64>,
22297 ) -> CallForwardMessages<'a, V> {
22298 CallForwardMessages {
22299 bot: self,
22300 chat_id,
22301 from_chat_id,
22302 message_ids,
22303 message_thread_id: None,
22304 direct_messages_topic_id: None,
22305 disable_notification: None,
22306 protect_content: None,
22307 }
22308 }
22309 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22310 #[allow(rustdoc::invalid_html_tags)]
22311 #[doc = "Use this method to get a sticker set. On success, a StickerSet object is returned."]
22312 pub fn build_get_sticker_set<'a>(&'a self, name: &'a str) -> CallGetStickerSet<'a> {
22313 CallGetStickerSet { bot: self, name }
22314 }
22315 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22316 #[allow(rustdoc::invalid_html_tags)]
22317 #[doc = "Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects."]
22318 pub fn build_get_forum_topic_icon_stickers<'a>(&'a self) -> CallGetForumTopicIconStickers<'a> {
22319 CallGetForumTopicIconStickers { bot: self }
22320 }
22321 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22322 #[allow(rustdoc::invalid_html_tags)]
22323 #[doc = "Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success."]
22324 pub fn build_transfer_gift<'a>(
22325 &'a self,
22326 business_connection_id: &'a str,
22327 owned_gift_id: &'a str,
22328 new_owner_chat_id: i64,
22329 ) -> CallTransferGift<'a> {
22330 CallTransferGift {
22331 bot: self,
22332 business_connection_id,
22333 owned_gift_id,
22334 new_owner_chat_id,
22335 star_count: None,
22336 }
22337 }
22338 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22339 #[allow(rustdoc::invalid_html_tags)]
22340 #[doc = "Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success."]
22341 pub fn build_delete_messages<'a, V>(
22342 &'a self,
22343 chat_id: V,
22344 message_ids: &'a Vec<i64>,
22345 ) -> CallDeleteMessages<'a, V> {
22346 CallDeleteMessages {
22347 bot: self,
22348 chat_id,
22349 message_ids,
22350 }
22351 }
22352 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22353 #[allow(rustdoc::invalid_html_tags)]
22354 #[doc = "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success."]
22355 pub fn build_reopen_general_forum_topic<'a, V>(
22356 &'a self,
22357 chat_id: V,
22358 ) -> CallReopenGeneralForumTopic<'a, V> {
22359 CallReopenGeneralForumTopic { bot: self, chat_id }
22360 }
22361 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22362 #[allow(rustdoc::invalid_html_tags)]
22363 #[doc = "Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned."]
22364 pub fn build_send_checklist<'a, A: Into<&'a InputChecklist>>(
22365 &'a self,
22366 business_connection_id: &'a str,
22367 chat_id: i64,
22368 checklist: A,
22369 ) -> CallSendChecklist<'a> {
22370 CallSendChecklist {
22371 bot: self,
22372 business_connection_id,
22373 chat_id,
22374 checklist: checklist.into(),
22375 disable_notification: None,
22376 protect_content: None,
22377 message_effect_id: None,
22378 reply_parameters: None,
22379 reply_markup: None,
22380 }
22381 }
22382 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22383 #[allow(rustdoc::invalid_html_tags)]
22384 #[doc = "Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
22385 pub fn build_delete_chat_photo<'a, V>(&'a self, chat_id: V) -> CallDeleteChatPhoto<'a, V> {
22386 CallDeleteChatPhoto { bot: self, chat_id }
22387 }
22388 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22389 #[allow(rustdoc::invalid_html_tags)]
22390 #[doc = "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success."]
22391 pub fn build_verify_user<'a>(&'a self, user_id: i64) -> CallVerifyUser<'a> {
22392 CallVerifyUser {
22393 bot: self,
22394 user_id,
22395 custom_description: None,
22396 }
22397 }
22398 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22399 #[allow(rustdoc::invalid_html_tags)]
22400 #[doc = "Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
22401 pub fn build_approve_chat_join_request<'a, V>(
22402 &'a self,
22403 chat_id: V,
22404 user_id: i64,
22405 ) -> CallApproveChatJoinRequest<'a, V> {
22406 CallApproveChatJoinRequest {
22407 bot: self,
22408 chat_id,
22409 user_id,
22410 }
22411 }
22412 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22413 #[allow(rustdoc::invalid_html_tags)]
22414 #[doc = "Use this method to send invoices. On success, the sent Message is returned."]
22415 pub fn build_send_invoice<'a, V>(
22416 &'a self,
22417 chat_id: V,
22418 title: &'a str,
22419 description: &'a str,
22420 payload: &'a str,
22421 currency: &'a str,
22422 prices: &'a Vec<LabeledPrice>,
22423 ) -> CallSendInvoice<'a, V> {
22424 CallSendInvoice {
22425 bot: self,
22426 chat_id,
22427 title,
22428 description,
22429 payload,
22430 currency,
22431 prices,
22432 message_thread_id: None,
22433 direct_messages_topic_id: None,
22434 provider_token: None,
22435 max_tip_amount: None,
22436 suggested_tip_amounts: None,
22437 start_parameter: None,
22438 provider_data: None,
22439 photo_url: None,
22440 photo_size: None,
22441 photo_width: None,
22442 photo_height: None,
22443 need_name: None,
22444 need_phone_number: None,
22445 need_email: None,
22446 need_shipping_address: None,
22447 send_phone_number_to_provider: None,
22448 send_email_to_provider: None,
22449 is_flexible: None,
22450 disable_notification: None,
22451 protect_content: None,
22452 allow_paid_broadcast: None,
22453 message_effect_id: None,
22454 suggested_post_parameters: None,
22455 reply_parameters: None,
22456 reply_markup: None,
22457 }
22458 }
22459 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22460 #[allow(rustdoc::invalid_html_tags)]
22461 #[doc = "Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
22462 pub fn build_close_forum_topic<'a, V>(
22463 &'a self,
22464 chat_id: V,
22465 message_thread_id: i64,
22466 ) -> CallCloseForumTopic<'a, V> {
22467 CallCloseForumTopic {
22468 bot: self,
22469 chat_id,
22470 message_thread_id,
22471 }
22472 }
22473 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22474 #[allow(rustdoc::invalid_html_tags)]
22475 #[doc = "Refunds a successful payment in Telegram Stars. Returns True on success."]
22476 pub fn build_refund_star_payment<'a>(
22477 &'a self,
22478 user_id: i64,
22479 telegram_payment_charge_id: &'a str,
22480 ) -> CallRefundStarPayment<'a> {
22481 CallRefundStarPayment {
22482 bot: self,
22483 user_id,
22484 telegram_payment_charge_id,
22485 }
22486 }
22487 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22488 #[allow(rustdoc::invalid_html_tags)]
22489 #[doc = "Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects."]
22490 pub fn build_get_updates<'a>(&'a self) -> CallGetUpdates<'a> {
22491 CallGetUpdates {
22492 bot: self,
22493 offset: None,
22494 limit: None,
22495 timeout: None,
22496 allowed_updates: None,
22497 }
22498 }
22499 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22500 #[allow(rustdoc::invalid_html_tags)]
22501 #[doc = "Use this method to send paid media. On success, the sent Message is returned."]
22502 pub fn build_send_paid_media<'a, V>(
22503 &'a self,
22504 chat_id: V,
22505 star_count: i64,
22506 media: &'a Vec<InputPaidMedia>,
22507 ) -> CallSendPaidMedia<'a, V> {
22508 CallSendPaidMedia {
22509 bot: self,
22510 chat_id,
22511 star_count,
22512 media,
22513 business_connection_id: None,
22514 message_thread_id: None,
22515 direct_messages_topic_id: None,
22516 payload: None,
22517 caption: None,
22518 parse_mode: None,
22519 caption_entities: None,
22520 show_caption_above_media: None,
22521 disable_notification: None,
22522 protect_content: None,
22523 allow_paid_broadcast: None,
22524 suggested_post_parameters: None,
22525 reply_parameters: None,
22526 reply_markup: None,
22527 }
22528 }
22529 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22530 #[allow(rustdoc::invalid_html_tags)]
22531 #[doc = "Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
22532 pub fn build_reopen_forum_topic<'a, V>(
22533 &'a self,
22534 chat_id: V,
22535 message_thread_id: i64,
22536 ) -> CallReopenForumTopic<'a, V> {
22537 CallReopenForumTopic {
22538 bot: self,
22539 chat_id,
22540 message_thread_id,
22541 }
22542 }
22543 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22544 #[allow(rustdoc::invalid_html_tags)]
22545 #[doc = "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned."]
22546 pub fn build_edit_message_live_location<'a, V>(
22547 &'a self,
22548 latitude: ::ordered_float::OrderedFloat<f64>,
22549 longitude: ::ordered_float::OrderedFloat<f64>,
22550 ) -> CallEditMessageLiveLocation<'a, V> {
22551 CallEditMessageLiveLocation {
22552 bot: self,
22553 latitude,
22554 longitude,
22555 business_connection_id: None,
22556 chat_id: None,
22557 message_id: None,
22558 inline_message_id: None,
22559 live_period: None,
22560 horizontal_accuracy: None,
22561 heading: None,
22562 proximity_alert_radius: None,
22563 reply_markup: None,
22564 }
22565 }
22566 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22567 #[allow(rustdoc::invalid_html_tags)]
22568 #[doc = "Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned."]
22569 pub fn build_edit_message_checklist<'a, A: Into<&'a InputChecklist>>(
22570 &'a self,
22571 business_connection_id: &'a str,
22572 chat_id: i64,
22573 message_id: i64,
22574 checklist: A,
22575 ) -> CallEditMessageChecklist<'a> {
22576 CallEditMessageChecklist {
22577 bot: self,
22578 business_connection_id,
22579 chat_id,
22580 message_id,
22581 checklist: checklist.into(),
22582 reply_markup: None,
22583 }
22584 }
22585 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22586 #[allow(rustdoc::invalid_html_tags)]
22587 #[doc = "Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success."]
22588 pub fn build_set_business_account_username<'a>(
22589 &'a self,
22590 business_connection_id: &'a str,
22591 ) -> CallSetBusinessAccountUsername<'a> {
22592 CallSetBusinessAccountUsername {
22593 bot: self,
22594 business_connection_id,
22595 username: None,
22596 }
22597 }
22598 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22599 #[allow(rustdoc::invalid_html_tags)]
22600 #[doc = "Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues."]
22601 pub fn build_set_passport_data_errors<'a>(
22602 &'a self,
22603 user_id: i64,
22604 errors: &'a Vec<PassportElementError>,
22605 ) -> CallSetPassportDataErrors<'a> {
22606 CallSetPassportDataErrors {
22607 bot: self,
22608 user_id,
22609 errors,
22610 }
22611 }
22612 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22613 #[allow(rustdoc::invalid_html_tags)]
22614 #[doc = "Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
22615 pub fn build_remove_business_account_profile_photo<'a>(
22616 &'a self,
22617 business_connection_id: &'a str,
22618 ) -> CallRemoveBusinessAccountProfilePhoto<'a> {
22619 CallRemoveBusinessAccountProfilePhoto {
22620 bot: self,
22621 business_connection_id,
22622 is_public: None,
22623 }
22624 }
22625 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22626 #[allow(rustdoc::invalid_html_tags)]
22627 #[doc = "Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success."]
22628 pub fn build_set_message_reaction<'a, V>(
22629 &'a self,
22630 chat_id: V,
22631 message_id: i64,
22632 ) -> CallSetMessageReaction<'a, V> {
22633 CallSetMessageReaction {
22634 bot: self,
22635 chat_id,
22636 message_id,
22637 reaction: None,
22638 is_big: None,
22639 }
22640 }
22641 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22642 #[allow(rustdoc::invalid_html_tags)]
22643 #[doc = "Use this method to send photos. On success, the sent Message is returned."]
22644 pub fn build_send_photo<'a, V>(&'a self, chat_id: V, photo: FileData) -> CallSendPhoto<'a, V> {
22645 CallSendPhoto {
22646 bot: self,
22647 chat_id,
22648 photo,
22649 business_connection_id: None,
22650 message_thread_id: None,
22651 direct_messages_topic_id: None,
22652 caption: None,
22653 parse_mode: None,
22654 caption_entities: None,
22655 show_caption_above_media: None,
22656 has_spoiler: None,
22657 disable_notification: None,
22658 protect_content: None,
22659 allow_paid_broadcast: None,
22660 message_effect_id: None,
22661 suggested_post_parameters: None,
22662 reply_parameters: None,
22663 reply_markup: None,
22664 }
22665 }
22666 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22667 #[allow(rustdoc::invalid_html_tags)]
22668 #[doc = "Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success."]
22669 pub fn build_upgrade_gift<'a>(
22670 &'a self,
22671 business_connection_id: &'a str,
22672 owned_gift_id: &'a str,
22673 ) -> CallUpgradeGift<'a> {
22674 CallUpgradeGift {
22675 bot: self,
22676 business_connection_id,
22677 owned_gift_id,
22678 keep_original_details: None,
22679 star_count: None,
22680 }
22681 }
22682 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22683 #[allow(rustdoc::invalid_html_tags)]
22684 #[doc = "Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there.- If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat.Returns True on success."]
22685 pub fn build_delete_message<'a, V>(
22686 &'a self,
22687 chat_id: V,
22688 message_id: i64,
22689 ) -> CallDeleteMessage<'a, V> {
22690 CallDeleteMessage {
22691 bot: self,
22692 chat_id,
22693 message_id,
22694 }
22695 }
22696 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22697 #[allow(rustdoc::invalid_html_tags)]
22698 #[doc = "Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object."]
22699 pub fn build_get_user_chat_boosts<'a, V>(
22700 &'a self,
22701 chat_id: V,
22702 user_id: i64,
22703 ) -> CallGetUserChatBoosts<'a, V> {
22704 CallGetUserChatBoosts {
22705 bot: self,
22706 chat_id,
22707 user_id,
22708 }
22709 }
22710 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22711 #[allow(rustdoc::invalid_html_tags)]
22712 #[doc = "Gifts a Telegram Premium subscription to the given user. Returns True on success."]
22713 pub fn build_gift_premium_subscription<'a>(
22714 &'a self,
22715 user_id: i64,
22716 month_count: i64,
22717 star_count: i64,
22718 ) -> CallGiftPremiumSubscription<'a> {
22719 CallGiftPremiumSubscription {
22720 bot: self,
22721 user_id,
22722 month_count,
22723 star_count,
22724 text: None,
22725 text_parse_mode: None,
22726 text_entities: None,
22727 }
22728 }
22729 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22730 #[allow(rustdoc::invalid_html_tags)]
22731 #[doc = "Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters."]
22732 pub fn build_log_out<'a>(&'a self) -> CallLogOut<'a> {
22733 CallLogOut { bot: self }
22734 }
22735 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22736 #[allow(rustdoc::invalid_html_tags)]
22737 #[doc = "Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success."]
22738 pub fn build_convert_gift_to_stars<'a>(
22739 &'a self,
22740 business_connection_id: &'a str,
22741 owned_gift_id: &'a str,
22742 ) -> CallConvertGiftToStars<'a> {
22743 CallConvertGiftToStars {
22744 bot: self,
22745 business_connection_id,
22746 owned_gift_id,
22747 }
22748 }
22749 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22750 #[allow(rustdoc::invalid_html_tags)]
22751 #[doc = "Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success."]
22752 pub fn build_copy_message<'a, V>(
22753 &'a self,
22754 chat_id: V,
22755 from_chat_id: V,
22756 message_id: i64,
22757 ) -> CallCopyMessage<'a, V> {
22758 CallCopyMessage {
22759 bot: self,
22760 chat_id,
22761 from_chat_id,
22762 message_id,
22763 message_thread_id: None,
22764 direct_messages_topic_id: None,
22765 video_start_timestamp: None,
22766 caption: None,
22767 parse_mode: None,
22768 caption_entities: None,
22769 show_caption_above_media: None,
22770 disable_notification: None,
22771 protect_content: None,
22772 allow_paid_broadcast: None,
22773 suggested_post_parameters: None,
22774 reply_parameters: None,
22775 reply_markup: None,
22776 }
22777 }
22778 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22779 #[allow(rustdoc::invalid_html_tags)]
22780 #[doc = "Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
22781 pub fn build_edit_forum_topic<'a, V>(
22782 &'a self,
22783 chat_id: V,
22784 message_thread_id: i64,
22785 ) -> CallEditForumTopic<'a, V> {
22786 CallEditForumTopic {
22787 bot: self,
22788 chat_id,
22789 message_thread_id,
22790 name: None,
22791 icon_custom_emoji_id: None,
22792 }
22793 }
22794 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22795 #[allow(rustdoc::invalid_html_tags)]
22796 #[doc = "Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success."]
22797 pub fn build_set_business_account_bio<'a>(
22798 &'a self,
22799 business_connection_id: &'a str,
22800 ) -> CallSetBusinessAccountBio<'a> {
22801 CallSetBusinessAccountBio {
22802 bot: self,
22803 business_connection_id,
22804 bio: None,
22805 }
22806 }
22807 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22808 #[allow(rustdoc::invalid_html_tags)]
22809 #[doc = "Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success."]
22810 pub fn build_get_chat<'a, V>(&'a self, chat_id: V) -> CallGetChat<'a, V> {
22811 CallGetChat { bot: self, chat_id }
22812 }
22813 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22814 #[allow(rustdoc::invalid_html_tags)]
22815 #[doc = "Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
22816 pub fn build_edit_message_media<'a, V, A: Into<&'a InputMedia>>(
22817 &'a self,
22818 media: A,
22819 ) -> CallEditMessageMedia<'a, V> {
22820 CallEditMessageMedia {
22821 bot: self,
22822 media: media.into(),
22823 business_connection_id: None,
22824 chat_id: None,
22825 message_id: None,
22826 inline_message_id: None,
22827 reply_markup: None,
22828 }
22829 }
22830 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22831 #[allow(rustdoc::invalid_html_tags)]
22832 #[doc = "Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False."]
22833 pub fn build_set_game_score<'a>(&'a self, user_id: i64, score: i64) -> CallSetGameScore<'a> {
22834 CallSetGameScore {
22835 bot: self,
22836 user_id,
22837 score,
22838 force: None,
22839 disable_edit_message: None,
22840 chat_id: None,
22841 message_id: None,
22842 inline_message_id: None,
22843 }
22844 }
22845 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22846 #[allow(rustdoc::invalid_html_tags)]
22847 #[doc = "Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects."]
22848 pub fn build_get_custom_emoji_stickers<'a>(
22849 &'a self,
22850 custom_emoji_ids: &'a Vec<String>,
22851 ) -> CallGetCustomEmojiStickers<'a> {
22852 CallGetCustomEmojiStickers {
22853 bot: self,
22854 custom_emoji_ids,
22855 }
22856 }
22857 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22858 #[allow(rustdoc::invalid_html_tags)]
22859 #[doc = "Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success."]
22860 pub fn build_set_chat_administrator_custom_title<'a, V>(
22861 &'a self,
22862 chat_id: V,
22863 user_id: i64,
22864 custom_title: &'a str,
22865 ) -> CallSetChatAdministratorCustomTitle<'a, V> {
22866 CallSetChatAdministratorCustomTitle {
22867 bot: self,
22868 chat_id,
22869 user_id,
22870 custom_title,
22871 }
22872 }
22873 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22874 #[allow(rustdoc::invalid_html_tags)]
22875 #[doc = "Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success."]
22876 pub fn build_send_gift<'a, V>(&'a self, gift_id: &'a str) -> CallSendGift<'a, V> {
22877 CallSendGift {
22878 bot: self,
22879 gift_id,
22880 user_id: None,
22881 chat_id: None,
22882 pay_for_upgrade: None,
22883 text: None,
22884 text_parse_mode: None,
22885 text_entities: None,
22886 }
22887 }
22888 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22889 #[allow(rustdoc::invalid_html_tags)]
22890 #[doc = "Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned."]
22891 pub fn build_send_dice<'a, V>(&'a self, chat_id: V) -> CallSendDice<'a, V> {
22892 CallSendDice {
22893 bot: self,
22894 chat_id,
22895 business_connection_id: None,
22896 message_thread_id: None,
22897 direct_messages_topic_id: None,
22898 emoji: None,
22899 disable_notification: None,
22900 protect_content: None,
22901 allow_paid_broadcast: None,
22902 message_effect_id: None,
22903 suggested_post_parameters: None,
22904 reply_parameters: None,
22905 reply_markup: None,
22906 }
22907 }
22908 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22909 #[allow(rustdoc::invalid_html_tags)]
22910 #[doc = "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
22911 pub fn build_unpin_all_general_forum_topic_messages<'a, V>(
22912 &'a self,
22913 chat_id: V,
22914 ) -> CallUnpinAllGeneralForumTopicMessages<'a, V> {
22915 CallUnpinAllGeneralForumTopicMessages { bot: self, chat_id }
22916 }
22917 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22918 #[allow(rustdoc::invalid_html_tags)]
22919 #[doc = "Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned."]
22920 pub fn build_get_my_commands<'a>(&'a self) -> CallGetMyCommands<'a> {
22921 CallGetMyCommands {
22922 bot: self,
22923 scope: None,
22924 language_code: None,
22925 }
22926 }
22927 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22928 #[allow(rustdoc::invalid_html_tags)]
22929 #[doc = "Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
22930 pub fn build_set_business_account_profile_photo<'a, A: Into<&'a InputProfilePhoto>>(
22931 &'a self,
22932 business_connection_id: &'a str,
22933 photo: A,
22934 ) -> CallSetBusinessAccountProfilePhoto<'a> {
22935 CallSetBusinessAccountProfilePhoto {
22936 bot: self,
22937 business_connection_id,
22938 photo: photo.into(),
22939 is_public: None,
22940 }
22941 }
22942 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22943 #[allow(rustdoc::invalid_html_tags)]
22944 #[doc = "Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object."]
22945 pub fn build_create_chat_invite_link<'a, V>(
22946 &'a self,
22947 chat_id: V,
22948 ) -> CallCreateChatInviteLink<'a, V> {
22949 CallCreateChatInviteLink {
22950 bot: self,
22951 chat_id,
22952 name: None,
22953 expire_date: None,
22954 member_limit: None,
22955 creates_join_request: None,
22956 }
22957 }
22958 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22959 #[allow(rustdoc::invalid_html_tags)]
22960 #[doc = "Use this method to delete a sticker from a set created by the bot. Returns True on success."]
22961 pub fn build_delete_sticker_from_set<'a>(
22962 &'a self,
22963 sticker: &'a str,
22964 ) -> CallDeleteStickerFromSet<'a> {
22965 CallDeleteStickerFromSet { bot: self, sticker }
22966 }
22967 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22968 #[allow(rustdoc::invalid_html_tags)]
22969 #[doc = "Use this method to get the current bot description for the given user language. Returns BotDescription on success."]
22970 pub fn build_get_my_description<'a>(&'a self) -> CallGetMyDescription<'a> {
22971 CallGetMyDescription {
22972 bot: self,
22973 language_code: None,
22974 }
22975 }
22976 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22977 #[allow(rustdoc::invalid_html_tags)]
22978 #[doc = "A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object."]
22979 pub fn build_get_my_star_balance<'a>(&'a self) -> CallGetMyStarBalance<'a> {
22980 CallGetMyStarBalance { bot: self }
22981 }
22982 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
22983 #[allow(rustdoc::invalid_html_tags)]
22984 #[doc = "Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned."]
22985 pub fn build_send_media_group<'a, V>(
22986 &'a self,
22987 chat_id: V,
22988 media: &'a Vec<EMedia>,
22989 ) -> CallSendMediaGroup<'a, V> {
22990 CallSendMediaGroup {
22991 bot: self,
22992 chat_id,
22993 media,
22994 business_connection_id: None,
22995 message_thread_id: None,
22996 direct_messages_topic_id: None,
22997 disable_notification: None,
22998 protect_content: None,
22999 allow_paid_broadcast: None,
23000 message_effect_id: None,
23001 reply_parameters: None,
23002 }
23003 }
23004 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23005 #[allow(rustdoc::invalid_html_tags)]
23006 #[doc = "Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty."]
23007 pub fn build_get_webhook_info<'a>(&'a self) -> CallGetWebhookInfo<'a> {
23008 CallGetWebhookInfo { bot: self }
23009 }
23010 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23011 #[allow(rustdoc::invalid_html_tags)]
23012 #[doc = "Use this method to get the number of members in a chat. Returns Int on success."]
23013 pub fn build_get_chat_member_count<'a, V>(
23014 &'a self,
23015 chat_id: V,
23016 ) -> CallGetChatMemberCount<'a, V> {
23017 CallGetChatMemberCount { bot: self, chat_id }
23018 }
23019 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23020 #[allow(rustdoc::invalid_html_tags)]
23021 #[doc = "Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent."]
23022 pub fn build_answer_pre_checkout_query<'a>(
23023 &'a self,
23024 pre_checkout_query_id: &'a str,
23025 ok: bool,
23026 ) -> CallAnswerPreCheckoutQuery<'a> {
23027 CallAnswerPreCheckoutQuery {
23028 bot: self,
23029 pre_checkout_query_id,
23030 ok,
23031 error_message: None,
23032 }
23033 }
23034 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23035 #[allow(rustdoc::invalid_html_tags)]
23036 #[doc = "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success."]
23037 pub fn build_remove_chat_verification<'a, V>(
23038 &'a self,
23039 chat_id: V,
23040 ) -> CallRemoveChatVerification<'a, V> {
23041 CallRemoveChatVerification { bot: self, chat_id }
23042 }
23043 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23044 #[allow(rustdoc::invalid_html_tags)]
23045 #[doc = "Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned."]
23046 pub fn build_copy_messages<'a, V>(
23047 &'a self,
23048 chat_id: V,
23049 from_chat_id: V,
23050 message_ids: &'a Vec<i64>,
23051 ) -> CallCopyMessages<'a, V> {
23052 CallCopyMessages {
23053 bot: self,
23054 chat_id,
23055 from_chat_id,
23056 message_ids,
23057 message_thread_id: None,
23058 direct_messages_topic_id: None,
23059 disable_notification: None,
23060 protect_content: None,
23061 remove_caption: None,
23062 }
23063 }
23064 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23065 #[allow(rustdoc::invalid_html_tags)]
23066 #[doc = "Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success."]
23067 pub fn build_set_sticker_set_thumbnail<'a>(
23068 &'a self,
23069 name: &'a str,
23070 user_id: i64,
23071 format: &'a str,
23072 ) -> CallSetStickerSetThumbnail<'a> {
23073 CallSetStickerSetThumbnail {
23074 bot: self,
23075 name,
23076 user_id,
23077 format,
23078 thumbnail: None,
23079 }
23080 }
23081 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23082 #[allow(rustdoc::invalid_html_tags)]
23083 #[doc = "Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success."]
23084 pub fn build_delete_my_commands<'a>(&'a self) -> CallDeleteMyCommands<'a> {
23085 CallDeleteMyCommands {
23086 bot: self,
23087 scope: None,
23088 language_code: None,
23089 }
23090 }
23091 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23092 #[allow(rustdoc::invalid_html_tags)]
23093 #[doc = "Use this method to delete a sticker set that was created by the bot. Returns True on success."]
23094 pub fn build_delete_sticker_set<'a>(&'a self, name: &'a str) -> CallDeleteStickerSet<'a> {
23095 CallDeleteStickerSet { bot: self, name }
23096 }
23097 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23098 #[allow(rustdoc::invalid_html_tags)]
23099 #[doc = "Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
23100 pub fn build_set_chat_description<'a, V>(
23101 &'a self,
23102 chat_id: V,
23103 ) -> CallSetChatDescription<'a, V> {
23104 CallSetChatDescription {
23105 bot: self,
23106 chat_id,
23107 description: None,
23108 }
23109 }
23110 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23111 #[allow(rustdoc::invalid_html_tags)]
23112 #[doc = "Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
23113 pub fn build_set_sticker_emoji_list<'a>(
23114 &'a self,
23115 sticker: &'a str,
23116 emoji_list: &'a Vec<String>,
23117 ) -> CallSetStickerEmojiList<'a> {
23118 CallSetStickerEmojiList {
23119 bot: self,
23120 sticker,
23121 emoji_list,
23122 }
23123 }
23124 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23125 #[allow(rustdoc::invalid_html_tags)]
23126 #[doc = "Use this method to send point on the map. On success, the sent Message is returned."]
23127 pub fn build_send_location<'a, V>(
23128 &'a self,
23129 chat_id: V,
23130 latitude: ::ordered_float::OrderedFloat<f64>,
23131 longitude: ::ordered_float::OrderedFloat<f64>,
23132 ) -> CallSendLocation<'a, V> {
23133 CallSendLocation {
23134 bot: self,
23135 chat_id,
23136 latitude,
23137 longitude,
23138 business_connection_id: None,
23139 message_thread_id: None,
23140 direct_messages_topic_id: None,
23141 horizontal_accuracy: None,
23142 live_period: None,
23143 heading: None,
23144 proximity_alert_radius: None,
23145 disable_notification: None,
23146 protect_content: None,
23147 allow_paid_broadcast: None,
23148 message_effect_id: None,
23149 suggested_post_parameters: None,
23150 reply_parameters: None,
23151 reply_markup: None,
23152 }
23153 }
23154 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23155 #[allow(rustdoc::invalid_html_tags)]
23156 #[doc = "Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
23157 pub fn build_set_chat_title<'a, V>(
23158 &'a self,
23159 chat_id: V,
23160 title: &'a str,
23161 ) -> CallSetChatTitle<'a, V> {
23162 CallSetChatTitle {
23163 bot: self,
23164 chat_id,
23165 title,
23166 }
23167 }
23168 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23169 #[allow(rustdoc::invalid_html_tags)]
23170 #[doc = "Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success."]
23171 pub fn build_replace_sticker_in_set<'a, A: Into<&'a InputSticker>>(
23172 &'a self,
23173 user_id: i64,
23174 name: &'a str,
23175 old_sticker: &'a str,
23176 sticker: A,
23177 ) -> CallReplaceStickerInSet<'a> {
23178 CallReplaceStickerInSet {
23179 bot: self,
23180 user_id,
23181 name,
23182 old_sticker,
23183 sticker: sticker.into(),
23184 }
23185 }
23186 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23187 #[allow(rustdoc::invalid_html_tags)]
23188 #[doc = "Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success."]
23189 pub fn build_decline_suggested_post<'a>(
23190 &'a self,
23191 chat_id: i64,
23192 message_id: i64,
23193 ) -> CallDeclineSuggestedPost<'a> {
23194 CallDeclineSuggestedPost {
23195 bot: self,
23196 chat_id,
23197 message_id,
23198 comment: None,
23199 }
23200 }
23201 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23202 #[allow(rustdoc::invalid_html_tags)]
23203 #[doc = "Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success."]
23204 pub fn build_set_my_short_description<'a>(&'a self) -> CallSetMyShortDescription<'a> {
23205 CallSetMyShortDescription {
23206 bot: self,
23207 short_description: None,
23208 language_code: None,
23209 }
23210 }
23211 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23212 #[allow(rustdoc::invalid_html_tags)]
23213 #[doc = "Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success."]
23214 pub fn build_get_my_default_administrator_rights<'a>(
23215 &'a self,
23216 ) -> CallGetMyDefaultAdministratorRights<'a> {
23217 CallGetMyDefaultAdministratorRights {
23218 bot: self,
23219 for_channels: None,
23220 }
23221 }
23222 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23223 #[allow(rustdoc::invalid_html_tags)]
23224 #[doc = "Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success."]
23225 pub fn build_get_business_account_star_balance<'a>(
23226 &'a self,
23227 business_connection_id: &'a str,
23228 ) -> CallGetBusinessAccountStarBalance<'a> {
23229 CallGetBusinessAccountStarBalance {
23230 bot: self,
23231 business_connection_id,
23232 }
23233 }
23234 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23235 #[allow(rustdoc::invalid_html_tags)]
23236 #[doc = "Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
23237 pub fn build_delete_chat_sticker_set<'a, V>(
23238 &'a self,
23239 chat_id: V,
23240 ) -> CallDeleteChatStickerSet<'a, V> {
23241 CallDeleteChatStickerSet { bot: self, chat_id }
23242 }
23243 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23244 #[allow(rustdoc::invalid_html_tags)]
23245 #[doc = "Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future."]
23246 pub fn build_send_animation<'a, V>(
23247 &'a self,
23248 chat_id: V,
23249 animation: FileData,
23250 ) -> CallSendAnimation<'a, V> {
23251 CallSendAnimation {
23252 bot: self,
23253 chat_id,
23254 animation,
23255 business_connection_id: None,
23256 message_thread_id: None,
23257 direct_messages_topic_id: None,
23258 duration: None,
23259 width: None,
23260 height: None,
23261 thumbnail: None,
23262 caption: None,
23263 parse_mode: None,
23264 caption_entities: None,
23265 show_caption_above_media: None,
23266 has_spoiler: None,
23267 disable_notification: None,
23268 protect_content: None,
23269 allow_paid_broadcast: None,
23270 message_effect_id: None,
23271 suggested_post_parameters: None,
23272 reply_parameters: None,
23273 reply_markup: None,
23274 }
23275 }
23276 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23277 #[allow(rustdoc::invalid_html_tags)]
23278 #[doc = "Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success."]
23279 pub fn build_add_sticker_to_set<'a, A: Into<&'a InputSticker>>(
23280 &'a self,
23281 user_id: i64,
23282 name: &'a str,
23283 sticker: A,
23284 ) -> CallAddStickerToSet<'a> {
23285 CallAddStickerToSet {
23286 bot: self,
23287 user_id,
23288 name,
23289 sticker: sticker.into(),
23290 }
23291 }
23292 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23293 #[allow(rustdoc::invalid_html_tags)]
23294 #[doc = "Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success."]
23295 pub fn build_delete_webhook<'a>(&'a self) -> CallDeleteWebhook<'a> {
23296 CallDeleteWebhook {
23297 bot: self,
23298 drop_pending_updates: None,
23299 }
23300 }
23301 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23302 #[allow(rustdoc::invalid_html_tags)]
23303 #[doc = "Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success."]
23304 pub fn build_unpin_all_chat_messages<'a, V>(
23305 &'a self,
23306 chat_id: V,
23307 ) -> CallUnpinAllChatMessages<'a, V> {
23308 CallUnpinAllChatMessages { bot: self, chat_id }
23309 }
23310 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23311 #[allow(rustdoc::invalid_html_tags)]
23312 #[doc = "Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
23313 pub fn build_decline_chat_join_request<'a, V>(
23314 &'a self,
23315 chat_id: V,
23316 user_id: i64,
23317 ) -> CallDeclineChatJoinRequest<'a, V> {
23318 CallDeclineChatJoinRequest {
23319 bot: self,
23320 chat_id,
23321 user_id,
23322 }
23323 }
23324 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23325 #[allow(rustdoc::invalid_html_tags)]
23326 #[doc = "Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success."]
23327 pub fn build_read_business_message<'a>(
23328 &'a self,
23329 business_connection_id: &'a str,
23330 chat_id: i64,
23331 message_id: i64,
23332 ) -> CallReadBusinessMessage<'a> {
23333 CallReadBusinessMessage {
23334 bot: self,
23335 business_connection_id,
23336 chat_id,
23337 message_id,
23338 }
23339 }
23340 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23341 #[allow(rustdoc::invalid_html_tags)]
23342 #[doc = "Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success."]
23343 pub fn build_set_sticker_mask_position<'a>(
23344 &'a self,
23345 sticker: &'a str,
23346 ) -> CallSetStickerMaskPosition<'a> {
23347 CallSetStickerMaskPosition {
23348 bot: self,
23349 sticker,
23350 mask_position: None,
23351 }
23352 }
23353 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23354 #[allow(rustdoc::invalid_html_tags)]
23355 #[doc = "Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success."]
23356 pub fn build_set_my_default_administrator_rights<'a>(
23357 &'a self,
23358 ) -> CallSetMyDefaultAdministratorRights<'a> {
23359 CallSetMyDefaultAdministratorRights {
23360 bot: self,
23361 rights: None,
23362 for_channels: None,
23363 }
23364 }
23365 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23366 #[allow(rustdoc::invalid_html_tags)]
23367 #[doc = "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success."]
23368 pub fn build_edit_user_star_subscription<'a>(
23369 &'a self,
23370 user_id: i64,
23371 telegram_payment_charge_id: &'a str,
23372 is_canceled: bool,
23373 ) -> CallEditUserStarSubscription<'a> {
23374 CallEditUserStarSubscription {
23375 bot: self,
23376 user_id,
23377 telegram_payment_charge_id,
23378 is_canceled,
23379 }
23380 }
23381 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23382 #[allow(rustdoc::invalid_html_tags)]
23383 #[doc = "Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects."]
23384 pub fn build_get_game_high_scores<'a>(&'a self, user_id: i64) -> CallGetGameHighScores<'a> {
23385 CallGetGameHighScores {
23386 bot: self,
23387 user_id,
23388 chat_id: None,
23389 message_id: None,
23390 inline_message_id: None,
23391 }
23392 }
23393 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23394 #[allow(rustdoc::invalid_html_tags)]
23395 #[doc = "Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive."]
23396 pub fn build_send_chat_action<'a, V>(
23397 &'a self,
23398 chat_id: V,
23399 action: &'a str,
23400 ) -> CallSendChatAction<'a, V> {
23401 CallSendChatAction {
23402 bot: self,
23403 chat_id,
23404 action,
23405 business_connection_id: None,
23406 message_thread_id: None,
23407 }
23408 }
23409 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23410 #[allow(rustdoc::invalid_html_tags)]
23411 #[doc = "Use this method to get the current bot name for the given user language. Returns BotName on success."]
23412 pub fn build_get_my_name<'a>(&'a self) -> CallGetMyName<'a> {
23413 CallGetMyName {
23414 bot: self,
23415 language_code: None,
23416 }
23417 }
23418 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23419 #[allow(rustdoc::invalid_html_tags)]
23420 #[doc = "Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
23421 pub fn build_set_chat_sticker_set<'a, V>(
23422 &'a self,
23423 chat_id: V,
23424 sticker_set_name: &'a str,
23425 ) -> CallSetChatStickerSet<'a, V> {
23426 CallSetChatStickerSet {
23427 bot: self,
23428 chat_id,
23429 sticker_set_name,
23430 }
23431 }
23432 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23433 #[allow(rustdoc::invalid_html_tags)]
23434 #[doc = "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header \"X-Telegram-Bot-Api-Secret-Token\" with the secret token as content."]
23435 pub fn build_set_webhook<'a>(&'a self, url: &'a str) -> CallSetWebhook<'a> {
23436 CallSetWebhook {
23437 bot: self,
23438 url,
23439 certificate: None,
23440 ip_address: None,
23441 max_connections: None,
23442 allowed_updates: None,
23443 drop_pending_updates: None,
23444 secret_token: None,
23445 }
23446 }
23447 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23448 #[allow(rustdoc::invalid_html_tags)]
23449 #[doc = "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success."]
23450 pub fn build_verify_chat<'a, V>(&'a self, chat_id: V) -> CallVerifyChat<'a, V> {
23451 CallVerifyChat {
23452 bot: self,
23453 chat_id,
23454 custom_description: None,
23455 }
23456 }
23457 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23458 #[allow(rustdoc::invalid_html_tags)]
23459 #[doc = "Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters."]
23460 pub fn build_close<'a>(&'a self) -> CallClose<'a> {
23461 CallClose { bot: self }
23462 }
23463 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23464 #[allow(rustdoc::invalid_html_tags)]
23465 #[doc = "Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned."]
23466 pub fn build_answer_web_app_query<'a, A: Into<&'a InlineQueryResult>>(
23467 &'a self,
23468 web_app_query_id: &'a str,
23469 result: A,
23470 ) -> CallAnswerWebAppQuery<'a> {
23471 CallAnswerWebAppQuery {
23472 bot: self,
23473 web_app_query_id,
23474 result: result.into(),
23475 }
23476 }
23477 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23478 #[allow(rustdoc::invalid_html_tags)]
23479 #[doc = "Use this method for your bot to leave a group, supergroup or channel. Returns True on success."]
23480 pub fn build_leave_chat<'a, V>(&'a self, chat_id: V) -> CallLeaveChat<'a, V> {
23481 CallLeaveChat { bot: self, chat_id }
23482 }
23483 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23484 #[allow(rustdoc::invalid_html_tags)]
23485 #[doc = "Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future."]
23486 pub fn build_send_voice<'a, V>(&'a self, chat_id: V, voice: FileData) -> CallSendVoice<'a, V> {
23487 CallSendVoice {
23488 bot: self,
23489 chat_id,
23490 voice,
23491 business_connection_id: None,
23492 message_thread_id: None,
23493 direct_messages_topic_id: None,
23494 caption: None,
23495 parse_mode: None,
23496 caption_entities: None,
23497 duration: None,
23498 disable_notification: None,
23499 protect_content: None,
23500 allow_paid_broadcast: None,
23501 message_effect_id: None,
23502 suggested_post_parameters: None,
23503 reply_parameters: None,
23504 reply_markup: None,
23505 }
23506 }
23507 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23508 #[allow(rustdoc::invalid_html_tags)]
23509 #[doc = "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
23510 pub fn build_edit_general_forum_topic<'a, V>(
23511 &'a self,
23512 chat_id: V,
23513 name: &'a str,
23514 ) -> CallEditGeneralForumTopic<'a, V> {
23515 CallEditGeneralForumTopic {
23516 bot: self,
23517 chat_id,
23518 name,
23519 }
23520 }
23521 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23522 #[allow(rustdoc::invalid_html_tags)]
23523 #[doc = "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object."]
23524 pub fn build_save_prepared_inline_message<'a, A: Into<&'a InlineQueryResult>>(
23525 &'a self,
23526 user_id: i64,
23527 result: A,
23528 ) -> CallSavePreparedInlineMessage<'a> {
23529 CallSavePreparedInlineMessage {
23530 bot: self,
23531 user_id,
23532 result: result.into(),
23533 allow_user_chats: None,
23534 allow_bot_chats: None,
23535 allow_group_chats: None,
23536 allow_channel_chats: None,
23537 }
23538 }
23539 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23540 #[allow(rustdoc::invalid_html_tags)]
23541 #[doc = "Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success."]
23542 pub fn build_transfer_business_account_stars<'a>(
23543 &'a self,
23544 business_connection_id: &'a str,
23545 star_count: i64,
23546 ) -> CallTransferBusinessAccountStars<'a> {
23547 CallTransferBusinessAccountStars {
23548 bot: self,
23549 business_connection_id,
23550 star_count,
23551 }
23552 }
23553 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23554 #[allow(rustdoc::invalid_html_tags)]
23555 #[doc = "Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success."]
23556 pub fn build_promote_chat_member<'a, V>(
23557 &'a self,
23558 chat_id: V,
23559 user_id: i64,
23560 ) -> CallPromoteChatMember<'a, V> {
23561 CallPromoteChatMember {
23562 bot: self,
23563 chat_id,
23564 user_id,
23565 is_anonymous: None,
23566 can_manage_chat: None,
23567 can_delete_messages: None,
23568 can_manage_video_chats: None,
23569 can_restrict_members: None,
23570 can_promote_members: None,
23571 can_change_info: None,
23572 can_invite_users: None,
23573 can_post_stories: None,
23574 can_edit_stories: None,
23575 can_delete_stories: None,
23576 can_post_messages: None,
23577 can_edit_messages: None,
23578 can_pin_messages: None,
23579 can_manage_topics: None,
23580 can_manage_direct_messages: None,
23581 }
23582 }
23583 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23584 #[allow(rustdoc::invalid_html_tags)]
23585 #[doc = "Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success."]
23586 pub fn build_pin_chat_message<'a, V>(
23587 &'a self,
23588 chat_id: V,
23589 message_id: i64,
23590 ) -> CallPinChatMessage<'a, V> {
23591 CallPinChatMessage {
23592 bot: self,
23593 chat_id,
23594 message_id,
23595 business_connection_id: None,
23596 disable_notification: None,
23597 }
23598 }
23599 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23600 #[allow(rustdoc::invalid_html_tags)]
23601 #[doc = "Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success."]
23602 pub fn build_get_my_short_description<'a>(&'a self) -> CallGetMyShortDescription<'a> {
23603 CallGetMyShortDescription {
23604 bot: self,
23605 language_code: None,
23606 }
23607 }
23608 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23609 #[allow(rustdoc::invalid_html_tags)]
23610 #[doc = "Use this method to create a link for an invoice. Returns the created invoice link as String on success."]
23611 pub fn build_create_invoice_link<'a>(
23612 &'a self,
23613 title: &'a str,
23614 description: &'a str,
23615 payload: &'a str,
23616 currency: &'a str,
23617 prices: &'a Vec<LabeledPrice>,
23618 ) -> CallCreateInvoiceLink<'a> {
23619 CallCreateInvoiceLink {
23620 bot: self,
23621 title,
23622 description,
23623 payload,
23624 currency,
23625 prices,
23626 business_connection_id: None,
23627 provider_token: None,
23628 subscription_period: None,
23629 max_tip_amount: None,
23630 suggested_tip_amounts: None,
23631 provider_data: None,
23632 photo_url: None,
23633 photo_size: None,
23634 photo_width: None,
23635 photo_height: None,
23636 need_name: None,
23637 need_phone_number: None,
23638 need_email: None,
23639 need_shipping_address: None,
23640 send_phone_number_to_provider: None,
23641 send_email_to_provider: None,
23642 is_flexible: None,
23643 }
23644 }
23645 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23646 #[allow(rustdoc::invalid_html_tags)]
23647 #[doc = "Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object."]
23648 pub fn build_get_available_gifts<'a>(&'a self) -> CallGetAvailableGifts<'a> {
23649 CallGetAvailableGifts { bot: self }
23650 }
23651 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23652 #[allow(rustdoc::invalid_html_tags)]
23653 #[doc = "Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
23654 pub fn build_set_chat_photo<'a, V>(
23655 &'a self,
23656 chat_id: V,
23657 photo: FileData,
23658 ) -> CallSetChatPhoto<'a, V> {
23659 CallSetChatPhoto {
23660 bot: self,
23661 chat_id,
23662 photo,
23663 }
23664 }
23665 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23666 #[allow(rustdoc::invalid_html_tags)]
23667 #[doc = "Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success."]
23668 pub fn build_set_my_description<'a>(&'a self) -> CallSetMyDescription<'a> {
23669 CallSetMyDescription {
23670 bot: self,
23671 description: None,
23672 language_code: None,
23673 }
23674 }
23675 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23676 #[allow(rustdoc::invalid_html_tags)]
23677 #[doc = "Use this method to change the bot's name. Returns True on success."]
23678 pub fn build_set_my_name<'a>(&'a self) -> CallSetMyName<'a> {
23679 CallSetMyName {
23680 bot: self,
23681 name: None,
23682 language_code: None,
23683 }
23684 }
23685 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23686 #[allow(rustdoc::invalid_html_tags)]
23687 #[doc = "Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success."]
23688 pub fn build_set_my_commands<'a>(
23689 &'a self,
23690 commands: &'a Vec<BotCommand>,
23691 ) -> CallSetMyCommands<'a> {
23692 CallSetMyCommands {
23693 bot: self,
23694 commands,
23695 scope: None,
23696 language_code: None,
23697 }
23698 }
23699 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23700 #[allow(rustdoc::invalid_html_tags)]
23701 #[doc = "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
23702 pub fn build_edit_message_caption<'a, V>(&'a self) -> CallEditMessageCaption<'a, V> {
23703 CallEditMessageCaption {
23704 bot: self,
23705 business_connection_id: None,
23706 chat_id: None,
23707 message_id: None,
23708 inline_message_id: None,
23709 caption: None,
23710 parse_mode: None,
23711 caption_entities: None,
23712 show_caption_above_media: None,
23713 reply_markup: None,
23714 }
23715 }
23716 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23717 #[allow(rustdoc::invalid_html_tags)]
23718 #[doc = "Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success."]
23719 pub fn build_delete_story<'a>(
23720 &'a self,
23721 business_connection_id: &'a str,
23722 story_id: i64,
23723 ) -> CallDeleteStory<'a> {
23724 CallDeleteStory {
23725 bot: self,
23726 business_connection_id,
23727 story_id,
23728 }
23729 }
23730 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23731 #[allow(rustdoc::invalid_html_tags)]
23732 #[doc = "Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success."]
23733 pub fn build_delete_business_messages<'a>(
23734 &'a self,
23735 business_connection_id: &'a str,
23736 message_ids: &'a Vec<i64>,
23737 ) -> CallDeleteBusinessMessages<'a> {
23738 CallDeleteBusinessMessages {
23739 bot: self,
23740 business_connection_id,
23741 message_ids,
23742 }
23743 }
23744 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23745 #[allow(rustdoc::invalid_html_tags)]
23746 #[doc = "Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object."]
23747 pub fn build_get_user_profile_photos<'a>(
23748 &'a self,
23749 user_id: i64,
23750 ) -> CallGetUserProfilePhotos<'a> {
23751 CallGetUserProfilePhotos {
23752 bot: self,
23753 user_id,
23754 offset: None,
23755 limit: None,
23756 }
23757 }
23758 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23759 #[allow(rustdoc::invalid_html_tags)]
23760 #[doc = "Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success."]
23761 pub fn build_get_business_account_gifts<'a>(
23762 &'a self,
23763 business_connection_id: &'a str,
23764 ) -> CallGetBusinessAccountGifts<'a> {
23765 CallGetBusinessAccountGifts {
23766 bot: self,
23767 business_connection_id,
23768 exclude_unsaved: None,
23769 exclude_saved: None,
23770 exclude_unlimited: None,
23771 exclude_limited: None,
23772 exclude_unique: None,
23773 sort_by_price: None,
23774 offset: None,
23775 limit: None,
23776 }
23777 }
23778 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23779 #[allow(rustdoc::invalid_html_tags)]
23780 #[doc = "Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success."]
23781 pub fn build_set_chat_permissions<'a, V, A: Into<&'a ChatPermissions>>(
23782 &'a self,
23783 chat_id: V,
23784 permissions: A,
23785 ) -> CallSetChatPermissions<'a, V> {
23786 CallSetChatPermissions {
23787 bot: self,
23788 chat_id,
23789 permissions: permissions.into(),
23790 use_independent_chat_permissions: None,
23791 }
23792 }
23793 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23794 #[allow(rustdoc::invalid_html_tags)]
23795 #[doc = "If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned."]
23796 pub fn build_answer_shipping_query<'a>(
23797 &'a self,
23798 shipping_query_id: &'a str,
23799 ok: bool,
23800 ) -> CallAnswerShippingQuery<'a> {
23801 CallAnswerShippingQuery {
23802 bot: self,
23803 shipping_query_id,
23804 ok,
23805 shipping_options: None,
23806 error_message: None,
23807 }
23808 }
23809 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23810 #[allow(rustdoc::invalid_html_tags)]
23811 #[doc = "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object."]
23812 pub fn build_create_chat_subscription_invite_link<'a, V>(
23813 &'a self,
23814 chat_id: V,
23815 subscription_period: i64,
23816 subscription_price: i64,
23817 ) -> CallCreateChatSubscriptionInviteLink<'a, V> {
23818 CallCreateChatSubscriptionInviteLink {
23819 bot: self,
23820 chat_id,
23821 subscription_period,
23822 subscription_price,
23823 name: None,
23824 }
23825 }
23826 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23827 #[allow(rustdoc::invalid_html_tags)]
23828 #[doc = "Use this method to set the title of a created sticker set. Returns True on success."]
23829 pub fn build_set_sticker_set_title<'a>(
23830 &'a self,
23831 name: &'a str,
23832 title: &'a str,
23833 ) -> CallSetStickerSetTitle<'a> {
23834 CallSetStickerSetTitle {
23835 bot: self,
23836 name,
23837 title,
23838 }
23839 }
23840 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23841 #[allow(rustdoc::invalid_html_tags)]
23842 #[doc = "Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success."]
23843 pub fn build_approve_suggested_post<'a>(
23844 &'a self,
23845 chat_id: i64,
23846 message_id: i64,
23847 ) -> CallApproveSuggestedPost<'a> {
23848 CallApproveSuggestedPost {
23849 bot: self,
23850 chat_id,
23851 message_id,
23852 send_date: None,
23853 }
23854 }
23855 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23856 #[allow(rustdoc::invalid_html_tags)]
23857 #[doc = "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success."]
23858 pub fn build_hide_general_forum_topic<'a, V>(
23859 &'a self,
23860 chat_id: V,
23861 ) -> CallHideGeneralForumTopic<'a, V> {
23862 CallHideGeneralForumTopic { bot: self, chat_id }
23863 }
23864 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23865 #[allow(rustdoc::invalid_html_tags)]
23866 #[doc = "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success."]
23867 pub fn build_create_new_sticker_set<'a>(
23868 &'a self,
23869 user_id: i64,
23870 name: &'a str,
23871 title: &'a str,
23872 stickers: &'a Vec<InputSticker>,
23873 ) -> CallCreateNewStickerSet<'a> {
23874 CallCreateNewStickerSet {
23875 bot: self,
23876 user_id,
23877 name,
23878 title,
23879 stickers,
23880 sticker_type: None,
23881 needs_repainting: None,
23882 }
23883 }
23884 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23885 #[allow(rustdoc::invalid_html_tags)]
23886 #[doc = "As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned."]
23887 pub fn build_send_video_note<'a, V>(
23888 &'a self,
23889 chat_id: V,
23890 video_note: FileData,
23891 ) -> CallSendVideoNote<'a, V> {
23892 CallSendVideoNote {
23893 bot: self,
23894 chat_id,
23895 video_note,
23896 business_connection_id: None,
23897 message_thread_id: None,
23898 direct_messages_topic_id: None,
23899 duration: None,
23900 length: None,
23901 thumbnail: None,
23902 disable_notification: None,
23903 protect_content: None,
23904 allow_paid_broadcast: None,
23905 message_effect_id: None,
23906 suggested_post_parameters: None,
23907 reply_parameters: None,
23908 reply_markup: None,
23909 }
23910 }
23911 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23912 #[allow(rustdoc::invalid_html_tags)]
23913 #[doc = "Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success."]
23914 pub fn build_unban_chat_member<'a, V>(
23915 &'a self,
23916 chat_id: V,
23917 user_id: i64,
23918 ) -> CallUnbanChatMember<'a, V> {
23919 CallUnbanChatMember {
23920 bot: self,
23921 chat_id,
23922 user_id,
23923 only_if_banned: None,
23924 }
23925 }
23926 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23927 #[allow(rustdoc::invalid_html_tags)]
23928 #[doc = "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object."]
23929 pub fn build_edit_chat_subscription_invite_link<'a, V>(
23930 &'a self,
23931 chat_id: V,
23932 invite_link: &'a str,
23933 ) -> CallEditChatSubscriptionInviteLink<'a, V> {
23934 CallEditChatSubscriptionInviteLink {
23935 bot: self,
23936 chat_id,
23937 invite_link,
23938 name: None,
23939 }
23940 }
23941 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23942 #[allow(rustdoc::invalid_html_tags)]
23943 #[doc = "Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
23944 pub fn build_unpin_all_forum_topic_messages<'a, V>(
23945 &'a self,
23946 chat_id: V,
23947 message_thread_id: i64,
23948 ) -> CallUnpinAllForumTopicMessages<'a, V> {
23949 CallUnpinAllForumTopicMessages {
23950 bot: self,
23951 chat_id,
23952 message_thread_id,
23953 }
23954 }
23955 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23956 #[allow(rustdoc::invalid_html_tags)]
23957 #[doc = "Use this method to send a game. On success, the sent Message is returned."]
23958 pub fn build_send_game<'a>(
23959 &'a self,
23960 chat_id: i64,
23961 game_short_name: &'a str,
23962 ) -> CallSendGame<'a> {
23963 CallSendGame {
23964 bot: self,
23965 chat_id,
23966 game_short_name,
23967 business_connection_id: None,
23968 message_thread_id: None,
23969 disable_notification: None,
23970 protect_content: None,
23971 allow_paid_broadcast: None,
23972 message_effect_id: None,
23973 reply_parameters: None,
23974 reply_markup: None,
23975 }
23976 }
23977 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23978 #[allow(rustdoc::invalid_html_tags)]
23979 #[doc = "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
23980 pub fn build_close_general_forum_topic<'a, V>(
23981 &'a self,
23982 chat_id: V,
23983 ) -> CallCloseGeneralForumTopic<'a, V> {
23984 CallCloseGeneralForumTopic { bot: self, chat_id }
23985 }
23986 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
23987 #[allow(rustdoc::invalid_html_tags)]
23988 #[doc = "Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success."]
23989 pub fn build_set_sticker_position_in_set<'a>(
23990 &'a self,
23991 sticker: &'a str,
23992 position: i64,
23993 ) -> CallSetStickerPositionInSet<'a> {
23994 CallSetStickerPositionInSet {
23995 bot: self,
23996 sticker,
23997 position,
23998 }
23999 }
24000 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24001 #[allow(rustdoc::invalid_html_tags)]
24002 #[doc = "Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.For sending voice messages, use the sendVoice method instead."]
24003 pub fn build_send_audio<'a, V>(&'a self, chat_id: V, audio: FileData) -> CallSendAudio<'a, V> {
24004 CallSendAudio {
24005 bot: self,
24006 chat_id,
24007 audio,
24008 business_connection_id: None,
24009 message_thread_id: None,
24010 direct_messages_topic_id: None,
24011 caption: None,
24012 parse_mode: None,
24013 caption_entities: None,
24014 duration: None,
24015 performer: None,
24016 title: None,
24017 thumbnail: None,
24018 disable_notification: None,
24019 protect_content: None,
24020 allow_paid_broadcast: None,
24021 message_effect_id: None,
24022 suggested_post_parameters: None,
24023 reply_parameters: None,
24024 reply_markup: None,
24025 }
24026 }
24027 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24028 #[allow(rustdoc::invalid_html_tags)]
24029 #[doc = "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
24030 pub fn build_edit_message_text<'a, V>(&'a self, text: &'a str) -> CallEditMessageText<'a, V> {
24031 CallEditMessageText {
24032 bot: self,
24033 text,
24034 business_connection_id: None,
24035 chat_id: None,
24036 message_id: None,
24037 inline_message_id: None,
24038 parse_mode: None,
24039 entities: None,
24040 link_preview_options: None,
24041 reply_markup: None,
24042 }
24043 }
24044 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24045 #[allow(rustdoc::invalid_html_tags)]
24046 #[doc = "Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success."]
24047 pub fn build_get_chat_menu_button<'a>(&'a self) -> CallGetChatMenuButton<'a> {
24048 CallGetChatMenuButton {
24049 bot: self,
24050 chat_id: None,
24051 }
24052 }
24053 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24054 #[allow(rustdoc::invalid_html_tags)]
24055 #[doc = "Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned."]
24056 pub fn build_send_sticker<'a, V>(
24057 &'a self,
24058 chat_id: V,
24059 sticker: FileData,
24060 ) -> CallSendSticker<'a, V> {
24061 CallSendSticker {
24062 bot: self,
24063 chat_id,
24064 sticker,
24065 business_connection_id: None,
24066 message_thread_id: None,
24067 direct_messages_topic_id: None,
24068 emoji: None,
24069 disable_notification: None,
24070 protect_content: None,
24071 allow_paid_broadcast: None,
24072 message_effect_id: None,
24073 suggested_post_parameters: None,
24074 reply_parameters: None,
24075 reply_markup: None,
24076 }
24077 }
24078 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24079 #[allow(rustdoc::invalid_html_tags)]
24080 #[doc = "Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future."]
24081 pub fn build_send_video<'a, V>(&'a self, chat_id: V, video: FileData) -> CallSendVideo<'a, V> {
24082 CallSendVideo {
24083 bot: self,
24084 chat_id,
24085 video,
24086 business_connection_id: None,
24087 message_thread_id: None,
24088 direct_messages_topic_id: None,
24089 duration: None,
24090 width: None,
24091 height: None,
24092 thumbnail: None,
24093 cover: None,
24094 start_timestamp: None,
24095 caption: None,
24096 parse_mode: None,
24097 caption_entities: None,
24098 show_caption_above_media: None,
24099 has_spoiler: None,
24100 supports_streaming: None,
24101 disable_notification: None,
24102 protect_content: None,
24103 allow_paid_broadcast: None,
24104 message_effect_id: None,
24105 suggested_post_parameters: None,
24106 reply_parameters: None,
24107 reply_markup: None,
24108 }
24109 }
24110 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24111 #[allow(rustdoc::invalid_html_tags)]
24112 #[doc = "Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success."]
24113 pub fn build_ban_chat_sender_chat<'a, V>(
24114 &'a self,
24115 chat_id: V,
24116 sender_chat_id: i64,
24117 ) -> CallBanChatSenderChat<'a, V> {
24118 CallBanChatSenderChat {
24119 bot: self,
24120 chat_id,
24121 sender_chat_id,
24122 }
24123 }
24124 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24125 #[allow(rustdoc::invalid_html_tags)]
24126 #[doc = "Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects."]
24127 pub fn build_get_chat_administrators<'a, V>(
24128 &'a self,
24129 chat_id: V,
24130 ) -> CallGetChatAdministrators<'a, V> {
24131 CallGetChatAdministrators { bot: self, chat_id }
24132 }
24133 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24134 #[allow(rustdoc::invalid_html_tags)]
24135 #[doc = "Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success."]
24136 pub fn build_delete_forum_topic<'a, V>(
24137 &'a self,
24138 chat_id: V,
24139 message_thread_id: i64,
24140 ) -> CallDeleteForumTopic<'a, V> {
24141 CallDeleteForumTopic {
24142 bot: self,
24143 chat_id,
24144 message_thread_id,
24145 }
24146 }
24147 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24148 #[allow(rustdoc::invalid_html_tags)]
24149 #[doc = "Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success."]
24150 pub fn build_get_business_connection<'a>(
24151 &'a self,
24152 business_connection_id: &'a str,
24153 ) -> CallGetBusinessConnection<'a> {
24154 CallGetBusinessConnection {
24155 bot: self,
24156 business_connection_id,
24157 }
24158 }
24159 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24160 #[allow(rustdoc::invalid_html_tags)]
24161 #[doc = "Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success."]
24162 pub fn build_set_business_account_name<'a>(
24163 &'a self,
24164 business_connection_id: &'a str,
24165 first_name: &'a str,
24166 ) -> CallSetBusinessAccountName<'a> {
24167 CallSetBusinessAccountName {
24168 bot: self,
24169 business_connection_id,
24170 first_name,
24171 last_name: None,
24172 }
24173 }
24174 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24175 #[allow(rustdoc::invalid_html_tags)]
24176 #[doc = "Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success."]
24177 pub fn build_set_business_account_gift_settings<'a, A: Into<&'a AcceptedGiftTypes>>(
24178 &'a self,
24179 business_connection_id: &'a str,
24180 show_gift_button: bool,
24181 accepted_gift_types: A,
24182 ) -> CallSetBusinessAccountGiftSettings<'a> {
24183 CallSetBusinessAccountGiftSettings {
24184 bot: self,
24185 business_connection_id,
24186 show_gift_button,
24187 accepted_gift_types: accepted_gift_types.into(),
24188 }
24189 }
24190 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24191 #[allow(rustdoc::invalid_html_tags)]
24192 #[doc = "Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned."]
24193 pub fn build_stop_message_live_location<'a, V>(&'a self) -> CallStopMessageLiveLocation<'a, V> {
24194 CallStopMessageLiveLocation {
24195 bot: self,
24196 business_connection_id: None,
24197 chat_id: None,
24198 message_id: None,
24199 inline_message_id: None,
24200 reply_markup: None,
24201 }
24202 }
24203 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24204 #[allow(rustdoc::invalid_html_tags)]
24205 #[doc = "Use this method to send a native poll. On success, the sent Message is returned."]
24206 pub fn build_send_poll<'a, V>(
24207 &'a self,
24208 chat_id: V,
24209 question: &'a str,
24210 options: &'a Vec<InputPollOption>,
24211 ) -> CallSendPoll<'a, V> {
24212 CallSendPoll {
24213 bot: self,
24214 chat_id,
24215 question,
24216 options,
24217 business_connection_id: None,
24218 message_thread_id: None,
24219 question_parse_mode: None,
24220 question_entities: None,
24221 is_anonymous: None,
24222 tg_type: None,
24223 allows_multiple_answers: None,
24224 correct_option_id: None,
24225 explanation: None,
24226 explanation_parse_mode: None,
24227 explanation_entities: None,
24228 open_period: None,
24229 close_date: None,
24230 is_closed: None,
24231 disable_notification: None,
24232 protect_content: None,
24233 allow_paid_broadcast: None,
24234 message_effect_id: None,
24235 reply_parameters: None,
24236 reply_markup: None,
24237 }
24238 }
24239 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24240 #[allow(rustdoc::invalid_html_tags)]
24241 #[doc = "Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned."]
24242 pub fn build_answer_callback_query<'a>(
24243 &'a self,
24244 callback_query_id: &'a str,
24245 ) -> CallAnswerCallbackQuery<'a> {
24246 CallAnswerCallbackQuery {
24247 bot: self,
24248 callback_query_id,
24249 text: None,
24250 show_alert: None,
24251 url: None,
24252 cache_time: None,
24253 }
24254 }
24255 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24256 #[allow(rustdoc::invalid_html_tags)]
24257 #[doc = "Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned."]
24258 pub fn build_forward_message<'a, V>(
24259 &'a self,
24260 chat_id: V,
24261 from_chat_id: V,
24262 message_id: i64,
24263 ) -> CallForwardMessage<'a, V> {
24264 CallForwardMessage {
24265 bot: self,
24266 chat_id,
24267 from_chat_id,
24268 message_id,
24269 message_thread_id: None,
24270 direct_messages_topic_id: None,
24271 video_start_timestamp: None,
24272 disable_notification: None,
24273 protect_content: None,
24274 suggested_post_parameters: None,
24275 }
24276 }
24277 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24278 #[allow(rustdoc::invalid_html_tags)]
24279 #[doc = "Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object."]
24280 pub fn build_revoke_chat_invite_link<'a, V>(
24281 &'a self,
24282 chat_id: V,
24283 invite_link: &'a str,
24284 ) -> CallRevokeChatInviteLink<'a, V> {
24285 CallRevokeChatInviteLink {
24286 bot: self,
24287 chat_id,
24288 invite_link,
24289 }
24290 }
24291 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24292 #[allow(rustdoc::invalid_html_tags)]
24293 #[doc = "Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned."]
24294 pub fn build_stop_poll<'a, V>(&'a self, chat_id: V, message_id: i64) -> CallStopPoll<'a, V> {
24295 CallStopPoll {
24296 bot: self,
24297 chat_id,
24298 message_id,
24299 business_connection_id: None,
24300 reply_markup: None,
24301 }
24302 }
24303 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24304 #[allow(rustdoc::invalid_html_tags)]
24305 #[doc = "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
24306 pub fn build_unhide_general_forum_topic<'a, V>(
24307 &'a self,
24308 chat_id: V,
24309 ) -> CallUnhideGeneralForumTopic<'a, V> {
24310 CallUnhideGeneralForumTopic { bot: self, chat_id }
24311 }
24312 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24313 #[allow(rustdoc::invalid_html_tags)]
24314 #[doc = "Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success."]
24315 pub fn build_upload_sticker_file<'a>(
24316 &'a self,
24317 user_id: i64,
24318 sticker: FileData,
24319 sticker_format: &'a str,
24320 ) -> CallUploadStickerFile<'a> {
24321 CallUploadStickerFile {
24322 bot: self,
24323 user_id,
24324 sticker,
24325 sticker_format,
24326 }
24327 }
24328 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24329 #[allow(rustdoc::invalid_html_tags)]
24330 #[doc = "Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
24331 pub fn build_set_sticker_keywords<'a>(
24332 &'a self,
24333 sticker: &'a str,
24334 ) -> CallSetStickerKeywords<'a> {
24335 CallSetStickerKeywords {
24336 bot: self,
24337 sticker,
24338 keywords: None,
24339 }
24340 }
24341 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24342 #[allow(rustdoc::invalid_html_tags)]
24343 #[doc = "Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success."]
24344 pub fn build_set_chat_menu_button<'a>(&'a self) -> CallSetChatMenuButton<'a> {
24345 CallSetChatMenuButton {
24346 bot: self,
24347 chat_id: None,
24348 menu_button: None,
24349 }
24350 }
24351 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24352 #[allow(rustdoc::invalid_html_tags)]
24353 #[doc = "Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
24354 pub fn build_edit_story<'a, A: Into<&'a InputStoryContent>>(
24355 &'a self,
24356 business_connection_id: &'a str,
24357 story_id: i64,
24358 content: A,
24359 ) -> CallEditStory<'a> {
24360 CallEditStory {
24361 bot: self,
24362 business_connection_id,
24363 story_id,
24364 content: content.into(),
24365 caption: None,
24366 parse_mode: None,
24367 caption_entities: None,
24368 areas: None,
24369 }
24370 }
24371 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24372 #[allow(rustdoc::invalid_html_tags)]
24373 #[doc = "Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future."]
24374 pub fn build_send_document<'a, V>(
24375 &'a self,
24376 chat_id: V,
24377 document: FileData,
24378 ) -> CallSendDocument<'a, V> {
24379 CallSendDocument {
24380 bot: self,
24381 chat_id,
24382 document,
24383 business_connection_id: None,
24384 message_thread_id: None,
24385 direct_messages_topic_id: None,
24386 thumbnail: None,
24387 caption: None,
24388 parse_mode: None,
24389 caption_entities: None,
24390 disable_content_type_detection: None,
24391 disable_notification: None,
24392 protect_content: None,
24393 allow_paid_broadcast: None,
24394 message_effect_id: None,
24395 suggested_post_parameters: None,
24396 reply_parameters: None,
24397 reply_markup: None,
24398 }
24399 }
24400 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24401 #[allow(rustdoc::invalid_html_tags)]
24402 #[doc = "Use this method to send information about a venue. On success, the sent Message is returned."]
24403 pub fn build_send_venue<'a, V>(
24404 &'a self,
24405 chat_id: V,
24406 latitude: ::ordered_float::OrderedFloat<f64>,
24407 longitude: ::ordered_float::OrderedFloat<f64>,
24408 title: &'a str,
24409 address: &'a str,
24410 ) -> CallSendVenue<'a, V> {
24411 CallSendVenue {
24412 bot: self,
24413 chat_id,
24414 latitude,
24415 longitude,
24416 title,
24417 address,
24418 business_connection_id: None,
24419 message_thread_id: None,
24420 direct_messages_topic_id: None,
24421 foursquare_id: None,
24422 foursquare_type: None,
24423 google_place_id: None,
24424 google_place_type: None,
24425 disable_notification: None,
24426 protect_content: None,
24427 allow_paid_broadcast: None,
24428 message_effect_id: None,
24429 suggested_post_parameters: None,
24430 reply_parameters: None,
24431 reply_markup: None,
24432 }
24433 }
24434 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24435 #[allow(rustdoc::invalid_html_tags)]
24436 #[doc = "Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object."]
24437 pub fn build_create_forum_topic<'a, V>(
24438 &'a self,
24439 chat_id: V,
24440 name: &'a str,
24441 ) -> CallCreateForumTopic<'a, V> {
24442 CallCreateForumTopic {
24443 bot: self,
24444 chat_id,
24445 name,
24446 icon_color: None,
24447 icon_custom_emoji_id: None,
24448 }
24449 }
24450 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24451 #[allow(rustdoc::invalid_html_tags)]
24452 #[doc = "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success."]
24453 pub fn build_remove_user_verification<'a>(
24454 &'a self,
24455 user_id: i64,
24456 ) -> CallRemoveUserVerification<'a> {
24457 CallRemoveUserVerification { bot: self, user_id }
24458 }
24459 #[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
24460 #[allow(rustdoc::invalid_html_tags)]
24461 #[doc = "Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success."]
24462 pub fn build_restrict_chat_member<'a, V, A: Into<&'a ChatPermissions>>(
24463 &'a self,
24464 chat_id: V,
24465 user_id: i64,
24466 permissions: A,
24467 ) -> CallRestrictChatMember<'a, V> {
24468 CallRestrictChatMember {
24469 bot: self,
24470 chat_id,
24471 user_id,
24472 permissions: permissions.into(),
24473 use_independent_chat_permissions: None,
24474 until_date: None,
24475 }
24476 }
24477}