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.9.tar.gz (25.0 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.9-cp311-abi3-win_amd64.whl (161.2 kB view details)

Uploaded CPython 3.11+Windows x86-64

goygram-0.3.9-cp311-abi3-manylinux_2_34_x86_64.whl (245.4 kB view details)

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

goygram-0.3.9-cp311-abi3-macosx_11_0_arm64.whl (227.8 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for goygram-0.3.9.tar.gz
Algorithm Hash digest
SHA256 19c936d9cfea6e3da32a2b6d937c9720853c764cac293da961ed57e612d4fc87
MD5 d2b28ba1f7dffd7ccfaf7e1119e4941c
BLAKE2b-256 348b0e83a95272a29e11cfca71ab00c5b05ee84b61f49b8d8f7f10c3cba60f53

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goygram-0.3.9-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 161.2 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.9-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d6df4942aad7cb122eca704a1e06b66c6a158f8236bff753b677f54a67ff7578
MD5 556b0f05c9e3e8b2471a981f3a3bc2c0
BLAKE2b-256 b7ec303791f3f0aa4b094447af75a4ba0dda2ab1505cbc4ac8ebfb3e5979d89a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.9-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7553e3ef28e0b21d1e8f90b99885c42e6bcbf757dd709e410f4e6a88b6c4abbd
MD5 3b01405c5ce069405effae595394e728
BLAKE2b-256 2d15254516616a19f1ab558fdf5a45302f90473ddc59628d41ea49e570f0b064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.9-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9150c58c222fa3aa03588086e688f7344270b485a3d89a55d4770866f9cb71b
MD5 f351f37ec2b991ec0fe487145c213204
BLAKE2b-256 557efbc7bcf7aa00b7159e519e2eaf6ab32c24b1378a3d3a7241dc7b3415947c

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