mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-07 01:32:13 +00:00
feat(inline): answer from the link cache, and put the answer on the trait
Inline results were URL-only: Telegram fetches an inline result's URL itself and cannot send site headers, so every pixiv item (and every locally encoded ugoira/bsky MP4) was skipped and such a query answered empty. A post that is already in the link cache now answers with InlineQueryResultCached* built from its Telegram file ids — no fetch, no upload, and the hotlink-protected case simply works. A degraded entry (file ids gone) falls back to URLs, and there a video with no poster is skipped (Telegram would try to render the mp4 as its own thumbnail). The answer call moves onto MediaSender (answer_inline_query, mirroring the other user-flow methods), which is what makes the path testable at all: the two new tests drive the cache answer and the degraded/empty answer through TestStores + MockSender, which recorded nothing about inline before. The result builders are shared by both paths now (url_result/cached_result + inline_kind), so the fetch path's behaviour is unchanged.
This commit is contained in:
@@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum CachedMediaKind {
|
||||
Photo,
|
||||
|
||||
Reference in New Issue
Block a user