Skip to main content

Goygram: unified Telegram runtime on Python and Rust

Project description

GoyGram

GoyGram Logo

Python 3.14+ Rust Core License: AGPL v3 Telegram API Security Docs & Wiki

What is this?

Ultimate split-brain Telegram framework (Python + Rust core) built for production-grade speed, control, and maximum OpSec.

Key Features

  • Split-brain architecture: ergonomic Python layer + blazing-fast Rust extension.
  • Session Eater: aggressive in-memory cleanup (zeroize strategy).
  • Vault AES-GCM: encrypted local session bootstrap.
  • TUI auth flow: terminal-first authorization workflow.
  • Proxy support: route traffic through your required network topology.
  • Dual transport: Bot API + MTProto (with API ID/API Hash) in one app runtime.
  • Dynamic DC Routing: MTProto nodes are fetched at startup from Telegram public config (no baked-in DC IP list).

Installation

pip install goygram

Quick Start

1) Bot API (token)

import asyncio
from goygram import GoyGram, filters

app = GoyGram(bot_token="123456:ABC_TOKEN")

@app.on_msg(filt=filters.text)
async def echo(msg):
    await msg.reply("Hello from Bot API")

asyncio.run(app.run())

2) MTProto (no bot token, requires API ID + API Hash)

import asyncio
from goygram import GoyGram

app = GoyGram(api_id=123456, api_hash="0123456789abcdef0123456789abcdef")  # auto-fetches Telegram DC endpoint at startup

@app.on_cmd("ping")
async def ping(msg):
    await msg.reply("pong from MTProto (api_id/api_hash)")

asyncio.run(app.run())

3) Named MTProto sessions (multi-session in one folder)

import asyncio
from goygram import GoyGram

app = GoyGram(
    api_id=123456,
    api_hash="0123456789abcdef0123456789abcdef",
    session_name="farm_worker_1",
)

asyncio.run(app.run())
  • By default, session data is stored in default.vault.
  • With session_name="farm_worker_1", session data is stored in farm_worker_1.vault.
  • If farm_worker_1.session exists, it is migrated to farm_worker_1.vault during bootstrap.

Dynamic API & Methods

GoyGram now supports all Telegram methods out of the box with dynamic dispatch:

  • Call Bot API methods directly even if they are not explicitly hardcoded:
    • await app.sendDocument(chat_id=..., document=...)
    • await app.getChat(chat_id=...)
    • await app.getUpdates(timeout=30)
  • Snake-case also works and is converted to Bot API method names:
    • await app.send_document(chat_id=..., document=...) -> sendDocument
  • MTProto actions (authorized with API ID/API Hash) are available with mt_ prefix:
    • await app.mt_get_dialogs(limit=50)
    • await app.mt_get_chat_full(chat_id=...)

This behavior is implemented through dynamic method resolution in the client core (__getattr__) and transport-aware request routing.

Developer Tools (Help)

Use built-in introspection tools:

app.help()            # pretty DX overview in console
print(dir(app))       # inspect available shortcuts + dynamic entries

or:

from goygram.utils import print_methods
print_methods(app)

With type hints on key event objects (MsgObj, CbObj, MemberObj, PollObj) and filter primitives, modern IDE autocomplete works much better out of the box.

Filters

goygram.filters supports composable boolean operators:

from goygram import filters

smart_filter = filters.text & ~filters.me
another = filters.text | filters.me

@app.on_msg(filt=smart_filter)
async def handler(msg):
    await msg.reply("Filtered")

Wiki

📚 Looking for guides, API references, or multi-session farming? > 👉 Check out the Official GoyGram Wiki!

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goygram-0.5.5.tar.gz (49.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

goygram-0.5.5-cp311-abi3-win_amd64.whl (196.7 kB view details)

Uploaded CPython 3.11+Windows x86-64

goygram-0.5.5-cp311-abi3-manylinux_2_34_x86_64.whl (280.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

goygram-0.5.5-cp311-abi3-macosx_11_0_arm64.whl (258.6 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file goygram-0.5.5.tar.gz.

File metadata

  • Download URL: goygram-0.5.5.tar.gz
  • Upload date:
  • Size: 49.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for goygram-0.5.5.tar.gz
Algorithm Hash digest
SHA256 27d09859564c39e2bcf99585b003c1414934b9065e2d8a78655a767493159663
MD5 b6474bf97e6d4bac5cc2742efeb6f07f
BLAKE2b-256 6a72d16563f8a23b967fc4c1e95fc7c3f344585e56ace11760224075806a2590

See more details on using hashes here.

File details

Details for the file goygram-0.5.5-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: goygram-0.5.5-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 196.7 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for goygram-0.5.5-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7d0fa3c99298648e96e242a2fdaf31051f34b5a7741393d461eabfba2b764ffb
MD5 5b4a6c72f0e33129f4ae36114d6efb11
BLAKE2b-256 7d880fd8a36d40c5ebac966b41d88a39952cd3e629b119ad0b6994702ba99eed

See more details on using hashes here.

File details

Details for the file goygram-0.5.5-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for goygram-0.5.5-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 404afe4e5fd825e3920d2275ab6758d451b4f90ad7ae4208d255137c375ffcc9
MD5 9941ce27454440906d626b47695d5adf
BLAKE2b-256 8d283f7998ca550aab1bd165818d37d9242c8630e1ee997ac97a8b0a059ccc0c

See more details on using hashes here.

File details

Details for the file goygram-0.5.5-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for goygram-0.5.5-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 daa211f9fd3d21443f68023204378f6c0d9f9665f7589f6ac6db4a2292f1f654
MD5 c664bf14abac972c4e0b475d5aa63046
BLAKE2b-256 e4b36312101c9a8329a45c1cd9c80c26b33a4244c515483a09aa9a4a0322c99e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page