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.8.tar.gz (23.9 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.8-cp311-abi3-win_amd64.whl (160.1 kB view details)

Uploaded CPython 3.11+Windows x86-64

goygram-0.3.8-cp311-abi3-manylinux_2_34_x86_64.whl (244.2 kB view details)

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

goygram-0.3.8-cp311-abi3-macosx_11_0_arm64.whl (226.7 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for goygram-0.3.8.tar.gz
Algorithm Hash digest
SHA256 86b93f47fe1d601c6cab0118783231eff9a8947639b20c04c929d878edd46807
MD5 d642124e7a093c9f1d88eb7d68f2d0ae
BLAKE2b-256 a749e692ec268d001a237a0a5d81dc23810d84794dafccecc281c597faf1d2f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goygram-0.3.8-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 160.1 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.8-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4fa2331144b08cbf52c11e550f6d0b620cda11c9a2d776917642fe006270840f
MD5 fb62088ee6b93b6aca593b651998bf6b
BLAKE2b-256 1887c949cd9871d95bb6e7b5671c579b9ef26e04d884b00c6e9f2ea40a97cd39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.8-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1f04d1027c0f5741184ed9e190855acfb8ae1b23bafde4aec25bb1e576e21f4c
MD5 4ef10cc0fa1c00166162a0b9f397328f
BLAKE2b-256 6e97a8de355602113362078b734f032dc5eeb5644b50ee99066a4f52be28c417

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goygram-0.3.8-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9417152b02cb5c7fd06fe300016f6fb08b26fd2f6cea8f7d58ead3f95fb8e4b0
MD5 ae6cf2a091109f0d12d92bed2cdeaeb3
BLAKE2b-256 5f2b88226a22035f89d17e7be3dc4b4ae2777ecb9e3a80f279500cc061e8c492

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