https://github.com/wdzeng/telegram-id-pretender
Peek at other's telegram username and take it over once available 👀👀
https://github.com/wdzeng/telegram-id-pretender
telegram
Last synced: 8 months ago
JSON representation
Peek at other's telegram username and take it over once available 👀👀
- Host: GitHub
- URL: https://github.com/wdzeng/telegram-id-pretender
- Owner: wdzeng
- License: mit
- Created: 2022-05-12T17:39:45.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T21:42:05.000Z (about 4 years ago)
- Last Synced: 2025-02-26T19:52:14.737Z (over 1 year ago)
- Topics: telegram
- Language: Python
- Homepage:
- Size: 282 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Telegram ID Pretender
[](https://github.com/wdzeng/telegram-id-pretender/releases/latest)
[](https://github.com/wdzeng/telegram-id-pretender)
[](https://hub.docker.com/repository/docker/hyperbola/telegram-id-pretender)

👀👀 Peek at other's Telegram username, taking it over once it is released. 👀👀
## Install
### Python
Python 3.7 or up is required.
The [telethon](https://docs.telethon.dev/en/stable/) library is used.
```bash
pip3 install telethon
```
### Docker
Use the image on [dockerhub](https://hub.docker.com/repository/docker/hyperbola/telegram-id-pretender).
```bash
docker pull hyperbola/telegram-id-pretender:1
```
#### Supported tags
- `1`, `1.0`, `1.0.1`
## Usage
A running is an attempt to take over the username; therefore the script should be used with cron.
Following command tries to update username to `fzhong`. You need an API key to use the script. You can generate one [here](https://my.telegram.org/apps).
```bash
# python
TG_API_ID= TG_API_HASH= python3 main.py fzhong
# docker
docker run [-it]\
-e TG_API_ID= \
-e TG_API_HASH=
hyperbola/telegram-id-pretender:1 fzhong
```
The script should ask your login.
> **Warning**
> You should answer your mobile phone number in international format. For Taiwanese, use `+8869xxxxxxxxx` instead of `09xxxxxxxx`.
## Automatic Login
The script asks your login interactively. To do automatic login, you can `-s ` to save and restore the login session.
```bash
# python
TG_API_ID= TG_API_HASH= python3 main.py -s /path/to/session/file fzhong
# docker
docker run [-it] \
-v /path/to/session:/session \
-e TG_API_ID= \
-e TG_API_HASH= \
hyperbola/telegram-id-pretender:1 -s /session fzhong
```
If session file is specified, the script tries to read session token from the file and uses it to login; otherwise if session file does not exist, or if session token is invalid, the script prompts your login and then saves the updated token to session file so that it can perform automatic login in the next run. Keep session file secret since it contains sensitive data.
If the script is not running interactively, the session file must be specified. Otherwise the script fails without asking your login.
Since telegram requires 2FA login and this action must be performed on the spot, there is no support automatic login by setting username and password.
## Options
- `--id` PATH: read telegram api id from this file
- `--hash` PATH: read telegram api hash from this file
- `-s`, `--session` PATH: read login token from this file
- `-v`, `--verbose`: verbosity level; should be `0`, `1` or `2`; default to `1`
- `-D`, `--no-prompt`: do not ask login even in interactive shell
Following environment variables make effects. Noted that these variables refer to value directly, but not path to the value.
- `TG_API_ID`: telegram api id; overrides `--id` option
- `TG_API_HASH`: telegram api hash; overrides `--hash` option
- `TG_SESSION`: login session; overrides `--session` option
## Verbosity
Verbosity can be set to either 0, 1, or 2 by `-v` flag. Control which message should be sent to your `Saved Messages` channel in your telegram account.
- `0`: do not send any message
- `1`: send critical messages only
- `2`: send all messages
## Exit Code
- `0`: successfully took the desired username
- `20`: desired username is occupied
- `21`: desired username is invalid
- `22`: desired username is already owned by you
- `30`: failed to login
- `87`: failed for flood
- `1`: failed for any other reason
## Sister Bots
- [Shopee Coins Bot](https://github.com/wdzeng/shopee-coins-bot/)
- [Pinkoi Coins Bot](https://github.com/wdzeng/pinkoi-coins-bot/)
- [PTT Login Bot](https://github.com/wdzeng/ptt-login-bot/)