diff --git a/src/requests/mod.rs b/src/requests/mod.rs index 6d839e99..e34494d4 100644 --- a/src/requests/mod.rs +++ b/src/requests/mod.rs @@ -52,3 +52,25 @@ where T::METHOD } } + +pub mod payloads { + // payloads are sorted as in tg docs (https://core.telegram.org/bots/api) + + // Getting updates + mod get_updates; + + pub use get_updates::{GetUpdates, AllowedUpdate}; + + // Available methods + mod get_me; + mod send_message; + + mod send_animation; + + pub use self::{ + get_me::GetMe, + send_message::SendMessage, + + send_animation::SendAnimation, + }; +} \ No newline at end of file diff --git a/src/types/chat_id.rs b/src/types/chat_id.rs index c6e69093..a3f02f0e 100644 --- a/src/types/chat_id.rs +++ b/src/types/chat_id.rs @@ -1,6 +1,6 @@ /// Unique identifier for the target chat or username of the target channel (in -/// the format @channelusername) -#[derive(Debug, Display, Serialize, From, PartialEq, Eq, Clone)] +/// the format `@channelusername`) +#[derive(Debug, Display, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum ChatId { /// chat identifier diff --git a/src/types/force_reply.rs b/src/types/force_reply.rs index 787646b0..7b1cceb6 100644 --- a/src/types/force_reply.rs +++ b/src/types/force_reply.rs @@ -1,13 +1,15 @@ +use crate::types::True; + /// Upon receiving a message with this object, Telegram clients will /// display a reply interface to the user (act as if the user has /// selected the bot‘s message and tapped ’Reply'). This can be /// extremely useful if you want to create user-friendly step-by-step /// interfaces without having to sacrifice privacy mod -#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)] pub struct ForceReply { /// Shows reply interface to the user, as if they manually selected the /// bot‘s message and tapped ’Reply' - pub force_reply: bool, + pub force_reply: True, #[serde(skip_serializing_if = "Option::is_none")] /// Optional. Use this parameter if you want to force reply from specific diff --git a/src/types/inline_keyboard_markup.rs b/src/types/inline_keyboard_markup.rs index 2ca92ee4..9b8d15e6 100644 --- a/src/types/inline_keyboard_markup.rs +++ b/src/types/inline_keyboard_markup.rs @@ -5,7 +5,7 @@ use crate::types::InlineKeyboardButton; /// /// *Note*: This will only work in Telegram versions released after /// 9 April, 2016. Older clients will display unsupported message. -#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone, Default)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize, Default)] pub struct InlineKeyboardMarkup { /// Array of button rows, each represented by an Array of /// [`InlineKeyboardButton`] objects diff --git a/src/types/reply_keyboard_markup.rs b/src/types/reply_keyboard_markup.rs index a80932f0..c41579c0 100644 --- a/src/types/reply_keyboard_markup.rs +++ b/src/types/reply_keyboard_markup.rs @@ -1,7 +1,7 @@ use crate::types::KeyboardButton; /// This object represents a custom keyboard with reply options. -#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)] pub struct ReplyKeyboardMarkup { /// Array of button rows, each represented by an Array of /// [`KeyboardButton`] objects diff --git a/src/types/reply_keyboard_remove.rs b/src/types/reply_keyboard_remove.rs index 1ab4d9c2..9a4162cf 100644 --- a/src/types/reply_keyboard_remove.rs +++ b/src/types/reply_keyboard_remove.rs @@ -1,3 +1,5 @@ +use crate::types::True; + /// Upon receiving a message with this object, Telegram clients will remove /// the current custom keyboard and display the default letter-keyboard. /// By default, custom keyboards are displayed until a new keyboard is sent @@ -5,23 +7,28 @@ /// immediately after the user presses a button (see [`ReplyKeyboardMarkup`]). /// /// [`ReplyKeyboardMarkup`]: crate::types::ReplyKeyboardMarkup -#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)] pub struct ReplyKeyboardRemove { - /// equests clients to remove the custom keyboard (user will not be able to + /// Requests clients to remove the custom keyboard (user will not be able to /// summon this keyboard; if you want to hide the keyboard from sight but /// keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) - pub remove_keyboard: bool, + pub remove_keyboard: True, - #[serde(skip_serializing_if = "Option::is_none")] /// Optional. Use this parameter if you want to show the keyboard to - /// specific users only. Targets: 1) users that are @mentioned in the text - /// of the [`Message`] object; 2) if the bot's message is a reply - /// (has reply_to_message_id), sender of the original message. + /// specific users only. /// - /// Example: A user requests to change the bot‘s language, bot replies to + /// Targets: + /// 1. users that are `@mentioned` in the text of the [`Message`] + /// 2. if the bot's message is a reply (has [`reply_to_message_id`]), + /// sender of the original message. + /// + /// ## Example + /// A user requests to change the bot‘s language, bot replies to /// the request with a keyboard to select the new language. Other users in /// the group don’t see the keyboard. /// /// [`Message`]: crate::types::Message + /// [`reply_to_message_id`]: crate::types::Message::reply_to_message_id + #[serde(skip_serializing_if = "Option::is_none")] pub selective: Option, } diff --git a/src/types/reply_markup.rs b/src/types/reply_markup.rs index 82ceeb77..98aa5bfd 100644 --- a/src/types/reply_markup.rs +++ b/src/types/reply_markup.rs @@ -2,7 +2,7 @@ use crate::types::{ ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, }; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum ReplyMarkup { Inline(InlineKeyboardMarkup),