mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Remove core
module
This commit is contained in:
parent
bd9ba91de2
commit
af9cf93c76
104 changed files with 153 additions and 179 deletions
|
@ -1,8 +1,8 @@
|
|||
use reqwest::r#async::Client;
|
||||
|
||||
use crate::core::network::{download_file, download_file_stream};
|
||||
use crate::core::requests::get_file::GetFile;
|
||||
use crate::core::{
|
||||
use crate::network::{download_file, download_file_stream};
|
||||
use crate::requests::get_file::GetFile;
|
||||
use crate::{
|
||||
requests::{
|
||||
edit_message_live_location::EditMessageLiveLocation,
|
||||
forward_message::ForwardMessage, get_me::GetMe, send_audio::SendAudio,
|
||||
|
@ -58,10 +58,11 @@ impl Bot {
|
|||
/// ```no_run
|
||||
/// use async_telegram_bot::{
|
||||
/// bot::Bot,
|
||||
/// core::{requests::Request, types::File as TgFile},
|
||||
/// requests::Request,
|
||||
/// types::File as TgFile,
|
||||
/// };
|
||||
/// use tokio::fs::File;
|
||||
/// # use async_telegram_bot::core::requests::RequestError;
|
||||
/// # use async_telegram_bot::requests::RequestError;
|
||||
///
|
||||
/// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
/// let bot = Bot::new("TOKEN");
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
pub(crate) mod network;
|
||||
pub mod requests;
|
||||
pub mod types;
|
|
@ -3,8 +3,11 @@ extern crate derive_more;
|
|||
#[macro_use]
|
||||
extern crate serde;
|
||||
|
||||
mod network;
|
||||
|
||||
pub mod bot;
|
||||
pub mod core;
|
||||
pub mod errors;
|
||||
pub mod requests;
|
||||
pub mod types;
|
||||
|
||||
pub use errors::DownloadError;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
requests::{RequestError, ResponseResult},
|
||||
types::ResponseParameters,
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, RequestFuture, ResponseResult},
|
||||
};
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::ShippingOption;
|
||||
use crate::types::ShippingOption;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
/// If you sent an invoice requesting a shipping address and the parameter
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::{Message, ReplyMarkup};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
|
@ -1,6 +1,6 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use crate::core::{
|
||||
use crate::{
|
||||
requests::{utils, ChatId},
|
||||
types::{InputMedia, ParseMode},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
|
@ -1,6 +1,6 @@
|
|||
use crate::core::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request};
|
||||
use crate::core::types::Chat;
|
||||
use crate::core::network;
|
||||
use crate::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request};
|
||||
use crate::types::Chat;
|
||||
use crate::network;
|
||||
|
||||
/// Use this method to get up to date information about the chat
|
||||
/// (current name of the user for one-on-one conversations,
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::File;
|
||||
use crate::types::File;
|
||||
|
||||
/// Use this method to get basic info about a file and prepare it for
|
||||
/// downloading. For the moment, bots can download files of up to 20MB in size.
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, RequestFuture, ResponseResult},
|
||||
types::User,
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::requests::RequestContext;
|
||||
use crate::requests::RequestContext;
|
||||
|
||||
//TODO: complete implementation after user_profile_fotos will be added to
|
||||
// types/mod.rs
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::requests::RequestContext;
|
||||
use crate::requests::RequestContext;
|
||||
//TODO:: need implementation
|
||||
/// Use this method to kick a user from a group, a supergroup or a channel. In
|
||||
/// the case of supergroups and channels, the user will not be able to return to
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::requests::RequestContext;
|
||||
use crate::requests::RequestContext;
|
||||
//TODO:: need implementation
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::form_builder::FormBuilder,
|
||||
requests::{
|
||||
|
@ -32,10 +32,10 @@ pub struct SendAudio<'a> {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
/// Duration of the audio in seconds
|
||||
pub duration: Option<i32>,
|
|
@ -1,5 +1,5 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::{Message, ReplyMarkup};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
|
||||
/// Use this method to send phone contacts.
|
||||
/// returned.
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network::request_multipart,
|
||||
requests::{
|
||||
form_builder::FormBuilder, ChatId, Request, RequestContext,
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
|
@ -23,10 +23,10 @@ pub struct SendMessage<'a> {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
/// Disables link previews for links in this message
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
form_builder::FormBuilder, ChatId, Request, RequestContext,
|
||||
|
@ -30,10 +30,10 @@ pub struct SendPhoto<'a> {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
/// Sends the message silently. Users will receive a notification with no
|
||||
/// sound.
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::{Message, ReplyMarkup};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
|
||||
/// Use this method to send a native poll. A native poll can't be sent to a
|
||||
/// private chat. On success, the sent Message is returned.
|
|
@ -1,8 +1,8 @@
|
|||
use crate::core::network;
|
||||
use crate::core::requests::{
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::core::types::{Message, ReplyMarkup};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
|
||||
/// Use this method to send information about a venue.
|
||||
/// Message is returned.
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::{
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::requests::RequestContext;
|
||||
use crate::requests::RequestContext;
|
||||
//TODO:: need implementation
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::PhotoSize;
|
||||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
/// This object represents an animation file (GIF or H.264/MPEG-4 AVC video
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::PhotoSize;
|
||||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||
pub struct Audio {
|
||||
|
@ -42,8 +42,8 @@ mod tests {
|
|||
file_id: "id".to_string(),
|
||||
width: 320,
|
||||
height: 320,
|
||||
file_size: Some(3452)
|
||||
})
|
||||
file_size: Some(3452),
|
||||
}),
|
||||
};
|
||||
let actual = serde_json::from_str::<Audio>(&json).unwrap();
|
||||
assert_eq!(actual, expected)
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{Message, User};
|
||||
use crate::types::{Message, User};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
pub struct CallbackQuery {
|
||||
|
@ -8,7 +8,7 @@ pub struct CallbackQuery {
|
|||
pub message: Option<Message>,
|
||||
pub inline_message_id: Option<String>,
|
||||
pub data: Option<String>,
|
||||
pub game_short_name: Option<String>
|
||||
pub game_short_name: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -37,13 +37,13 @@ mod tests {
|
|||
first_name: "firstName".to_string(),
|
||||
last_name: None,
|
||||
username: None,
|
||||
language_code: None
|
||||
language_code: None,
|
||||
},
|
||||
chat_instance: "123456".to_string(),
|
||||
message: None,
|
||||
inline_message_id: Some("i_m_id".to_string()),
|
||||
data: Some("some_data".to_string()),
|
||||
game_short_name: Some("game_name".to_string())
|
||||
game_short_name: Some("game_name".to_string()),
|
||||
};
|
||||
let actual = serde_json::from_str::<CallbackQuery>(json).unwrap();
|
||||
assert_eq!(actual, expected);
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{ChatPermissions, ChatPhoto, Message};
|
||||
use crate::types::{ChatPermissions, ChatPhoto, Message};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
pub struct Chat {
|
||||
|
@ -80,7 +80,7 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::core::types::*;
|
||||
use crate::types::*;
|
||||
use serde_json::from_str;
|
||||
|
||||
#[test]
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::User;
|
||||
use crate::types::User;
|
||||
|
||||
/// This object contains information about one member of the chat.
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
|
@ -63,7 +63,7 @@ pub enum ChatMemberStatus {
|
|||
Member,
|
||||
Restricted,
|
||||
Left,
|
||||
Kicked
|
||||
Kicked,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -103,7 +103,7 @@ mod tests {
|
|||
first_name: "firstName".to_string(),
|
||||
last_name: None,
|
||||
username: None,
|
||||
language_code: None
|
||||
language_code: None,
|
||||
},
|
||||
status: ChatMemberStatus::Creator,
|
||||
until_date: Some(123456),
|
||||
|
@ -119,9 +119,9 @@ mod tests {
|
|||
can_send_messages: Some(true),
|
||||
can_send_media_messages: Some(true),
|
||||
can_send_other_messages: Some(true),
|
||||
can_add_web_page_previews: Some(true)
|
||||
can_add_web_page_previews: Some(true),
|
||||
};
|
||||
let actual = serde_json::from_str::<ChatMember>(&json).unwrap();
|
||||
assert_eq!(actual, expected)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{Location, User};
|
||||
use crate::types::{Location, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
||||
/// Represents a result of an inline query that was chosen by the user and
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::PhotoSize;
|
||||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
pub struct Document {
|
|
@ -1,6 +1,6 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
use crate::core::types::{Animation, MessageEntity, PhotoSize};
|
||||
use crate::types::{Animation, MessageEntity, PhotoSize};
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a game. Use BotFather to create and edit games, their
|
|
@ -1,6 +1,6 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
use crate::core::types::user::User;
|
||||
use crate::types::user::User;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
/// This object represents one row of the high scores table for a game.
|
||||
|
@ -11,4 +11,4 @@ pub struct GameHighScore {
|
|||
pub user: User,
|
||||
/// Score
|
||||
pub score: u32,
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ pub enum InlineKeyboardButtonKind {
|
|||
///
|
||||
/// Example:
|
||||
/// ```edition2018
|
||||
/// use async_telegram_bot::core::types::InlineKeyboardButton;
|
||||
/// use async_telegram_bot::types::InlineKeyboardButton;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let url_button = InlineKeyboardButton::url(
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::InlineKeyboardButton;
|
||||
use crate::types::InlineKeyboardButton;
|
||||
|
||||
/// This object represents an inline keyboard that appears right next to the
|
||||
/// message it belongs to.
|
||||
|
@ -16,7 +16,7 @@ pub struct InlineKeyboardMarkup {
|
|||
///
|
||||
/// Example:
|
||||
/// ```
|
||||
/// use async_telegram_bot::core::types::{
|
||||
/// use async_telegram_bot::types::{
|
||||
/// InlineKeyboardButton, InlineKeyboardMarkup,
|
||||
/// };
|
||||
///
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{Location, User};
|
||||
use crate::types::{Location, User};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQuery {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{
|
||||
use crate::types::{
|
||||
InlineQueryResultArticle, InlineQueryResultAudio,
|
||||
InlineQueryResultCachedAudio, InlineQueryResultCachedDocument,
|
||||
InlineQueryResultCachedGif, InlineQueryResultCachedMpeg4Gif,
|
||||
|
@ -49,9 +49,9 @@ pub enum InlineQueryResult {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::core::types::inline_keyboard_markup::InlineKeyboardMarkup;
|
||||
use crate::core::types::parse_mode::ParseMode;
|
||||
use crate::core::types::{
|
||||
use crate::types::inline_keyboard_markup::InlineKeyboardMarkup;
|
||||
use crate::types::parse_mode::ParseMode;
|
||||
use crate::types::{
|
||||
InlineQueryResult, InlineQueryResultCachedAudio, InputMessageContent,
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultArticle {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultAudio {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedAudio {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedDocument {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedGif {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedMpeg4Gif {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedPhoto {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedSticker {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedVideo {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultCachedVoice {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultContact {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultDocument {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::InlineKeyboardMarkup;
|
||||
use crate::types::InlineKeyboardMarkup;
|
||||
|
||||
#[derive(Debug, Serialize, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct InlineQueryResultGame {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultGif {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultLocation {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultMpeg4Gif {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
/// Represents a link to a photo. By default, this photo will be sent by the
|
||||
/// user with optional caption. Alternatively, you can use input_message_content
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultVenue {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultVideo {
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::types::{
|
||||
InlineKeyboardMarkup, InputMessageContent, ParseMode,
|
||||
};
|
||||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
pub struct InlineQueryResultVoice {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{InputFile, ParseMode};
|
||||
use crate::types::{InputFile, ParseMode};
|
||||
|
||||
// TODO: should variants use new-type?
|
||||
#[derive(Debug, Serialize, PartialEq, Eq, Clone)]
|
||||
|
@ -18,10 +18,10 @@ pub enum InputMedia {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ pub enum InputMedia {
|
|||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::core::types::InputFile::File
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the video to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -44,10 +44,10 @@ pub enum InputMedia {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
/// Video width
|
||||
|
@ -74,7 +74,7 @@ pub enum InputMedia {
|
|||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::core::types::InputFile::File
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the animation to be sent, 0-1024 characters
|
||||
|
@ -84,10 +84,10 @@ pub enum InputMedia {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
/// Animation width
|
||||
|
@ -110,7 +110,7 @@ pub enum InputMedia {
|
|||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::core::types::InputFile::File
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the audio to be sent, 0-1024 characters
|
||||
|
@ -120,10 +120,10 @@ pub enum InputMedia {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<String>,
|
||||
/// Duration of the audio in seconds
|
||||
|
@ -146,7 +146,7 @@ pub enum InputMedia {
|
|||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::core::types::InputFile::File
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the document to be sent, 0-1024 characters
|
||||
|
@ -156,10 +156,10 @@ pub enum InputMedia {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
},
|
|
@ -1,6 +1,6 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use crate::core::types::ParseMode;
|
||||
use crate::types::ParseMode;
|
||||
|
||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
|
@ -18,10 +18,10 @@ pub enum InputMessageContent {
|
|||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::core::types::ParseMode::Markdown
|
||||
/// [Html]: crate::core::types::ParseMode::Html
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [Html]: crate::types::ParseMode::Html
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::core::types::ParseMode
|
||||
/// crate::types::ParseMode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{
|
||||
use crate::types::{
|
||||
Animation, Audio, Chat, Contact, Document, Game, InlineKeyboardMarkup,
|
||||
Invoice, Location, MessageEntity, PassportData, PhotoSize, Poll, Sticker,
|
||||
SuccessfulPayment, User, Venue, Video, VideoNote, Voice,
|
||||
|
@ -17,9 +17,10 @@ pub struct Message {
|
|||
impl Message {
|
||||
fn text(&self) -> Option<&str> {
|
||||
if let MessageKind::Common {
|
||||
media_kind: MediaKind::Text {
|
||||
ref text, ..
|
||||
}, .. } = self.kind {
|
||||
media_kind: MediaKind::Text { ref text, .. },
|
||||
..
|
||||
} = self.kind
|
||||
{
|
||||
Some(text)
|
||||
} else {
|
||||
None
|
||||
|
@ -202,7 +203,7 @@ pub enum MediaKind {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::core::types::*;
|
||||
use crate::types::*;
|
||||
use serde_json::from_str;
|
||||
|
||||
#[test]
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::User;
|
||||
use crate::types::User;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
pub struct MessageEntity {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::ShippingAddress;
|
||||
use crate::types::ShippingAddress;
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
pub struct OrderInfo {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{OrderInfo, User};
|
||||
use crate::types::{OrderInfo, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct PreCheckoutQuery {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::KeyboardButton;
|
||||
use crate::types::KeyboardButton;
|
||||
|
||||
/// This object represents a custom keyboard with reply options.
|
||||
#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)]
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{
|
||||
use crate::types::{
|
||||
ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove,
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::core::requests::ChatId;
|
||||
use crate::core::types::{InlineKeyboardMarkup, LabeledPrice};
|
||||
use crate::requests::ChatId;
|
||||
use crate::types::{InlineKeyboardMarkup, LabeledPrice};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct SendInvoice {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::LabeledPrice;
|
||||
use crate::types::LabeledPrice;
|
||||
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object represents one shipping option.
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{ShippingAddress, User};
|
||||
use crate::types::{ShippingAddress, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct ShippingQuery {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{MaskPosition, PhotoSize};
|
||||
use crate::types::{MaskPosition, PhotoSize};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
pub struct Sticker {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::Sticker;
|
||||
use crate::types::Sticker;
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct Sticker {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::OrderInfo;
|
||||
use crate::types::OrderInfo;
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
pub struct SuccessfulPayment {
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::{CallbackQuery, ChosenInlineResult, Message};
|
||||
use crate::types::{CallbackQuery, ChosenInlineResult, Message};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
pub struct Update {
|
|
@ -1,7 +1,7 @@
|
|||
use crate::core::types::PhotoSize;
|
||||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
pub struct UserProfilePhotos {
|
||||
pub total_count: u32,
|
||||
pub photos: Vec<Vec<PhotoSize>>
|
||||
pub photos: Vec<Vec<PhotoSize>>,
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::types::Location;
|
||||
use crate::types::Location;
|
||||
|
||||
/// This object represents a venue.
|
||||
#[derive(Debug, Deserialize, PartialEq, Serialize, Clone)]
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue