User-account-level Telegram management via Python + Telethon. Drop-in replacement for the Go-based tgctl with the same CLI interface.
bash <skill-dir>/scripts/install.sh
This installs telethon via pip and copies tgctl-telethon to ~/.local/bin/.
Ask the user to go to https://my.telegram.org → API Development → get api_id and api_hash.
TELEGRAM_API_ID=${ID} TELEGRAM_API_HASH=${HASH} tgctl-telethon login
User enters phone number, auth code (digits only, no spaces), and optional 2FA password interactively.
Important: Auth codes must NOT be sent via Telegram (will be invalidated).
### tgctl-telethon (Telegram CLI)
- Binary: ~/.local/bin/tgctl-telethon
- Env: TELEGRAM_API_ID=${ID} TELEGRAM_API_HASH=${HASH}
- Session: ~/.tgctl-telethon/
telethon pip packageTELEGRAM_API_ID and TELEGRAM_API_HASH env vars~/.tgctl-telethon// TELEGRAM_API_ID=${ID} TELEGRAM_API_HASH=${HASH} tgctl-telethon [--profile <name>] <command>
| Command | Description |
|---|---|
| --------- | ------------- |
send | Send message |
forward | Forward a message |
edit | Edit a message |
delete | Delete a message |
pin | Pin a message |
unpin | Unpin message (or all) |
read | Mark chat as read |
sendfile | Send file or image |
download | Download media |
callback | Click inline button |
typing | Send typing status |
| Command | Description |
|---|---|
| --------- | ------------- |
chats [limit] | List chats |
history | Chat history |
search | Search chats and users |
search-msg | Search messages in chat |
contacts | List contacts |
members | List group/channel members |
chatinfo | Get chat/user details |
resolve | Resolve username to ID |
resolvephone | Resolve phone to user |
| Command | Description |
|---|---|
| --------- | ------------- |
creategroup | Create a group |
createchannel | Create a channel |
join | Join group/channel |
leave | Leave group/channel |
kick | Kick user |
invite | Invite user |
editadmin | Set/remove admin |
startbot | Start bot in chat |
| Command | Description | |
|---|---|---|
| --------- | ------------- | |
login | Login (phone + code + optional 2FA) | |
me | Current user info | |
updateprofile [--first n] [--last n] [--about t] | Update profile | |
`setstatus | offline>` | Set online status | |
block | Block user | |
unblock | Unblock user | |
listen [--user id] [--chat id] | Listen for messages | |
logout | Logout |
tgctl-telethon --profile work login
tgctl-telethon --profile work me
Sessions stored in ~/.tgctl-telethon/.
8568316820)-3842028710)@BotFather)~/.tgctl-telethon/, never transmitted共 1 个版本