Script to generate dynamic Telegram nicknames
First of all you have to gain API_ID and API_HASH from Telegram, under API Development.
Create a environment file based on sample
$ cp .env.sample .envConfigure .env file by pasting API_ID and API_HASH.
# ---------------
# Telegram config
# ---------------
API_ID=PASTE_YOUR_APP_ID_HERE
API_HASH=PASTE_YOUR_APP_HASH_HEREAll nickname's configurations are stored in config.py.
# ---------------
# Nickname config
# ---------------
# Time interval in seconds between changing nicknames (default: 60)
change_interval = 60
# List of nicknames that will change, where 'emoji_symbol' (see below) is a random emoji
nicknames = [
'{emoji} H {emoji} E {emoji} Y {emoji}',
'{emoji} TEST {emoji}',
'{emoji} {emoji} {emoji}',
'{emoji} I love emojis {emoji}'
]
# Are emojis enabled (default: True)
emojis_enabled = True
# Emoji replacement symbol (default: '{emoji}')
emoji_symbol = '{emoji}'Make sure python poetry is installed on your machine.
To install dependencies:
$ poetry installTo launch the script:
$ poetry run python src/app.pyIt is important to ensure that the telegram-dynamic-nickname.session file is restricted from third parties. This file contains system data and anyone who has access to it will have access to your Telegram account.
It is important not to set a short interval between nickname changes for two reasons:
- Telegram API has its own limits on the number of requests per share of time
- Telegram will not be able to update the nickname on the client with the desired speed and the result will be invisible.
In order to achieve the result with the largest number of random emojis, it was decided to use the unicode.org resource in order to obtain the latest versions of emojis.
Python 3.8+.
Dependencies are defined in pyproject.toml and specific versions are locked
into poetry.lock. This allows for exact reproducible environments across
all machines that use the project, both during development and in production.
To install all dependencies into an isolated virtual environment:
Append
--syncto uninstall dependencies that are no longer in use from the virtual environment.
$ poetry installTo activate the virtual environment that is automatically created by Poetry:
$ poetry shellTo deactivate the environment:
(fact) $ exitTo upgrade all dependencies to their latest versions:
$ poetry updateLicensing for the project is defined in:
This project uses a common permissive license, the MIT license.
The proper shebang line for Python scripts is:
#!/usr/bin/env python3Ubuntu releases come with a default python3 executable. This is frozen for the life of the OS
and only receives security and bug fixes. To install a newer version of Python globally,
consider the deadsnakes PPA.
sudo add-apt-repository ppa:deadsnakes
sudo apt update
sudo apt install python3.10Made by Wedyarit