Telegram Cloud Storage
Scanned@oki3505F
npx machina-cli add skill @oki3505F/telegram-cloud-storage --openclawTelegram Cloud Storage (Teldrive Edition)
This skill runs Teldrive, a powerful utility that organizes Telegram files and provides a high-speed API/UI for accessing them.
Features
- Unlimited Storage: Uses Telegram as a backend.
- High Performance: Written in Go, optimized for speed.
- UI & API: Includes a web interface and REST API.
- AI-Native Client: Includes
client.pyfor agent-based file operations.
Credits
This skill is a wrapper for Teldrive by divyam234. All credit for the core engine goes to the original authors.
Requirements
- PostgreSQL Database: Version 17+ recommended.
- pgroonga Extension: Required for file search within Postgres.
- Telegram API: App ID and Hash from my.telegram.org.
Installation
1. Database Setup
Ensure Postgres is running and the pgroonga extension is installed.
CREATE DATABASE teldrive;
\c teldrive
CREATE EXTENSION IF NOT EXISTS pgroonga;
2. Configure
Run the setup script to generate config/config.toml:
./scripts/setup.sh
3. Start Server
./scripts/manage.sh start
Agent Usage
The skill includes a Python client for programmatic access.
Environment Variables
TELDRIVE_TOKEN: Your JWT token (get this from the UI orconfig/token.txtafter login).TELDRIVE_SESSION_HASH: Your Telegram session hash (found in theteldrive.sessionstable).
Commands
# List files
python3 scripts/client.py list /
# Upload a file
python3 scripts/client.py upload local_file.txt /remote/path
# Download a file
python3 scripts/client.py download <file_id> local_save_path
Directory Structure
bin/: Teldrive binary.config/: Configuration templates and generated config.scripts/: Setup, management, and client scripts.logs/: Application logs.
Overview
Telegram Cloud Storage uses Teldrive to turn Telegram into an unlimited cloud drive with a fast Go backend. It ships with a web UI and REST API, plus an AI-native client (client.py) for agent-based file operations. The stack relies on PostgreSQL and the pgroonga extension for storage and fast search.
How This Skill Works
It runs the Teldrive engine and exposes a local API/UI for file access. Metadata and search are backed by PostgreSQL with pgroonga for fast, in-database search. An AI-native client (client.py) enables programmatic file operations from agents.
When to Use It
- You want to convert Telegram into a persistent cloud drive with a fast API/UI.
- You need programmatic file operations through an AI agent via client.py.
- You require fast in-database search using PostgreSQL and pgroonga.
- You want a self-contained setup with a local config and zero reliance on external storage besides Telegram.
- You need a local server that authenticates via TELDRIVE_TOKEN and TELDRIVE_SESSION_HASH and exposes a REST API.
Quick Start
- Step 1: Download the Teldrive binary using the provided script and ensure prerequisites are met.
- Step 2: Run the setup to generate config/config.toml and initialize the database.
- Step 3: Start the server with the management script and use the Python client to manage files.
Best Practices
- Use PostgreSQL 17+ and enable the pgroonga extension for search.
- Keep TELDRIVE_TOKEN and TELDRIVE_SESSION_HASH secure and rotate tokens regularly.
- Run ./scripts/setup.sh to generate config/config.toml before starting the server.
- Start the server with ./scripts/manage.sh start in a controlled environment.
- Test file operations with the Python client (client.py) before enabling automation.
Example Use Cases
- Backup team documents to Telegram cloud drive and access them via the REST API.
- Build an AI agent that uploads and retrieves files using the AI-native client (client.py).
- Index large datasets with pgroonga-backed search inside PostgreSQL for fast queries.
- Provide a web UI for non-technical users to browse files stored in Telegram.
- Develop automated pipelines that synchronize local files to the Telegram cloud drive.