delete_optional now just gets Option<&Message>
This commit is contained in:
parent
e5a0da9890
commit
c3af1144db
@ -1,4 +1,3 @@
|
||||
use std::borrow::Borrow;
|
||||
use teloxide::{adaptors::Throttle, prelude::*};
|
||||
|
||||
/// Deletes the message ignoring the errors
|
||||
@ -9,9 +8,8 @@ pub async fn delete_message(bot: Throttle<Bot>, msg: Message) {
|
||||
|
||||
/// Deletes the message if there is one ignoring the errors
|
||||
#[inline]
|
||||
pub async fn delete_optional(bot: &Throttle<Bot>, msg: Option<impl Borrow<Message>>) {
|
||||
pub async fn delete_optional(bot: &Throttle<Bot>, msg: Option<&Message>) {
|
||||
if let Some(msg) = msg {
|
||||
let msg: &Message = msg.borrow();
|
||||
let _ = bot.delete_message(msg.chat.id, msg.id).await;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user