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: implement telegram_list_media command for retrieving media items

Tonhoee2dc2e6daba
diff --git a/src-tauri/src/commands/telegram.rs b/src-tauri/src/commands/telegram.rs
index a315d70e..8b551fcb 100644
--- a/src-tauri/src/commands/telegram.rs
+++ b/src-tauri/src/commands/telegram.rs
@@ -1,4 +1,4 @@
-use crate::platforms::telegram::api::{self, TelegramChat};
+use crate::platforms::telegram::api::{self, TelegramChat, TelegramMediaItem};
use crate::platforms::telegram::auth::{self, VerifyError};
use crate::AppState;
@@ -64,3 +64,24 @@ pub async fn telegram_list_chats(
.await
.map_err(|e| e.to_string())
}
+
+#[tauri::command]
+pub async fn telegram_list_media(
+ state: tauri::State<'_, AppState>,
+ chat_id: i64,
+ chat_type: String,
+ media_type: Option<String>,
+ offset: i32,
+ limit: u32,
+) -> Result<Vec<TelegramMediaItem>, String> {
+ api::list_media(
+ &state.telegram_session,
+ chat_id,
+ &chat_type,
+ media_type.as_deref(),
+ offset,
+ limit,
+ )
+ .await
+ .map_err(|e| e.to_string())
+}