https://github.com/sukiboo/tg_ids
Fetch Telegram IDs for group participants đŠī¸
https://github.com/sukiboo/tg_ids
telegram utils
Last synced: 13 days ago
JSON representation
Fetch Telegram IDs for group participants đŠī¸
- Host: GitHub
- URL: https://github.com/sukiboo/tg_ids
- Owner: sukiboo
- License: mit
- Created: 2026-05-31T12:34:52.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2026-05-31T13:05:37.000Z (29 days ago)
- Last Synced: 2026-05-31T15:06:23.775Z (29 days ago)
- Topics: telegram, utils
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Telegram CLI đŠī¸
A tiny CLI for your own Telegram account (logs in over MTProto, sees what your
app sees). It currently does two things:
- **Look up IDs** â chat & user IDs for your groups, channels, and DMs.
- **Download history** â export a chat's full message history (and media) to disk.
## Setup
1. Get `api_id` + `api_hash` at https://my.telegram.org â **API development tools**.
2. Install and configure:
```bash
python3 -m venv .venv
./.venv/bin/pip install -r requirements.txt
cp .env.example .env # paste api_id + api_hash
chmod +x tg
```
3. Log in once (needs a real terminal):
```bash
./tg whoami # prompts for phone + code (+ 2FA)
```
Cached in `tg.session` â a full-account credential, gitignored. Keep it private.
## Look up IDs
```bash
./tg whoami # your own account id
./tg list # every chat: id, type, @username, name
./tg list --type group supergroup # filter by type
./tg resolve @somebody # id/@username/title -> id + type + name
./tg members # list a group's members
```
IDs use the Bot API "marked" form: users positive, groups `-`,
supergroups/channels `-100`.
## Download history
```bash
./tg history # full history -> export//messages.jsonl
./tg history --media # also download photos/videos/docs
./tg history --limit 500 # only the most recent 500
```
One JSON object per message (id, date, sender_id, text, reply/forward/media
markers), sorted by id (chronological); media goes to `export//media/`.
Re-running is idempotent â it skips saved messages, appends new ones, resumes
interrupted runs, and waits out rate limits. `export/` is gitignored.
## Notes
- Member lists are complete for basic groups and supergroups you admin; otherwise
Telegram returns a partial list.
- `.env` and `tg.session` are secrets â never commit them.