mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
fix examples (because get_me now returns Me)
This commit is contained in:
parent
a80ff92aba
commit
8807cd7228
3 changed files with 9 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
use teloxide_core::{
|
||||
prelude::*,
|
||||
types::{DiceEmoji, ParseMode},
|
||||
types::{DiceEmoji, Me, ParseMode},
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -13,7 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.parse_mode(ParseMode::MarkdownV2)
|
||||
.auto_send();
|
||||
|
||||
let me = bot.get_me().await?;
|
||||
let Me { user: me, .. } = bot.get_me().await?;
|
||||
|
||||
bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
||||
bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
//! let me = bot.get_me().await?;
|
||||
//!
|
||||
//! bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
||||
//! bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
||||
//! .await?;
|
||||
//! bot.send_message(
|
||||
//! chat_id,
|
||||
//! format!("Hi, my name is **{}** 👋", me.user.first_name),
|
||||
//! )
|
||||
//! .await?;
|
||||
//! # Ok::<_, Box<dyn std::error::Error>>(()) };
|
||||
//! ```
|
||||
//!
|
||||
|
|
|
@ -44,7 +44,7 @@ pub trait Request: HasPayload {
|
|||
/// use teloxide_core::{
|
||||
/// payloads::GetMe,
|
||||
/// requests::{JsonRequest, Request},
|
||||
/// types::User,
|
||||
/// types::Me,
|
||||
/// Bot,
|
||||
/// };
|
||||
///
|
||||
|
@ -53,7 +53,7 @@ pub trait Request: HasPayload {
|
|||
/// // Note: it's recommended to `Requester` instead of creating requests directly
|
||||
/// let method = GetMe::new();
|
||||
/// let request = JsonRequest::new(bot, method);
|
||||
/// let _: User = request.send().await.unwrap();
|
||||
/// let _: Me = request.send().await.unwrap();
|
||||
/// # };
|
||||
/// ```
|
||||
fn send(self) -> Self::Send;
|
||||
|
|
Loading…
Reference in a new issue