delete_optional now just gets Option<&Message>

This commit is contained in:
StNicolay 2023-05-27 22:46:08 +03:00
parent e5a0da9890
commit c3af1144db
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -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;
}
}