How do I type cast interface responses?
How do I type cast interface responses?
Many methods in Gogram return interface types that can have multiple implementations. You need to use type assertions or type switches to access the concrete type.
Example 1: AttachMenuBots
TheAttachMenuBots interface has two possible implementations:Example 2: MessagesMessages
TheMessagesMessages interface has four possible implementations:Why am I getting 'min constructor' errors?
Why am I getting 'min constructor' errors?
This happens when Telegram assumes you already have the access hash for a peer and sends incomplete data. Enable caching to prevent this:See the Cache documentation for more details.
What Go version is needed?
What Go version is needed?
Go 1.18 or higher is required for generics support.
Is the library stable and production ready?
Is the library stable and production ready?
YES - Gogram is stable and being used in production by many projects.
What are the resource requirements?
What are the resource requirements?
- Goroutines: ~10 - 12 goroutines
- Memory: 10-20 MB RAM usage
Where can I get help or support?
Where can I get help or support?
Join the Telegram Support Group for help, questions, and discussions.
What proxy types are supported?
What proxy types are supported?
Gogram supports the following proxy types:
- SOCKS5
- SOCKS4
- HTTP/HTTPS
- MTProto (FakeTLS, Obfuscated, Classic)
What platforms are supported?
What platforms are supported?
Gogram is tested and works on:
- Linux
- Windows
- macOS
- ARM (Raspberry Pi, etc.)
- WebAssembly (WASM) - Use WebSocket connections
How do I use multiple clients?
How do I use multiple clients?
To run multiple clients simultaneously, you must provide a unique This will create
SessionName for each client configuration. This ensures they don’t overwrite each other’s session files.bot_1.session and bot_2.session respectively.Im migrating from another library, what should I know?
Im migrating from another library, what should I know?
If you are coming from other MTProto libraries (like Telethon, Pyrogram, or GramJS), here are some key differences:
- Native Go Concurrency: Gogram uses Goroutines heavily. Handlers run concurrently by default (Group 0).
- Builder Pattern: We use builders for almost everything (Handlers, Keyboards, Inline Results) to provide type safety and discoverability.
- Strict Typing: Unlike dynamic languages (Python/JS), you must handle type assertions for interfaces (
switch v := media.(type)). - No
await: All API calls are synchronous-blocking (but efficient). Wrap them in goroutines if you need non-blocking behavior.