Chat Management
The chat command manages named identifiers for chats, groups, and channels — similar to
git remote. Instead of specifying a numeric ID like -1001234567890 every time, you save it
under a friendly name (an alias) and use that name in --to.
Identifiers are stored in the SQLite database ~/.config/tguser/tguser.db.
⚠️ Never delete this file. Deleting it wipes every saved chat name, and commands using
--to <name>stop working; Telegram does not store your local names, so the address book has to be rebuilt by hand. See 03. Configuration for details.
Subcommand Overview
| Command | Purpose |
|---|---|
tguser chat add <name> <chat_id> | Add an alias |
tguser chat list | Show all saved chats |
tguser chat get-id <name> | Print the ID by name |
tguser chat replace-id <name> <new_id> | Replace the ID |
tguser chat rename <old> <new> | Rename an alias |
tguser chat remove <name> | Remove an alias |
tguser chatwith no subcommand is equivalent totguser chat list.
Add a Chat
tguser chat add work -1001234567890╭────────────── ✓ Done ──────────────╮
│ Added chat work → -1001234567890 │
╰─────────────────────────────────────╯As chat_id you can store:
- a numeric ID (negative for groups/channels, e.g.
-1001234567890); - a
@username(e.g.@durov); me— Saved Messages.
Negative IDs are entered as-is — no escaping is needed.
Automatic resolution of @username and links
If you pass a @username or a link (t.me/…, invite link t.me/+…) with an active session,
tguser resolves the numeric ID and title for you and stores those:
tguser chat add news @somechannel
# Added chat news → -1001234567890 (Some Channel)To skip resolution and store the value as-is, add --no-resolve:
tguser chat add news @somechannel --no-resolveDon’t know the ID or
@username? See 08. Chat Discovery — thedialogsandresolvecommands help you find an ID, including for private chats.
List Chats
tguser chat list # or simply: tguser chat Saved chats
┏━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Name ┃ Chat ID ┃ Title ┃ Created ┃
┡━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ work │ -1001234567890 │ — │ 2026-06-30 11:20 │
└──────┴────────────────┴────────┴──────────────────┘Get an ID by Name
tguser chat get-id work
# -1001234567890Handy for scripts: the command prints only the ID itself.
Replace an ID
tguser chat replace-id work -100999Rename
tguser chat rename work teamRemove
tguser chat remove teamNext
How to use saved names when sending is covered in 05. Sending Messages.