mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Small fixes in derived traits and docs of ChatId
, ReplyMarkup
and ReplyMarkup
-related structs
This commit is contained in:
parent
56a33df68c
commit
7e821f2401
7 changed files with 46 additions and 15 deletions
|
@ -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,
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<bool>,
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue