From c58202e6839812044df5c9e279c986ec2f31ec0c Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Mon, 21 Sep 2026 17:40:43 +0800 Subject: [PATCH] refactor(send): call send_animation directly send_animation_inner only reshuffled its arguments into MediaSender's send_animation; both call sites (URL send and the reupload fallback) now call the sender themselves, which also drops the InputFile and MediaSender imports. --- crates/xmedia-bot/src/send/mod.rs | 60 +++++++++++-------------------- 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/crates/xmedia-bot/src/send/mod.rs b/crates/xmedia-bot/src/send/mod.rs index a0ce2da..79fbf44 100644 --- a/crates/xmedia-bot/src/send/mod.rs +++ b/crates/xmedia-bot/src/send/mod.rs @@ -14,14 +14,13 @@ mod upload; use crate::ctx::AppContext; use crate::handlers::log_key; use crate::link_cache::{CachedMedia, CachedMediaKind, CachedPost}; -use crate::media_sender::MediaSender; use input_media::{build_media_group, input_file_for, item_url}; use post_send::{cache_animation_send, cache_sent_task}; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::sync::LazyLock; use teloxide::prelude::*; -use teloxide::types::{ChatId, InputFile, InputMedia, MessageId}; +use teloxide::types::{ChatId, InputMedia, MessageId}; use teloxide::{ApiError, RequestError}; use upload::{FallbackError, PreparedItem, prepare_upload_item, send_batch_via_upload}; @@ -683,25 +682,6 @@ pub async fn send_media_sequence(ctx: &AppContext<'_>, task: &Task) -> Result Result { - sender - .send_animation( - ChatId(chat_id), - MessageId(reply_to as i32), - caption, - spoiler, - file, - ) - .await -} - /// Sends a lone animation (gif), URL first with the download fallback. pub async fn send_animation(ctx: &AppContext<'_>, task: &Task) -> Result, SendError> { let Task::SendAnimation { @@ -737,15 +717,16 @@ pub async fn send_animation(ctx: &AppContext<'_>, task: &Task) -> Result { let id = message.id.0 as i64; @@ -772,15 +753,16 @@ pub async fn send_animation(ctx: &AppContext<'_>, task: &Task) -> Result { let id = message.id.0 as i64;