mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +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::{
|
use teloxide_core::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
types::{DiceEmoji, ParseMode},
|
types::{DiceEmoji, Me, ParseMode},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
@ -13,7 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.parse_mode(ParseMode::MarkdownV2)
|
.parse_mode(ParseMode::MarkdownV2)
|
||||||
.auto_send();
|
.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_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
||||||
bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
||||||
|
|
|
@ -25,8 +25,11 @@
|
||||||
//! let me = bot.get_me().await?;
|
//! let me = bot.get_me().await?;
|
||||||
//!
|
//!
|
||||||
//! bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
//! bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
||||||
//! bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
//! bot.send_message(
|
||||||
//! .await?;
|
//! chat_id,
|
||||||
|
//! format!("Hi, my name is **{}** 👋", me.user.first_name),
|
||||||
|
//! )
|
||||||
|
//! .await?;
|
||||||
//! # Ok::<_, Box<dyn std::error::Error>>(()) };
|
//! # Ok::<_, Box<dyn std::error::Error>>(()) };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub trait Request: HasPayload {
|
||||||
/// use teloxide_core::{
|
/// use teloxide_core::{
|
||||||
/// payloads::GetMe,
|
/// payloads::GetMe,
|
||||||
/// requests::{JsonRequest, Request},
|
/// requests::{JsonRequest, Request},
|
||||||
/// types::User,
|
/// types::Me,
|
||||||
/// Bot,
|
/// Bot,
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
|
@ -53,7 +53,7 @@ pub trait Request: HasPayload {
|
||||||
/// // Note: it's recommended to `Requester` instead of creating requests directly
|
/// // Note: it's recommended to `Requester` instead of creating requests directly
|
||||||
/// let method = GetMe::new();
|
/// let method = GetMe::new();
|
||||||
/// let request = JsonRequest::new(bot, method);
|
/// let request = JsonRequest::new(bot, method);
|
||||||
/// let _: User = request.send().await.unwrap();
|
/// let _: Me = request.send().await.unwrap();
|
||||||
/// # };
|
/// # };
|
||||||
/// ```
|
/// ```
|
||||||
fn send(self) -> Self::Send;
|
fn send(self) -> Self::Send;
|
||||||
|
|
Loading…
Add table
Reference in a new issue