mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
feat: add Misskey (misskey.io) fetch support
Fourth site adapter: POST /api/notes/show, renote-aware caption and media normalization, DriveFile type → Illustration/Animated/Video. Empty thumbnailUrl strings filtered out in thumbnail_for.
This commit is contained in:
@@ -253,7 +253,7 @@ pub(crate) async fn execute_command(
|
||||
bot,
|
||||
message.chat.id.0,
|
||||
message.id,
|
||||
"Unknown site. Use twitter, bsky or pixiv.",
|
||||
"Unknown site. Use twitter, bsky, pixiv or misskey.",
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
@@ -294,7 +294,7 @@ pub(crate) async fn execute_command(
|
||||
bot,
|
||||
message.chat.id.0,
|
||||
message.id,
|
||||
"Unrecognized link. Use a twitter/x, pixiv or bsky post URL.",
|
||||
"Unrecognized link. Use a twitter/x, pixiv, bsky or misskey post URL.",
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
@@ -337,7 +337,7 @@ pub(crate) async fn execute_command(
|
||||
bot,
|
||||
message.chat.id.0,
|
||||
message.id,
|
||||
"No enabled site matches this link (twitter/x, pixiv or bsky).",
|
||||
"No enabled site matches this link (twitter/x, pixiv, bsky or misskey).",
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,12 @@ pub fn extract_urls(message: &Message) -> Vec<String> {
|
||||
fn thumbnail_for(media: &Media) -> Option<String> {
|
||||
let url = media.url();
|
||||
if url.starts_with("http://") || url.starts_with("https://") {
|
||||
media.thumbnail_url().map(str::to_string)
|
||||
// An empty thumbnail string (misskey video/gif files without a
|
||||
// thumbnailUrl) must not reach Telegram; let it generate its own.
|
||||
media
|
||||
.thumbnail_url()
|
||||
.map(str::to_string)
|
||||
.filter(|t| !t.is_empty())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user