mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-23 16:56:24 +01:00
Merge pull request #45 from teloxide/fix_send_media_group_rtty
Fix SendMediaGroup return type
This commit is contained in:
commit
70563ee4a9
8 changed files with 18 additions and 15 deletions
|
@ -299,7 +299,7 @@ pub enum ApiError {
|
|||
rename = "Bad Request: query is too old and response timeout expired or query id is \
|
||||
invalid"
|
||||
)]
|
||||
InvalidQueryID,
|
||||
InvalidQueryId,
|
||||
|
||||
/// Occurs when bot tries to send InlineKeyboardMarkup with invalid button
|
||||
/// url.
|
||||
|
@ -309,7 +309,7 @@ pub enum ApiError {
|
|||
///
|
||||
/// [`SendMessage`]: crate::payloads::SendMessage
|
||||
#[serde(rename = "Bad Request: BUTTON_URL_INVALID")]
|
||||
ButtonURLInvalid,
|
||||
ButtonUrlInvalid,
|
||||
|
||||
/// Occurs when bot tries to send button with data size more than 64 bytes.
|
||||
///
|
||||
|
@ -339,7 +339,7 @@ pub enum ApiError {
|
|||
///
|
||||
/// [`GetFile`]: crate::payloads::GetFile
|
||||
#[serde(rename = "Bad Request: wrong file id")]
|
||||
WrongFileID,
|
||||
WrongFileId,
|
||||
|
||||
/// Occurs when bot tries to do some with group which was deactivated.
|
||||
#[serde(rename = "Bad Request: group is deactivated")]
|
||||
|
@ -413,7 +413,7 @@ pub enum ApiError {
|
|||
///
|
||||
/// [`SetWebhook`]: crate::payloads::SetWebhook
|
||||
#[serde(rename = "Bad Request: bad webhook: HTTPS url must be provided for webhook")]
|
||||
WebhookRequireHTTPS,
|
||||
WebhookRequireHttps,
|
||||
|
||||
/// Occurs when bot tries to set webhook to port other than 80, 88, 443 or
|
||||
/// 8443.
|
||||
|
@ -509,7 +509,7 @@ pub enum ApiError {
|
|||
///
|
||||
/// [`SendMessage`]: crate::payloads::SendMessage
|
||||
#[serde(rename = "Bad Request: wrong HTTP URL")]
|
||||
WrongHTTPurl,
|
||||
WrongHttpUrl,
|
||||
|
||||
/// Occurs when bot tries GetUpdate before the timeout. Make sure that only
|
||||
/// one Updater is running.
|
||||
|
|
|
@ -10,7 +10,7 @@ impl_payload! {
|
|||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
|
||||
pub SendMediaGroup (SendMediaGroupSetters) => Message {
|
||||
pub SendMediaGroup (SendMediaGroupSetters) => Vec<Message> {
|
||||
required {
|
||||
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
|
||||
pub chat_id: ChatId [into],
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::{
|
|||
/// // Required parameters are supplied to the `Requester` methods:
|
||||
/// bot.send_message(0, "<b>Text</b>")
|
||||
/// // Optional parameters can be supplied by calling setters
|
||||
/// .parse_mode(ParseMode::HTML)
|
||||
/// .parse_mode(ParseMode::Html)
|
||||
/// // To send request to telegram you need to call `.send()` and await the resulting future
|
||||
/// .send()
|
||||
/// .await?;
|
||||
|
|
|
@ -82,7 +82,7 @@ mod tests {
|
|||
id: String::from("id"),
|
||||
audio_file_id: String::from("audio_file_id"),
|
||||
caption: Some(String::from("caption")),
|
||||
parse_mode: Some(ParseMode::HTML),
|
||||
parse_mode: Some(ParseMode::Html),
|
||||
reply_markup: Some(InlineKeyboardMarkup::default()),
|
||||
input_message_content: Some(InputMessageContent::Text(InputMessageContentText {
|
||||
message_text: String::from("message_text"),
|
||||
|
|
|
@ -24,12 +24,12 @@ pub struct InlineQueryResultCachedGif {
|
|||
/// Caption of the GIF file to be sent, 0-1024 characters.
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [`ParseMode::Markdown`] or [`ParseMode::HTML`], if you want
|
||||
/// Send [`ParseMode::Markdown`] or [`ParseMode::Html`], if you want
|
||||
/// Telegram apps to show [bold, italic, fixed-width text or inline
|
||||
/// URLs] in the media caption.
|
||||
///
|
||||
/// [`ParseMode::Markdown`]: crate::types::ParseMode::Markdown
|
||||
/// [`ParseMode::HTML`]: crate::types::ParseMode::HTML
|
||||
/// [`ParseMode::Html`]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ISO 3166-1 alpha-2 language code.
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub enum CountryCode {
|
||||
/// Andorra
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ISO 4217 currency.
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub enum Currency {
|
||||
/// United Arab Emirates dirham
|
||||
|
|
|
@ -69,7 +69,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// ignored.
|
||||
///
|
||||
/// ## HTML style
|
||||
/// To use this mode, pass [`HTML`] in the `parse_mode` field.
|
||||
/// To use this mode, pass [`Html`] in the `parse_mode` field.
|
||||
/// The following tags are currently supported:
|
||||
/// ````text
|
||||
/// <b>bold</b>, <strong>bold</strong>
|
||||
|
@ -123,12 +123,13 @@ use serde::{Deserialize, Serialize};
|
|||
/// `*2*\**2=4*` for bold `2*2=4`.
|
||||
///
|
||||
/// [`MarkdownV2`]: ParseMode::MarkdownV2
|
||||
/// [`HTML`]: ParseMode::HTML
|
||||
/// [`Html`]: ParseMode::Html
|
||||
/// [`Markdown`]: ParseMode::Markdown
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub enum ParseMode {
|
||||
MarkdownV2,
|
||||
HTML,
|
||||
#[serde(rename = "HTML")]
|
||||
Html,
|
||||
#[deprecated = "This is a legacy mode, retained for backward compatibility. Use `MarkdownV2` \
|
||||
instead."]
|
||||
Markdown,
|
||||
|
@ -140,7 +141,7 @@ impl TryFrom<&str> for ParseMode {
|
|||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
let normalized = value.to_lowercase();
|
||||
match normalized.as_ref() {
|
||||
"html" => Ok(ParseMode::HTML),
|
||||
"html" => Ok(ParseMode::Html),
|
||||
"markdown" => Ok(ParseMode::Markdown),
|
||||
"markdownv2" => Ok(ParseMode::MarkdownV2),
|
||||
_ => Err(()),
|
||||
|
@ -173,7 +174,7 @@ mod tests {
|
|||
#[test]
|
||||
fn html_serialization() {
|
||||
let expected_json = String::from(r#""HTML""#);
|
||||
let actual_json = serde_json::to_string(&ParseMode::HTML).unwrap();
|
||||
let actual_json = serde_json::to_string(&ParseMode::Html).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue