diff --git a/README.md b/README.md index 3d057994..ea915aea 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ async fn handle_start( msg: Message, dialogue: MyDialogue, ) -> anyhow::Result<()> { - bot.send_message(msg.chat_id, "Let's start! What's your full name?").await?; + bot.send_message(msg.chat_id(), "Let's start! What's your full name?").await?; dialogue.update(State::ReceiveFullName).await?; Ok(()) } @@ -250,11 +250,11 @@ async fn handle_receive_full_name( ) -> anyhow::Result<()> { match msg.text() { Some(text) => { - bot.send_message(msg.chat_id, "How old are you?").await?; + bot.send_message(msg.chat_id(), "How old are you?").await?; dialogue.update(State::ReceiveAge { full_name: text.into() }).await?; } None => { - bot.send_message(msg.chat_id, "Send me plain text.").await?; + bot.send_message(msg.chat_id(), "Send me plain text.").await?; } } @@ -269,11 +269,11 @@ async fn handle_receive_age( ) -> anyhow::Result<()> { match msg.text().map(|text| text.parse::()) { Some(Ok(age)) => { - bot.send_message(msg.chat_id, "What's your location?").await?; + bot.send_message(msg.chat_id(), "What's your location?").await?; dialogue.update(State::ReceiveLocation { full_name, age }).await?; } _ => { - bot.send_message(msg.chat_id, "Send me a number.").await?; + bot.send_message(msg.chat_id(), "Send me a number.").await?; } } @@ -289,11 +289,11 @@ async fn handle_receive_location( match msg.text() { Some(location) => { let message = format!("Full name: {}\nAge: {}\nLocation: {}", full_name, age, location); - bot.send_message(msg.chat_id, message).await?; + bot.send_message(msg.chat_id(), message).await?; dialogue.exit().await?; } None => { - bot.send_message(msg.chat_id, "Send me plain text.").await?; + bot.send_message(msg.chat_id(), "Send me plain text.").await?; } } diff --git a/examples/admin.rs b/examples/admin.rs index 47d02a8c..6a080f15 100644 --- a/examples/admin.rs +++ b/examples/admin.rs @@ -69,10 +69,10 @@ async fn kick_user(bot: Bot, msg: Message) -> Result<(), Box { // bot.unban_chat_member can also kicks a user from a group chat. - bot.unban_chat_member(msg.chat_id, replied.from().unwrap().id).await?; + bot.unban_chat_member(msg.chat_id(), replied.from().unwrap().id).await?; } None => { - bot.send_message(msg.chat_id, "Use this command in reply to another message").await?; + bot.send_message(msg.chat_id(), "Use this command in reply to another message").await?; } } Ok(()) @@ -87,7 +87,7 @@ async fn mute_user( match msg.reply_to_message() { Some(replied) => { bot.restrict_chat_member( - msg.chat_id, + msg.chat_id(), replied.from().expect("Must be MessageKind::Common").id, ChatPermissions::empty(), ) @@ -95,7 +95,7 @@ async fn mute_user( .await?; } None => { - bot.send_message(msg.chat_id, "Use this command in a reply to another message!") + bot.send_message(msg.chat_id(), "Use this command in a reply to another message!") .await?; } } @@ -111,14 +111,14 @@ async fn ban_user( match msg.reply_to_message() { Some(replied) => { bot.kick_chat_member( - msg.chat_id, + msg.chat_id(), replied.from().expect("Must be MessageKind::Common").id, ) .until_date(msg.date + time) .await?; } None => { - bot.send_message(msg.chat_id, "Use this command in a reply to another message!") + bot.send_message(msg.chat_id(), "Use this command in a reply to another message!") .await?; } } @@ -132,7 +132,7 @@ async fn action( ) -> Result<(), Box> { match command { Command::Help => { - bot.send_message(msg.chat_id, Command::descriptions()).await?; + bot.send_message(msg.chat_id(), Command::descriptions()).await?; } Command::Kick => kick_user(bot, msg).await?, Command::Ban { time, unit } => ban_user(bot, msg, calc_restrict_time(time, unit)).await?, diff --git a/examples/dialogue.rs b/examples/dialogue.rs index 8b652034..64f9489e 100644 --- a/examples/dialogue.rs +++ b/examples/dialogue.rs @@ -64,7 +64,7 @@ async fn handle_start( msg: Message, dialogue: MyDialogue, ) -> anyhow::Result<()> { - bot.send_message(msg.chat_id, "Let's start! What's your full name?").await?; + bot.send_message(msg.chat_id(), "Let's start! What's your full name?").await?; dialogue.update(State::ReceiveFullName).await?; Ok(()) } @@ -76,11 +76,11 @@ async fn handle_receive_full_name( ) -> anyhow::Result<()> { match msg.text() { Some(text) => { - bot.send_message(msg.chat_id, "How old are you?").await?; + bot.send_message(msg.chat_id(), "How old are you?").await?; dialogue.update(State::ReceiveAge { full_name: text.into() }).await?; } None => { - bot.send_message(msg.chat_id, "Send me plain text.").await?; + bot.send_message(msg.chat_id(), "Send me plain text.").await?; } } @@ -95,11 +95,11 @@ async fn handle_receive_age( ) -> anyhow::Result<()> { match msg.text().map(|text| text.parse::()) { Some(Ok(age)) => { - bot.send_message(msg.chat_id, "What's your location?").await?; + bot.send_message(msg.chat_id(), "What's your location?").await?; dialogue.update(State::ReceiveLocation { full_name, age }).await?; } _ => { - bot.send_message(msg.chat_id, "Send me a number.").await?; + bot.send_message(msg.chat_id(), "Send me a number.").await?; } } @@ -115,11 +115,11 @@ async fn handle_receive_location( match msg.text() { Some(location) => { let message = format!("Full name: {}\nAge: {}\nLocation: {}", full_name, age, location); - bot.send_message(msg.chat_id, message).await?; + bot.send_message(msg.chat_id(), message).await?; dialogue.exit().await?; } None => { - bot.send_message(msg.chat_id, "Send me plain text.").await?; + bot.send_message(msg.chat_id(), "Send me plain text.").await?; } } diff --git a/src/dispatching2/dialogue/mod.rs b/src/dispatching2/dialogue/mod.rs index 4fa84674..a5e85d17 100644 --- a/src/dispatching2/dialogue/mod.rs +++ b/src/dispatching2/dialogue/mod.rs @@ -43,15 +43,15 @@ //! match msg.text() { //! Some(number) => match number.parse::() { //! Ok(age) => { -//! bot.send_message(msg.chat_id, "What's your location?").await?; +//! bot.send_message(msg.chat_id(), "What's your location?").await?; //! dialogue.update(State::ReceiveLocation { full_name, age }).await?; //! } //! _ => { -//! bot.send_message(msg.chat_id, "Send me a number.").await?; +//! bot.send_message(msg.chat_id(), "Send me a number.").await?; //! } //! }, //! None => { -//! bot.send_message(msg.chat_id, "Send me a text message.").await?; +//! bot.send_message(msg.chat_id(), "Send me a text message.").await?; //! } //! } //! @@ -76,11 +76,11 @@ //! Some(location) => { //! let message = //! format!("Full name: {}\nAge: {}\nLocation: {}", full_name, age, location); -//! bot.send_message(msg.chat_id, message).await?; +//! bot.send_message(msg.chat_id(), message).await?; //! dialogue.exit().await?; //! } //! None => { -//! bot.send_message(msg.chat_id, "Send me a text message.").await?; +//! bot.send_message(msg.chat_id(), "Send me a text message.").await?; //! } //! } //!