Telethon Session Generator
name: telethon-session
by crazypeace · published 2026-03-22
$ claw add gh:crazypeace/crazypeace-telethon-session---
name: telethon-session
description: Generate Telethon .session files for user-account login to Telegram. Use when: (1) user wants to test a Telegram bot as a real user, (2) user needs to interact with Telegram via user identity, (3) creating a Telegram session for Telethon-based automation, (4) mentions telethon, telegram session, or user-account login. NOT for: bot-token-based bots (no session needed).
---
# Telethon Session Generator
Generate a `.session` file to authenticate a Telegram user account via Telethon.
Prerequisites
Quick Start
Run the bundled script in interactive (PTY) mode — Telegram will send a login code and optionally ask for 2FA:
python3 scripts/login.py --api-id YOUR_ID --api-hash YOUR_HASH --phone "+86..."The script prompts for:
1. **Login code** — from Telegram app or SMS
2. **2FA password** — only if enabled on the account
On success, `<session_name>.session` is created in the working directory.
Key Notes
```bash
python3 -m venv venv
source venv/bin/activate
pip install telethon
```
Using the Session File
from telethon import TelegramClient
client = TelegramClient('telegram_session', api_id, api_hash)
await client.start() # auto-loads session, no prompt neededMore tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...