mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Add docs to Bot
This commit is contained in:
parent
0232108822
commit
a8e1dac7bb
11 changed files with 862 additions and 13 deletions
841
src/bot/api.rs
841
src/bot/api.rs
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,10 @@ use crate::{bot::Bot, network::download_file, DownloadError};
|
|||
|
||||
impl Bot {
|
||||
/// Download a file from Telegram into `destination`.
|
||||
/// `path` can be obtained from [`get_file`] method.
|
||||
///
|
||||
/// For downloading as Stream of Chunks see [`download_file_stream`].
|
||||
/// `path` can be obtained from [`Bot::get_file`].
|
||||
///
|
||||
/// To download as a stream of chunks, see [`Bot::download_file_stream`].
|
||||
///
|
||||
/// ## Examples
|
||||
///
|
||||
|
@ -30,8 +31,8 @@ impl Bot {
|
|||
/// # Ok(()) }
|
||||
/// ```
|
||||
///
|
||||
/// [`get_file`]: crate::Bot::get_file
|
||||
/// [`download_file_stream`]: crate::Bot::download_file_stream
|
||||
/// [`Bot::get_file`]: crate::Bot::get_file
|
||||
/// [`Bot::download_file_stream`]: crate::Bot::download_file_stream
|
||||
pub async fn download_file<D>(
|
||||
&self,
|
||||
path: &str,
|
||||
|
@ -45,15 +46,15 @@ impl Bot {
|
|||
|
||||
/// Download a file from Telegram.
|
||||
///
|
||||
/// `path` can be obtained from the [`get_file`] method.
|
||||
/// `path` can be obtained from the [`Bot::get_file`].
|
||||
///
|
||||
/// For downloading into [`AsyncWrite`] (e.g. [`tokio::fs::File`])
|
||||
/// see [`download_file`].
|
||||
/// To download into [`AsyncWrite`] (e.g. [`tokio::fs::File`]), see
|
||||
/// [`Bot::download_file`].
|
||||
///
|
||||
/// [`get_file`]: crate::bot::Bot::get_file
|
||||
/// [`Bot::get_file`]: crate::bot::Bot::get_file
|
||||
/// [`AsyncWrite`]: tokio::io::AsyncWrite
|
||||
/// [`tokio::fs::File`]: tokio::fs::File
|
||||
/// [`download_file`]: crate::Bot::download_file
|
||||
/// [`Bot::download_file`]: crate::Bot::download_file
|
||||
#[cfg(feature = "unstable-stream")]
|
||||
pub async fn download_file_stream(
|
||||
&self,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl<'a> AnswerInlineQuery<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Unique identifier for the answered query/
|
||||
/// Unique identifier for the answered query.
|
||||
pub fn inline_query_id<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<String>,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl<'a> AnswerShippingQuery<'a> {
|
|||
}
|
||||
|
||||
/// Specify `true` if delivery to the specified address is possible and
|
||||
/// False if there are any problems (for example, if delivery to the
|
||||
/// `false` if there are any problems (for example, if delivery to the
|
||||
/// specified address is not possible).
|
||||
pub fn ok(mut self, val: bool) -> Self {
|
||||
self.ok = val;
|
||||
|
|
|
@ -7,6 +7,7 @@ use crate::{
|
|||
types::{ChatOrInlineMessage, InlineKeyboardMarkup, Message},
|
||||
Bot,
|
||||
};
|
||||
|
||||
/// Use this method to edit only the reply markup of messages.
|
||||
///
|
||||
/// On success, if edited message is sent by the bot, the edited [`Message`] is
|
||||
|
|
|
@ -85,7 +85,9 @@ impl<'a> SendDocument<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
/// File to send. Pass a file_id as String to send a file that exists on the
|
||||
/// File to send.
|
||||
///
|
||||
/// Pass a file_id as String to send a file that exists on the
|
||||
/// Telegram servers (recommended), pass an HTTP URL as a String for
|
||||
/// Telegram to get a file from the Internet, or upload a new one using
|
||||
/// `multipart/form-data`. [More info on Sending Files »].
|
||||
|
|
|
@ -82,6 +82,7 @@ impl<'a> SendSticker<'a> {
|
|||
/// [`InputFile::File`]: crate::types::InputFile::File
|
||||
/// [`InputFile::Url`]: crate::types::InputFile::Url
|
||||
/// [`InputFile::FileId`]: crate::types::InputFile::FileId
|
||||
/// [More info on Sending Files »]: https://core.telegram.org/bots/api#sending-files
|
||||
pub fn sticker(mut self, val: InputFile) -> Self {
|
||||
self.sticker = val;
|
||||
self
|
||||
|
|
|
@ -99,6 +99,7 @@ impl<'a> SendVideoNote<'a> {
|
|||
/// [`InputFile::File`]: crate::types::InputFile::File
|
||||
/// [`InputFile::Url`]: crate::types::InputFile::Url
|
||||
/// [`InputFile::FileId`]: crate::types::InputFile::FileId
|
||||
/// [More info on Sending Files »]: https://core.telegram.org/bots/api#sending-files
|
||||
pub fn video_note(mut self, val: InputFile) -> Self {
|
||||
self.video_note = val;
|
||||
self
|
||||
|
|
|
@ -101,6 +101,7 @@ impl<'a> SendVoice<'a> {
|
|||
/// [`InputFile::File`]: crate::types::InputFile::File
|
||||
/// [`InputFile::Url`]: crate::types::InputFile::Url
|
||||
/// [`InputFile::FileId`]: crate::types::InputFile::FileId
|
||||
/// [More info on Sending Files »]: https://core.telegram.org/bots/api#sending-files
|
||||
pub fn voice(mut self, val: InputFile) -> Self {
|
||||
self.voice = val;
|
||||
self
|
||||
|
|
|
@ -61,7 +61,7 @@ impl<'a> SetChatPhoto<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
/// New chat photo, uploaded using multipart/form-data.
|
||||
/// New chat photo, uploaded using `multipart/form-data`.
|
||||
pub fn photo(mut self, val: InputFile) -> Self {
|
||||
self.photo = val;
|
||||
self
|
||||
|
|
|
@ -7,6 +7,7 @@ use crate::{
|
|||
types::{ChatId, True},
|
||||
Bot,
|
||||
};
|
||||
|
||||
/// Use this method to unpin a message in a group, a supergroup, or a channel.
|
||||
///
|
||||
/// The bot must be an administrator in the chat for this to work and must have
|
||||
|
|
Loading…
Add table
Reference in a new issue