From d79da1b95567fdbdec5f24650d65a0fd55d67352 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 22 Jun 2025 17:39:47 +0200 Subject: [PATCH] Refactor donation notification logic for clarity and efficiency --- .../services/donation_notifications.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/bots/approved_bot/services/donation_notifications.rs b/src/bots/approved_bot/services/donation_notifications.rs index 57a190d..6ecbd33 100644 --- a/src/bots/approved_bot/services/donation_notifications.rs +++ b/src/bots/approved_bot/services/donation_notifications.rs @@ -21,24 +21,19 @@ pub async fn send_donation_notification( .is_some() { return Ok(()); - } else if !is_need_donate_notifications(message.chat().id, message.chat().is_private()).await? { - CHAT_DONATION_NOTIFICATIONS_CACHE - .insert(message.chat().id, ()) - .await; - return Ok(()); } CHAT_DONATION_NOTIFICATIONS_CACHE .insert(message.chat().id, ()) .await; - mark_donate_notification_sent(message.chat().id).await?; - match message { - MaybeInaccessibleMessage::Regular(message) => { + if is_need_donate_notifications(message.chat().id, message.chat().is_private()).await? { + mark_donate_notification_sent(message.chat().id).await?; + + if let MaybeInaccessibleMessage::Regular(message) = message { support_command_handler(*message, bot).await?; } - MaybeInaccessibleMessage::Inaccessible(_) => {} - } + }; Ok(()) }