tgbot/types/definitions/
bot.rs

1use std::{error::Error, fmt};
2
3use serde::{Deserialize, Serialize};
4
5use crate::{
6    api::{Method, Payload},
7    types::{ChatAdministratorRights, ChatId, Integer, StarAmount},
8};
9
10/// Represents information about a bot returned in [`GetBot`].
11#[serde_with::skip_serializing_none]
12#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
13pub struct Bot {
14    /// The first name of the bot.
15    pub first_name: String,
16    /// The unique identifier for the bot.
17    pub id: Integer,
18    /// The username of the bot.
19    pub username: String,
20    /// Whether the bot can be connected to a Telegram Business account to receive its messages.
21    pub can_connect_to_business: bool,
22    /// Indicates whether the bot can be invited to groups.
23    pub can_join_groups: bool,
24    /// Indicates whether privacy mode is disabled, allowing the bot to read all group messages.
25    pub can_read_all_group_messages: bool,
26    /// Indicates whether the bot has a main Web App.
27    pub has_main_web_app: bool,
28    /// The last name of the bot.
29    pub last_name: Option<String>,
30    /// Indicates whether the bot supports inline queries.
31    pub supports_inline_queries: bool,
32}
33
34impl Bot {
35    /// Creates a new `Bot`.
36    ///
37    /// # Arguments
38    ///
39    /// * `id` - The unique identifier for the bot.
40    /// * `username` - The username of the bot.
41    /// * `first_name` - The first name of the bot.
42    pub fn new<A, B>(id: Integer, username: A, first_name: B) -> Self
43    where
44        A: Into<String>,
45        B: Into<String>,
46    {
47        Self {
48            first_name: first_name.into(),
49            id,
50            username: username.into(),
51            can_connect_to_business: false,
52            can_join_groups: false,
53            can_read_all_group_messages: false,
54            has_main_web_app: false,
55            last_name: None,
56            supports_inline_queries: false,
57        }
58    }
59
60    /// Sets a new value for the `can_connect_to_business` flag.
61    ///
62    /// # Arguments
63    ///
64    /// * `value` - Whether the bot can be connected to a Telegram Business account.
65    pub fn with_can_connect_to_business(mut self, value: bool) -> Self {
66        self.can_connect_to_business = value;
67        self
68    }
69
70    /// Sets a new value for the `can_join_groups` flag.
71    ///
72    /// # Arguments
73    ///
74    /// * `value` - Indicates whether the bot can be invited to groups.
75    pub fn with_can_join_groups(mut self, value: bool) -> Self {
76        self.can_join_groups = value;
77        self
78    }
79
80    /// Sets a new value for the `can_read_all_group_messages` flag.
81    ///
82    /// # Arguments
83    ///
84    /// * `value` - Indicates whether privacy mode is disabled.
85    pub fn with_can_read_all_group_messages(mut self, value: bool) -> Self {
86        self.can_read_all_group_messages = value;
87        self
88    }
89
90    /// Sets a new value for the `has_main_web_app` flag.
91    ///
92    /// # Arguments
93    ///
94    /// * `value` - Indicates whether the bot has a main Web App.
95    pub fn with_has_main_web_app(mut self, value: bool) -> Self {
96        self.has_main_web_app = value;
97        self
98    }
99
100    /// Sets a new value for the last name of the bot.
101    ///
102    /// # Arguments
103    ///
104    /// * `value` - The last name of the bot.
105    pub fn with_last_name<T>(mut self, value: T) -> Self
106    where
107        T: Into<String>,
108    {
109        self.last_name = Some(value.into());
110        self
111    }
112
113    /// Sets a new value for the `supports_inline_queries` flag.
114    ///
115    /// # Arguments
116    ///
117    /// * `value` - Indicates whether the bot supports inline queries.
118    pub fn with_supports_inline_queries(mut self, value: bool) -> Self {
119        self.supports_inline_queries = value;
120        self
121    }
122}
123
124/// Represents a command of a bot.
125#[derive(Clone, Debug, Deserialize, Serialize)]
126pub struct BotCommand {
127    #[serde(rename = "command")]
128    name: String,
129    description: String,
130}
131
132impl BotCommand {
133    const MIN_NAME_LEN: usize = 1;
134    const MAX_NAME_LEN: usize = 32;
135    const MIN_DESCRIPTION_LEN: usize = 3;
136    const MAX_DESCRIPTION_LEN: usize = 256;
137
138    /// Creates a new `BotCommand`.
139    ///
140    /// # Arguments
141    ///
142    /// * `name` - The name of the command; 1-32 characters;
143    ///   can contain only lowercase English letters, digits and underscores.
144    /// * `description` - The description of the command; 3-256 characters.
145    pub fn new<C, D>(name: C, description: D) -> Result<Self, BotCommandError>
146    where
147        C: Into<String>,
148        D: Into<String>,
149    {
150        let name = name.into();
151        let description = description.into();
152        let name_len = name.len();
153        let description_len = description.len();
154        if !(Self::MIN_NAME_LEN..=Self::MAX_NAME_LEN).contains(&name_len) {
155            Err(BotCommandError::BadNameLen(name_len))
156        } else if !(Self::MIN_DESCRIPTION_LEN..=Self::MAX_DESCRIPTION_LEN).contains(&description_len) {
157            Err(BotCommandError::BadDescriptionLen(description_len))
158        } else {
159            Ok(Self { name, description })
160        }
161    }
162
163    /// Returns the name of the command.
164    pub fn name(&self) -> &str {
165        &self.name
166    }
167
168    /// Sets a new name for the command.
169    ///
170    /// # Arguments
171    ///
172    /// * `value` - The new name.
173    pub fn with_name<T>(mut self, value: T) -> Self
174    where
175        T: Into<String>,
176    {
177        self.name = value.into();
178        self
179    }
180
181    /// Returns the description of the command.
182    pub fn description(&self) -> &str {
183        &self.description
184    }
185
186    /// Sets a new description for the command.
187    ///
188    /// # Arguments
189    ///
190    /// * `value` - The new description.
191    pub fn with_description<T>(mut self, value: T) -> Self
192    where
193        T: Into<String>,
194    {
195        self.description = value.into();
196        self
197    }
198}
199
200/// Represents an error that can occur when creating a new [`BotCommand`].
201#[derive(Debug)]
202pub enum BotCommandError {
203    /// The provided name has an invalid length.
204    BadNameLen(usize),
205    /// The provided description has an invalid length.
206    BadDescriptionLen(usize),
207}
208
209impl Error for BotCommandError {}
210
211impl fmt::Display for BotCommandError {
212    fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
213        use self::BotCommandError::*;
214        match self {
215            BadNameLen(len) => write!(
216                out,
217                "command name can have a length of {} up to {} characters, got {}",
218                BotCommand::MIN_NAME_LEN,
219                BotCommand::MAX_NAME_LEN,
220                len
221            ),
222            BadDescriptionLen(len) => write!(
223                out,
224                "command description can have a length of {} up to {} characters, got {}",
225                BotCommand::MIN_DESCRIPTION_LEN,
226                BotCommand::MAX_DESCRIPTION_LEN,
227                len
228            ),
229        }
230    }
231}
232
233/// Represents a scope to which bot commands are applied.
234#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
235#[serde(tag = "type")]
236#[serde(rename_all = "snake_case")]
237pub enum BotCommandScope {
238    /// All group and supergroup chat administrators.
239    AllChatAdministrators,
240    /// All group and supergroup chats.
241    AllGroupChats,
242    /// All private chats.
243    AllPrivateChats,
244    /// A specific chat.
245    Chat {
246        /// Unique identifier of the target chat.
247        chat_id: ChatId,
248    },
249    /// All administrators of a specific group or supergroup chat.
250    ChatAdministrators {
251        /// Unique identifier of the target chat.
252        chat_id: ChatId,
253    },
254    /// A specific member of a group or supergroup chat.
255    ChatMember {
256        /// Unique identifier of the target chat.
257        chat_id: ChatId,
258        /// Unique identifier of the target user.
259        user_id: Integer,
260    },
261    /// Default scope.
262    ///
263    /// Default commands are used if no commands with a narrower scope are specified for a user.
264    Default,
265}
266
267impl BotCommandScope {
268    /// Creates a new `BotCommandScope` covering a specific chat.
269    ///
270    /// # Arguments
271    ///
272    /// * `value` - Chat ID.
273    pub fn chat<T>(value: T) -> Self
274    where
275        T: Into<ChatId>,
276    {
277        Self::Chat { chat_id: value.into() }
278    }
279
280    /// Creates a new `BotCommandScope` covering all administrators
281    /// of a specific group or supergroup chat.
282    ///
283    /// # Arguments
284    ///
285    /// * `value` - Chat ID.
286    pub fn chat_administrators<T>(value: T) -> Self
287    where
288        T: Into<ChatId>,
289    {
290        Self::ChatAdministrators { chat_id: value.into() }
291    }
292
293    /// Creates a new `BotCommandScope` covering a specific member of a group or supergroup chat.
294    ///
295    /// # Arguments
296    ///
297    /// * `chat_id` - Chat ID.
298    /// * `user_id` - User ID.
299    pub fn chat_member<A>(chat_id: A, user_id: Integer) -> Self
300    where
301        A: Into<ChatId>,
302    {
303        Self::ChatMember {
304            chat_id: chat_id.into(),
305            user_id,
306        }
307    }
308}
309
310/// Represents a description of a bot.
311#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
312pub struct BotDescription {
313    /// The description of the bot.
314    pub description: String,
315}
316
317impl BotDescription {
318    /// Creates a new `BotDescription`.
319    ///
320    /// # Arguments
321    ///
322    /// * `value` - The description of the bot.
323    pub fn new<T>(value: T) -> Self
324    where
325        T: Into<String>,
326    {
327        Self {
328            description: value.into(),
329        }
330    }
331}
332
333/// Represents a name of a bot.
334#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
335pub struct BotName {
336    /// The name of the bot.
337    pub name: String,
338}
339
340impl BotName {
341    /// Creates a new `BotName`.
342    ///
343    /// # Arguments
344    ///
345    /// * `value` - The name of the bot.
346    pub fn new<T>(value: T) -> Self
347    where
348        T: Into<String>,
349    {
350        Self { name: value.into() }
351    }
352}
353
354/// Represents a short description of a bot.
355#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
356pub struct BotShortDescription {
357    /// The short description of the bot.
358    pub short_description: String,
359}
360
361impl BotShortDescription {
362    /// Creates a new `BotShortDescription`.
363    ///
364    /// # Arguments
365    ///
366    /// * `value` - The short description of the bot.
367    pub fn new<T>(value: T) -> Self
368    where
369        T: Into<String>,
370    {
371        Self {
372            short_description: value.into(),
373        }
374    }
375}
376
377/// Closes a bot instance before moving it from one local server to another.
378///
379/// You need to delete the webhook before calling this method to ensure
380/// that the bot isn't launched again after server restart.
381///
382/// The method will return error 429 in the first 10 minutes after the bot is launched.
383#[derive(Clone, Copy, Debug)]
384pub struct Close;
385
386impl Method for Close {
387    type Response = bool;
388
389    fn into_payload(self) -> Payload {
390        Payload::empty("close")
391    }
392}
393
394/// Deletes a list of a bot commands of a given scope and user language.
395///
396/// After deletion, higher level commands will be shown to affected users.
397#[serde_with::skip_serializing_none]
398#[derive(Clone, Debug, Default, Serialize)]
399pub struct DeleteBotCommands {
400    language_code: Option<String>,
401    scope: Option<BotCommandScope>,
402}
403
404impl DeleteBotCommands {
405    /// Sets a new language code.
406    ///
407    /// # Arguments
408    ///
409    /// * `value` - Two-letter ISO 639-1 language code or an empty string.
410    pub fn with_language_code<T>(mut self, value: T) -> Self
411    where
412        T: Into<String>,
413    {
414        self.language_code = Some(value.into());
415        self
416    }
417
418    /// Sets a new scope of users.
419    ///
420    /// # Arguments
421    ///
422    /// * `value` - Scope; default - [`BotCommandScope::Default`].
423    pub fn with_scope(mut self, value: BotCommandScope) -> Self {
424        self.scope = Some(value);
425        self
426    }
427}
428
429impl Method for DeleteBotCommands {
430    type Response = bool;
431
432    fn into_payload(self) -> Payload {
433        Payload::json("deleteMyCommands", self)
434    }
435}
436
437/// Returns a basic information about a bot.
438#[derive(Clone, Copy, Debug)]
439pub struct GetBot;
440
441impl Method for GetBot {
442    type Response = Bot;
443
444    fn into_payload(self) -> Payload {
445        Payload::empty("getMe")
446    }
447}
448
449/// Returns the current list of bot commands.
450#[serde_with::skip_serializing_none]
451#[derive(Clone, Debug, Default, Serialize)]
452pub struct GetBotCommands {
453    language_code: Option<String>,
454    scope: Option<BotCommandScope>,
455}
456
457impl GetBotCommands {
458    /// Sets a new language code.
459    ///
460    /// # Arguments
461    ///
462    /// * `value` - Two-letter ISO 639-1 language code or an empty string.
463    pub fn with_language_code<T>(mut self, value: T) -> Self
464    where
465        T: Into<String>,
466    {
467        self.language_code = Some(value.into());
468        self
469    }
470
471    /// Sets a new scope.
472    ///
473    /// # Arguments
474    ///
475    /// * `value` - Scope of users; default - [`BotCommandScope::Default`].
476    pub fn with_scope(mut self, value: BotCommandScope) -> Self {
477        self.scope = Some(value);
478        self
479    }
480}
481
482impl Method for GetBotCommands {
483    type Response = Vec<BotCommand>;
484
485    fn into_payload(self) -> Payload {
486        Payload::json("getMyCommands", self)
487    }
488}
489
490/// Returns the current default administrator rights of a bot.
491#[serde_with::skip_serializing_none]
492#[derive(Clone, Copy, Debug, Default, Serialize)]
493pub struct GetBotDefaultAdministratorRights {
494    for_channels: Option<bool>,
495}
496
497impl GetBotDefaultAdministratorRights {
498    /// Sets a new value of a `for_channels` flag.
499    ///
500    /// # Arguments
501    ///
502    /// * `value` - For channels - `true`; for groups and supergroups - `false`.
503    pub fn with_for_channels(mut self, value: bool) -> Self {
504        self.for_channels = Some(value);
505        self
506    }
507}
508
509impl Method for GetBotDefaultAdministratorRights {
510    type Response = ChatAdministratorRights;
511
512    fn into_payload(self) -> Payload {
513        Payload::json("getMyDefaultAdministratorRights", self)
514    }
515}
516
517/// Returns the current description of a bot for a given user language.
518#[serde_with::skip_serializing_none]
519#[derive(Clone, Debug, Default, Serialize)]
520pub struct GetBotDescription {
521    language_code: Option<String>,
522}
523
524impl GetBotDescription {
525    /// Sets a new language code.
526    ///
527    /// # Arguments
528    ///
529    /// * `value` - Two-letter ISO 639-1 language code or an empty string.
530    pub fn with_language_code<T>(mut self, value: T) -> Self
531    where
532        T: Into<String>,
533    {
534        self.language_code = Some(value.into());
535        self
536    }
537}
538
539impl Method for GetBotDescription {
540    type Response = BotDescription;
541
542    fn into_payload(self) -> Payload {
543        Payload::json("getMyDescription", self)
544    }
545}
546
547/// Returns the current name of a bot for a given user language.
548#[serde_with::skip_serializing_none]
549#[derive(Clone, Debug, Default, Serialize)]
550pub struct GetBotName {
551    language_code: Option<String>,
552}
553
554impl GetBotName {
555    /// Sets a new language code.
556    ///
557    /// # Arguments
558    ///
559    /// * `value` - Two-letter ISO 639-1 language code or an empty string.
560    pub fn with_language_code<T>(mut self, value: T) -> Self
561    where
562        T: Into<String>,
563    {
564        self.language_code = Some(value.into());
565        self
566    }
567}
568
569impl Method for GetBotName {
570    type Response = BotName;
571
572    fn into_payload(self) -> Payload {
573        Payload::json("getMyName", self)
574    }
575}
576
577/// Returns the current short description of a bot for a given user language.
578#[serde_with::skip_serializing_none]
579#[derive(Clone, Debug, Default, Serialize)]
580pub struct GetBotShortDescription {
581    language_code: Option<String>,
582}
583
584impl GetBotShortDescription {
585    /// Sets a new language code.
586    ///
587    /// # Arguments
588    ///
589    /// * `value` - Two-letter ISO 639-1 language code or an empty string.
590    pub fn with_language_code<T>(mut self, value: T) -> Self
591    where
592        T: Into<String>,
593    {
594        self.language_code = Some(value.into());
595        self
596    }
597}
598
599impl Method for GetBotShortDescription {
600    type Response = BotShortDescription;
601
602    fn into_payload(self) -> Payload {
603        Payload::json("getMyShortDescription", self)
604    }
605}
606
607/// Returns the current Telegram Stars balance of the bot.
608#[derive(Clone, Copy, Debug)]
609pub struct GetBotStarBalance;
610
611impl Method for GetBotStarBalance {
612    type Response = StarAmount;
613
614    fn into_payload(self) -> Payload {
615        Payload::empty("getMyStarBalance")
616    }
617}
618
619/// Logs out from the Cloud Bot API.
620///
621/// You must log out a bot before running it locally,
622/// otherwise there is no guarantee that the bot will receive updates.
623///
624/// After a successful call, you can immediately log in on a local server,
625/// but will not be able to log in back to the Cloud Bot API server for 10 minutes.
626#[derive(Clone, Copy, Debug)]
627pub struct LogOut;
628
629impl Method for LogOut {
630    type Response = bool;
631
632    fn into_payload(self) -> Payload {
633        Payload::empty("logOut")
634    }
635}
636
637/// Changes a list of commands of a bot.
638#[serde_with::skip_serializing_none]
639#[derive(Clone, Debug, Serialize)]
640pub struct SetBotCommands {
641    commands: Vec<BotCommand>,
642    language_code: Option<String>,
643    scope: Option<BotCommandScope>,
644}
645
646impl SetBotCommands {
647    /// Creates a new `SetBotCommands`.
648    ///
649    /// # Arguments
650    ///
651    /// * `commands` - Commands to set.
652    pub fn new(commands: impl IntoIterator<Item = BotCommand>) -> Self {
653        Self {
654            commands: commands.into_iter().collect(),
655            language_code: None,
656            scope: None,
657        }
658    }
659
660    /// Sets a new language code.
661    ///
662    /// # Arguments
663    ///
664    /// * `value` - Two-letter ISO 639-1 language code;
665    ///   if empty, commands will be applied to all users from the given scope,
666    ///   for whose language there are no dedicated commands.
667    pub fn with_language_code<T>(mut self, value: T) -> Self
668    where
669        T: Into<String>,
670    {
671        self.language_code = Some(value.into());
672        self
673    }
674
675    /// Sets a new scope.
676    ///
677    /// # Arguments
678    ///
679    /// * `value` - Scope of users for which the commands are relevant;
680    ///   default - [`BotCommandScope::Default`].
681    pub fn with_scope(mut self, value: BotCommandScope) -> Self {
682        self.scope = Some(value);
683        self
684    }
685}
686
687impl Method for SetBotCommands {
688    type Response = bool;
689
690    fn into_payload(self) -> Payload {
691        Payload::json("setMyCommands", self)
692    }
693}
694
695/// Changes default administrator rights requested by a bot
696/// when it's added as an administrator to groups or channels.
697///
698/// These rights will be suggested to users,
699/// but they are free to modify the list before adding the bot.
700#[serde_with::skip_serializing_none]
701#[derive(Clone, Copy, Debug, Default, Serialize)]
702pub struct SetBotDefaultAdministratorRights {
703    for_channels: Option<bool>,
704    rights: Option<ChatAdministratorRights>,
705}
706
707impl SetBotDefaultAdministratorRights {
708    /// Sets a new value of a `for_channels` flag.
709    ///
710    /// # Arguments
711    ///
712    /// * `value` - For channels - `true`; for groups and supergroups - `false`.
713    pub fn with_for_channels(mut self, value: bool) -> Self {
714        self.for_channels = Some(value);
715        self
716    }
717
718    /// Sets new default administrator rights
719    ///
720    /// # Arguments
721    ///
722    /// * `value` - Default administrator rights;
723    ///   if not specified, the default administrator rights will be cleared.
724    pub fn with_rights(mut self, value: ChatAdministratorRights) -> Self {
725        self.rights = Some(value);
726        self
727    }
728}
729
730impl Method for SetBotDefaultAdministratorRights {
731    type Response = bool;
732
733    fn into_payload(self) -> Payload {
734        Payload::json("setMyDefaultAdministratorRights", self)
735    }
736}
737
738/// Changes the description of a bot, which is shown in a chat with the bot if the chat is empty.
739#[serde_with::skip_serializing_none]
740#[derive(Clone, Debug, Default, Serialize)]
741pub struct SetBotDescription {
742    description: Option<String>,
743    language_code: Option<String>,
744}
745
746impl SetBotDescription {
747    /// Sets a new description.
748    ///
749    /// # Arguments
750    ///
751    /// * `value` - Description of the bot; 0-512 characters;
752    ///   pass an empty string to remove the dedicated description
753    ///   of the given language.
754    pub fn with_description<T>(mut self, value: T) -> Self
755    where
756        T: Into<String>,
757    {
758        self.description = Some(value.into());
759        self
760    }
761
762    /// Sets a new language code.
763    ///
764    /// # Arguments
765    ///
766    /// * `value` - Two-letter ISO 639-1 language code;
767    ///   if empty, the description will be applied to all users
768    ///   for whose language there is no dedicated description.
769    pub fn with_language_code<T>(mut self, value: T) -> Self
770    where
771        T: Into<String>,
772    {
773        self.language_code = Some(value.into());
774        self
775    }
776}
777
778impl Method for SetBotDescription {
779    type Response = bool;
780
781    fn into_payload(self) -> Payload {
782        Payload::json("setMyDescription", self)
783    }
784}
785
786/// Changes the name of a bot.
787#[serde_with::skip_serializing_none]
788#[derive(Clone, Debug, Default, Serialize)]
789pub struct SetBotName {
790    language_code: Option<String>,
791    name: Option<String>,
792}
793
794impl SetBotName {
795    /// Sets a new language code.
796    ///
797    /// # Arguments
798    ///
799    /// * `value` - Two-letter ISO 639-1 language code;
800    ///   if empty, the name will be shown to all users
801    ///   for whose language there is no dedicated name.
802    pub fn with_language_code<T>(mut self, value: T) -> Self
803    where
804        T: Into<String>,
805    {
806        self.language_code = Some(value.into());
807        self
808    }
809
810    /// Sets a new name of a bot.
811    ///
812    /// # Arguments
813    ///
814    /// * `value` - New name of the bot; 0-64 characters;
815    ///   pass an empty string to remove the dedicated name
816    ///   of the given language.
817    pub fn with_name<T>(mut self, value: T) -> Self
818    where
819        T: Into<String>,
820    {
821        self.name = Some(value.into());
822        self
823    }
824}
825
826impl Method for SetBotName {
827    type Response = bool;
828
829    fn into_payload(self) -> Payload {
830        Payload::json("setMyName", self)
831    }
832}
833
834/// Changes the short description of a bot, which is shown on the bot profile page
835/// and is sent together with the link when users share the bot.
836#[serde_with::skip_serializing_none]
837#[derive(Clone, Debug, Default, Serialize)]
838pub struct SetBotShortDescription {
839    language_code: Option<String>,
840    short_description: Option<String>,
841}
842
843impl SetBotShortDescription {
844    /// Sets a new language code.
845    ///
846    /// # Arguments
847    ///
848    /// * `value` - Two-letter ISO 639-1 language code;
849    ///   if empty, the short description will be applied
850    ///   to all users for whose language there is no dedicated short description.
851    pub fn with_language_code<T>(mut self, value: T) -> Self
852    where
853        T: Into<String>,
854    {
855        self.language_code = Some(value.into());
856        self
857    }
858
859    /// Sets a new short description.
860    ///
861    /// # Arguments
862    ///
863    /// * `value` - Short description of a bot; 0-120 characters;
864    ///   pass an empty string to remove the dedicated short description
865    ///   of the given language.
866    pub fn with_short_description<T>(mut self, value: T) -> Self
867    where
868        T: Into<String>,
869    {
870        self.short_description = Some(value.into());
871        self
872    }
873}
874
875impl Method for SetBotShortDescription {
876    type Response = bool;
877
878    fn into_payload(self) -> Payload {
879        Payload::json("setMyShortDescription", self)
880    }
881}