Most examples use environment variable client builders.
You can do it manually, see bot-auth-manual for example.
- Obtain api_id and api_hash for your application and set as
APP_ID,APP_HASH - Set
SESSION_FILEto something like~/session.yourbot.jsonfor persistent auth - Run example.
Please don't share APP_ID or APP_HASH, it can't be easily rotated.
| Name | Description | Features |
|---|---|---|
| userbot | Userbot example with peer storage and flood wait middelware | Custom auth flow, session.Storage, PeerStorage, ResolverCache |
| bot-auth-manual | Bot authentication | session.Storage, setup without environment variables |
| bot-echo | Echo bot | UpdateDispatcher, message sender |
| bot-upload | One-shot uploader for bot | NoUpdates flag, uploads with MIME, custom file name and as audio, resolving peer by username, HTML message |
| gif-download | Saved gif backup (and restore) for user | Download, upload, middlewares with rate limit, unpack |
| bg-run | Using client without Run | contrib/bg package |
| pretty-print | Pretty-print requests, responses and updates | The tgp package, middleware and custom UpdateHandler for all updates |
| updates | Updates engine example | The updates package that recovers missed updates |
| Name | Description |
|---|---|
BOT_TOKEN |
Token from BotFather |
APP_ID |
api_id of Telegram app from my.telegram.org |
APP_HASH |
api_hash of Telegram app from my.telegram.org |
SESSION_FILE |
Path to session file, like /home/super-bot/.gotd/session.super-bot.json |
SESSION_DIR |
Path to session directory, if SESSION_FILE is not set, like /home/super-bot/.gotd |
Still don't know how to use specific features? See user support.