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

import asyncio
from goygram import GoyGram

app = GoyGram()  # auto-fetches Telegram DC endpoint at startup

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

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 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.3.7.tar.gz (23.2 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.3.7-cp311-abi3-win_amd64.whl (159.3 kB view details)

Uploaded CPython 3.11+Windows x86-64

goygram-0.3.7-cp311-abi3-manylinux_2_34_x86_64.whl (243.5 kB view details)

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

goygram-0.3.7-cp311-abi3-macosx_11_0_arm64.whl (226.0 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for goygram-0.3.7.tar.gz
Algorithm Hash digest
SHA256 3d1dd093660ec9d06cbd35e691819f415cfea968533cbdc8386022b0fe775173
MD5 00a9dd179f77f5cc0b60ad8119e436db
BLAKE2b-256 e1e7a839ed086bfb5c7e6b069ff31f8bdaafc2027569674537df1cf19c805509

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goygram-0.3.7-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 159.3 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.3.7-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b5d823ef2198e67860616f97a741ca5774841e8bbe45b1d47d2a38c963edefb2
MD5 8cf3742f6bc9f94b364e1ab18e67fbd5
BLAKE2b-256 6f4266fc2e06b120d65aef98c3a1aafc412e569480de0d92af51091178b5eab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.7-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 968a39deff84a4ae400184e1523aa9e827953b1646c2e7ac600460e6adc1c056
MD5 f76c75ff69405940e4b5ae94a719bc7b
BLAKE2b-256 dc9fb38f04c51191f974fcecbe7035b0daa076f408cf964b19cd886dc635cb82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.7-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22d34951bc577ab0638c8043774233ec925dc03ae83d4f88d0f7950d10a8796b
MD5 89df4326551e171f64151b0c75f65b3d
BLAKE2b-256 645d6ec9809bdd3a78dbdc54263b21c0b30913fff710699d3964eff9a141ef6c

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