Skip to main content
FTMGram Logo

FTMGram v3.5.1

Next-Gen Telegram MTProto & Bot API 10.3 Framework for Python

Docs PyPI Telegram License


FTMGram is a rock-solid, high-performance, asynchronous Telegram MTProto client library and Bot API framework for Python. It supercharges both user accounts and bots with modern features like Turbo Multi-Worker Transfers (Upload & Download), In-Message Buttons, AI Response Token Streaming, Bot Chat History Scanning, and Telegram Stars 2.0.


⚡ Key Highlights in v3.5.1

  • 🛡️ 100% Rock-Solid Stability: Zero file descriptor leaks on Linux / uvloop containers ([Errno 24] Too many open files completely eliminated).
  • ⚡ Turbo Multi-Worker Upload Engine (fast_upload): Upload videos, documents, and large files up to 2GB/4GB at maximum speed using concurrent multi-worker chunk streaming.
  • ⚡ Turbo Multi-Worker Download Engine (fast_download): Download media files concurrently with parallel chunk workers for gigabit saturation.
  • 🤖 Bot Chat History (get_bot_chat_history): Allows bots to retrieve message history across private chats and groups using safe, high-speed 100-ID batch scanning.
  • 🎨 Fluent RichMessageBuilder DSL: Construct structured rich messages with in-message buttons (<tg-button-row>), expandable quotes, tables, and paragraphs effortlessly in Python.
  • 🧠 Real-Time AI Streaming (stream_text & thinking): Seamlessly stream LLM tokens (OpenAI, Anthropic, Gemini, Groq, Ollama) directly to chat drafts with animated thinking placeholders and stop buttons.
  • 🧹 Batch Chat Purge (purge_messages): Safely delete hundreds of messages in seconds with automatic RPC chunking and rate-limit handling.
  • 💾 Memory Media Streaming (download_media_to_memory): Download media straight into an in-memory io.BytesIO buffer without disk I/O bottlenecks.
  • 👥 Multi-Client Orchestrator (MultiClient): Manage and run dozens of bots and user accounts concurrently in a single event loop.

📦 Installation

pip install -U ftmgram

Or install with fast cryptographic acceleration:

pip install -U "ftmgram[fast]"

🚀 Quick Examples

1. Fast Upload & Fast Download (Turbo Transfers)

from ftmgram import Client

app = Client("my_bot", bot_token="TOKEN")

async def upload_and_download():
    async with app:
        # Fast Upload with 8 parallel workers
        uploaded_file = await app.fast_upload("large_video.mp4", workers=8)
        msg = await app.send_video(123456789, video=uploaded_file, caption="Sent via Turbo Upload! 🚀")

        # Fast Download with 8 parallel workers
        await app.fast_download(msg, file_name="downloads/", workers=8)

app.run(upload_and_download())

2. In-Message Buttons (Bot API 10.3)

from ftmgram import Client
from ftmgram.helpers import RichMessageBuilder, Button

app = Client("my_bot", bot_token="TOKEN")

async def send_menu(chat_id: int):
    async with app:
        rich = (
            RichMessageBuilder()
            .title("💎 VIP Subscription")
            .paragraph("Select your desired membership tier:")
            .button_row(
                Button("Starter ($5)", data="plan_starter", style="primary"),
                Button("Pro ($15)", data="plan_pro", style="success"),
                Button("VIP ($25)", data="plan_vip", style="danger")
            )
            .build()
        )
        await app.send_rich_message(chat_id, rich)

app.run(send_menu(123456789))

3. Bot Chat History Retrieval

from ftmgram import Client

app = Client("my_bot", bot_token="TOKEN")

async def scan_history(chat_id: int):
    async with app:
        async for msg in app.get_bot_chat_history(chat_id, start_message_id=1, limit=50):
            print(f"[{msg.id}] {msg.text}")

app.run(scan_history(123456789))

📚 Documentation

Visit the official documentation portal: https://ftmgram.ftmbotzx.dev/


📜 License

FTMGram is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0). Copyright (C) 2024-present FTM DEVELOPERZ.

Release files for ftmgram 3.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftmgram 3.5.3
File Size Uploaded
ftmgram-3.5.3.tar.gz 14.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ftmgram 3.5.3
File Interpreter ABI Platform
ftmgram-3.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 MB

Release files / ftmgram-3.5.3.tar.gz

Download URL ftmgram-3.5.3.tar.gz
Size 14.3 MB
Tags Source
SHA-256 checksum
How to use checksums
1e782fd1b379b51fdec4ae2ec836574bf690f7fa950c3a969e144893815070b0
BLAKE2b-256 checksum
How to use checksums
5ddc650459316c78b0617aeb1e9cf24c4c0545272656938812305d80fe3a654b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ftmgram-3.5.3-py3-none-any.whl

Download URL ftmgram-3.5.3-py3-none-any.whl
Size 6.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b014cd217f35b8e6ec872fab853aa5aae8c51ea4e90c2f1a1917fe6cb786132f
BLAKE2b-256 checksum
How to use checksums
74830857b435b4ad16e5962be7fbb28b0f96d06076f2f7db86c7591bd50e726f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

3.5.8

2 release files

3.5.7

2 release files

3.5.6

2 release files

3.5.4

2 release files

This release

3.5.3 This release

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.3.0

2 release files

3.1.0

2 release files

3.0.25

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.17

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page