Skip to main content

Goygram: unified Telegram runtime on Python and Rust

Project description

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

GoyGram

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())

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")

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.4.0.tar.gz (25.5 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.4.0-cp311-abi3-win_amd64.whl (161.8 kB view details)

Uploaded CPython 3.11+Windows x86-64

goygram-0.4.0-cp311-abi3-manylinux_2_34_x86_64.whl (246.0 kB view details)

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

goygram-0.4.0-cp311-abi3-macosx_11_0_arm64.whl (228.4 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for goygram-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a5408ecdf78799829daa46e54a8317d1b257d66abb593e3614be586098d47300
MD5 2129ace54da2143445a90e03defc1909
BLAKE2b-256 5c82b35c30f5722ad0527639e4cfcd8e6f92b8fec8085fc9ec21dac1a8d71155

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goygram-0.4.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 161.8 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.4.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8e4ac0e3d8bf9f6e031c418e9033721d55af4a0190197ce82ee64901b797300c
MD5 78a40ad2591f580bd3fb786e8dd9ae34
BLAKE2b-256 930a986ed978fb778d1809b163769ade72c4278d4333bb28a122c26f0f5f7565

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.4.0-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5f2719afedff6c0495f8a908bb47699f1c70281ff700017b8de0905142e2a156
MD5 8817b1c224875aac1daf5e2e809f2899
BLAKE2b-256 e5db76a312c54a8ef0c6c4e1e68000a6b3edafb52f30b7aaff6b41910497db21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ed977b28edc7086f1b107309bfd1741e011f4094489a3f3cd206b5a8f3c4c0d
MD5 b52c24abb238858e2f77f65c07161cfb
BLAKE2b-256 382145aa354e9e5643a371586cae7cfb5d6543160d14ae6f3d57735dee0266f9

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