Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: add function to retrieve chat photo by ID and type

Tonho1c6537257881
diff --git a/src-tauri/src/commands/telegram.rs b/src-tauri/src/commands/telegram.rs
index b25f88d6..12920251 100644
--- a/src-tauri/src/commands/telegram.rs
+++ b/src-tauri/src/commands/telegram.rs
@@ -573,6 +573,23 @@ pub async fn telegram_search_media(
.map_err(|e| e.to_string())
}
+#[tauri::command]
+pub async fn telegram_get_chat_photo(
+ state: tauri::State<'_, AppState>,
+ chat_id: i64,
+ chat_type: String,
+) -> Result<String, String> {
+ let data = thumbnail_cache::get_chat_photo(
+ &state.telegram_session,
+ chat_id,
+ &chat_type,
+ )
+ .await
+ .map_err(|e| e.to_string())?;
+
+ Ok(base64::engine::general_purpose::STANDARD.encode(&data))
+}
+
#[tauri::command]
pub async fn telegram_clear_thumbnail_cache() -> Result<(), String> {
thumbnail_cache::clear_cache().await;