diff --git a/crates/xmedia-bot/src/send.rs b/crates/xmedia-bot/src/send.rs index 9a1d7da..7720bfd 100644 --- a/crates/xmedia-bot/src/send.rs +++ b/crates/xmedia-bot/src/send.rs @@ -1321,18 +1321,6 @@ pub async fn handle_task(payload: serde_json::Value) -> Result<(), QueueError> { } }; let bot = BOT.clone(); - // A resumed multi-batch send already ran post_send_actions (edit prompt / - // forward) when it first started; running them again on the resume would - // open a duplicate edit prompt and double-forward. SendAnimation is - // atomic (always a fresh run), so only SendMediaSequence can resume. - let resumed = matches!( - &task, - Task::SendMediaSequence { - batch_index, - sent_message_ids, - .. - } if *batch_index > 0 || !sent_message_ids.is_empty() - ); match task { Task::SendMediaSequence { .. } | Task::SendAnimation { .. } => { let message_ids = match send_media_or_animation(&bot, &task).await { @@ -1356,9 +1344,14 @@ pub async fn handle_task(payload: serde_json::Value) -> Result<(), QueueError> { }); } }; - if !resumed { - post_send_actions(&bot, &task, message_ids).await; - } + // A task only reaches the queue after a failed send, so this + // successful run is the first time post_send_actions can fire — + // the fresh attempt failed before it ever got here. Run it + // unconditionally: `post_send_actions` executes once, after the + // whole sequence (every batch) completed, so the channel forward + // and the edit-before-forward prompt must not be lost just + // because the send needed a retry. + post_send_actions(&bot, &task, message_ids).await; release_keep_alive(&task); Ok(()) }