mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Reformat imports
This commit is contained in:
parent
cf3e0182c9
commit
5284d5e884
19 changed files with 107 additions and 80 deletions
|
@ -1,16 +1,15 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::requests::edit_message_live_location::EditMessageLiveLocation;
|
||||
use crate::requests::forward_message::ForwardMessage;
|
||||
use crate::requests::get_file::GetFile;
|
||||
use crate::requests::get_me::GetMe;
|
||||
use crate::requests::send_audio::SendAudio;
|
||||
use crate::requests::send_location::SendLocation;
|
||||
use crate::requests::send_media_group::SendMediaGroup;
|
||||
use crate::requests::send_message::SendMessage;
|
||||
use crate::requests::send_photo::SendPhoto;
|
||||
use crate::requests::stop_message_live_location::StopMessageLiveLocation;
|
||||
use crate::requests::ChatId;
|
||||
use crate::types::{InputFile, InputMedia};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
requests::{
|
||||
edit_message_live_location::EditMessageLiveLocation,
|
||||
forward_message::ForwardMessage, get_file::GetFile, get_me::GetMe,
|
||||
send_audio::SendAudio, send_location::SendLocation,
|
||||
send_media_group::SendMediaGroup, send_message::SendMessage,
|
||||
send_photo::SendPhoto,
|
||||
stop_message_live_location::StopMessageLiveLocation, ChatId,
|
||||
},
|
||||
types::{InputFile, InputMedia},
|
||||
};
|
||||
|
||||
/// Telegram functions
|
||||
impl Bot {
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
use super::Bot;
|
||||
use crate::network::{download_file, download_file_stream};
|
||||
use crate::DownloadError;
|
||||
use reqwest::r#async::Chunk;
|
||||
use tokio::prelude::AsyncWrite;
|
||||
use tokio::stream::Stream;
|
||||
use tokio::{
|
||||
io::AsyncWrite,
|
||||
stream::Stream,
|
||||
};
|
||||
|
||||
|
||||
use crate::{
|
||||
DownloadError,
|
||||
bot::Bot,
|
||||
network::{download_file, download_file_stream},
|
||||
};
|
||||
|
||||
|
||||
impl Bot {
|
||||
/// Download file from telegram into `destination`.
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
use futures::StreamExt;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use tokio::{
|
||||
stream::Stream,
|
||||
io::{AsyncWrite, AsyncWriteExt},
|
||||
};
|
||||
use reqwest::{
|
||||
StatusCode,
|
||||
r#async::{multipart::Form, Client, Response, Chunk},
|
||||
};
|
||||
use bytes::Buf;
|
||||
use apply::Apply;
|
||||
|
||||
use crate::{
|
||||
requests::ResponseResult, types::ResponseParameters, RequestError,
|
||||
DownloadError, RequestError,
|
||||
requests::ResponseResult, types::ResponseParameters,
|
||||
};
|
||||
|
||||
use crate::DownloadError;
|
||||
use apply::Apply;
|
||||
use bytes::Buf;
|
||||
use futures::StreamExt;
|
||||
use reqwest::r#async::Chunk;
|
||||
use reqwest::{
|
||||
r#async::{multipart::Form, Client, Response},
|
||||
StatusCode,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tokio::prelude::AsyncWrite;
|
||||
use tokio::stream::Stream;
|
||||
|
||||
const TELEGRAM_API_URL: &str = "https://api.telegram.org";
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::network;
|
||||
use crate::requests::{Request, RequestContext, RequestFuture, ResponseResult};
|
||||
use crate::types::ShippingOption;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, RequestFuture, ResponseResult},
|
||||
types::ShippingOption,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
/// If you sent an invoice requesting a shipping address and the parameter
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, RequestFuture, ResponseResult},
|
||||
types::{Message, ReplyMarkup},
|
||||
};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
/// Use this method to edit live location messages. A location can be edited
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use reqwest::r#async::multipart::Form;
|
||||
|
||||
use crate::{
|
||||
requests::{utils, ChatId},
|
||||
types::{InputMedia, ParseMode},
|
||||
};
|
||||
|
||||
use reqwest::r#async::multipart::Form;
|
||||
|
||||
/// This is a convenient struct that builds `reqwest::r#async::multipart::Form`
|
||||
/// from scratch.
|
||||
pub struct FormBuilder {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request};
|
||||
use crate::types::Chat;
|
||||
use crate::network;
|
||||
use crate::{
|
||||
network,
|
||||
types::Chat,
|
||||
requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request},
|
||||
};
|
||||
|
||||
/// Use this method to get up to date information about the chat
|
||||
/// (current name of the user for one-on-one conversations,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
use crate::network;
|
||||
use crate::requests::{Request, RequestContext, RequestFuture, ResponseResult};
|
||||
use crate::types::File;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, RequestFuture, ResponseResult},
|
||||
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,13 +1,12 @@
|
|||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
use crate::errors::RequestError;
|
||||
use reqwest::r#async::Client;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
mod form_builder;
|
||||
mod utils;
|
||||
|
||||
use reqwest::r#async::Client;
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
use crate::RequestError;
|
||||
|
||||
pub type ResponseResult<T> = Result<T, RequestError>;
|
||||
|
||||
/// Request that can be sent to telegram.
|
||||
|
@ -68,6 +67,7 @@ pub mod answer_pre_checkout_query;
|
|||
pub mod answer_shipping_query;
|
||||
pub mod edit_message_live_location;
|
||||
pub mod forward_message;
|
||||
pub mod get_chat;
|
||||
pub mod get_file;
|
||||
pub mod get_me;
|
||||
pub mod get_user_profile_photos;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use crate::{
|
||||
network,
|
||||
requests::form_builder::FormBuilder,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
form_builder::FormBuilder, ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
},
|
||||
types::{InputFile, Message, ParseMode, ReplyMarkup},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
use crate::{
|
||||
network,
|
||||
requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
}
|
||||
};
|
||||
|
||||
///Use this method when you need to tell the user that something is happening
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, RequestFuture, ResponseResult},
|
||||
types::{Message, ReplyMarkup},
|
||||
};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
|
||||
|
||||
/// Use this method to send phone contacts.
|
||||
/// returned.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use apply::Apply;
|
||||
|
||||
use crate::{
|
||||
network::request_multipart,
|
||||
requests::{
|
||||
|
@ -6,7 +8,7 @@ use crate::{
|
|||
},
|
||||
types::{InputFile, InputMedia, Message},
|
||||
};
|
||||
use apply::Apply;
|
||||
|
||||
|
||||
/// Use this method to send a group of photos or videos as an album.
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, RequestFuture, ResponseResult},
|
||||
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,9 @@
|
|||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, RequestFuture, ResponseResult},
|
||||
types::{Message, ReplyMarkup},
|
||||
};
|
||||
use crate::types::{Message, ReplyMarkup};
|
||||
|
||||
|
||||
/// Use this method to send information about a venue.
|
||||
/// Message is returned.
|
||||
|
|
|
@ -2,6 +2,7 @@ use self::not_implemented_types::*;
|
|||
pub use self::{
|
||||
animation::Animation,
|
||||
audio::Audio,
|
||||
callback_game::CallbackGame,
|
||||
callback_query::CallbackQuery,
|
||||
chat::{Chat, ChatKind, NonPrivateChatKind},
|
||||
chat_member::{ChatMember, ChatMemberStatus},
|
||||
|
@ -13,6 +14,7 @@ pub use self::{
|
|||
file::File,
|
||||
force_reply::ForceReply,
|
||||
game::Game,
|
||||
game_high_score,
|
||||
inline_keyboard_button::{InlineKeyboardButton, InlineKeyboardButtonKind},
|
||||
inline_keyboard_markup::InlineKeyboardMarkup,
|
||||
inline_query::InlineQuery,
|
||||
|
@ -44,6 +46,7 @@ pub use self::{
|
|||
keyboard_button::KeyboardButton,
|
||||
label_price::LabeledPrice,
|
||||
location::Location,
|
||||
login_url::LoginUrl,
|
||||
mask_position::MaskPosition,
|
||||
message::{
|
||||
ForwardKind, ForwardedFrom, MediaKind, Message, MessageKind, Sender,
|
||||
|
@ -63,17 +66,21 @@ pub use self::{
|
|||
shipping_option::ShippingOption,
|
||||
shipping_query::ShippingQuery,
|
||||
sticker::Sticker,
|
||||
sticker_set::StickerSet,
|
||||
successful_payment::SuccessfulPayment,
|
||||
update::{Update, UpdateKind},
|
||||
user::User,
|
||||
user_profile_photos::UserProfilePhotos,
|
||||
venue::Venue,
|
||||
video::Video,
|
||||
video_note::VideoNote,
|
||||
voice::Voice,
|
||||
webhook_info::WebhookInfo,
|
||||
};
|
||||
|
||||
mod animation;
|
||||
mod audio;
|
||||
mod callback_game;
|
||||
mod callback_query;
|
||||
mod chat;
|
||||
mod chat_member;
|
||||
|
@ -85,6 +92,7 @@ mod document;
|
|||
mod file;
|
||||
mod force_reply;
|
||||
mod game;
|
||||
mod game_high_score;
|
||||
mod inline_keyboard_button;
|
||||
mod inline_keyboard_markup;
|
||||
mod input_file;
|
||||
|
@ -94,6 +102,7 @@ mod invoice;
|
|||
mod keyboard_button;
|
||||
mod label_price;
|
||||
mod location;
|
||||
mod login_url;
|
||||
mod mask_position;
|
||||
mod message;
|
||||
mod message_entity;
|
||||
|
@ -112,13 +121,16 @@ mod shipping_address;
|
|||
mod shipping_option;
|
||||
mod shipping_query;
|
||||
mod sticker;
|
||||
mod sticker_set;
|
||||
mod successful_payment;
|
||||
mod update;
|
||||
mod user;
|
||||
mod user_profile_photos;
|
||||
mod venue;
|
||||
mod video;
|
||||
mod video_note;
|
||||
mod voice;
|
||||
mod webhook_info;
|
||||
|
||||
mod inline_query;
|
||||
mod inline_query_result;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::types::PhotoSize;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a voice note.
|
||||
pub struct Voice {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
/// Contains information about the current status of a webhook.
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct WebhookInfo {
|
||||
/// Webhook URL, may be empty if webhook is not set up
|
||||
pub url: String,
|
||||
/// True, if a custom certificate was provided for webhook certificate checks
|
||||
/// True, if a custom certificate was provided for webhook certificate
|
||||
/// checks
|
||||
pub has_custom_certificate: bool,
|
||||
/// Number of updates awaiting delivery
|
||||
pub pending_update_count: u32,
|
||||
|
|
Loading…
Reference in a new issue