/telegram-reaction-bot

Bot for sending reactions to a Telegram post. With tdata support.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Bot for posting reactions to a Telegram post.

Telegram      Pyrogram

Automatically converts TDATA to Pyrogram session!

Automatically converts Telethon sessions to Pyrogram (may not be stable).

As long as the configuration file has the same name as the session file (see below). If you do not comply, it will not work at all πŸ™ƒ

This script sends reactions to a new post or message in selected open groups and channels, as well as automatically subscribes to them.

Launch Instructions

  1. Create an empty directory

  2. git clone https://github.com/kanewi11/telegram-reaction-bot.git ./

  3. python3 -m venv venv

  4. source venv/bin/activate

  5. pip install -r requirements.txt

  6. Add your channel name to config.py

  7. IF YOU PLAN TO USE THE TDATA CONVERTER go to the file converters/tdata_to_telethon.py and insert your API_HASH and API_ID (lines 19 and 20)

  8. mkdir sessions

  9. Sessions must be for pyrogram!

    Add the session file and its configuration file to the /sessions directory ( which we created in step 8 ).

    These two files must have the same name! Here is an example:

       your_dir
       └───reactionbot.py
       β”‚
       └───sessions
       β”‚   β”‚   8888888888.ini
       β”‚   β”‚   8888888888.session
       β”‚   β”‚   9999999999.ini
       β”‚   β”‚   9999999999.session
       β”‚   β”‚   98767242365.json
       β”‚   β”‚   98767242365.session
       β”‚   β”‚   ...
       β”‚
       └───tdatas
       β”‚   └───your_tdata
       β”‚   β”‚   β”‚ ...
       ...
    
  10. nohup python reactionbot.py &

Create a session file manually.

Create a file my_account.json ( the file name can be anything ) in the directory /sessions :

{
    "api_id": "your_api_id",
    "api_hash": "your_api_hash",
    "phone_number": "your_phone_number"
}

After $ python reactionbot.py, in the console go through the account authorization steps and that's it, the session file will be created, you don't need to do this for the next times.

Where do I get api_id and api_hash?

πŸ”— Click me.

Sample configuration file *.ini

You can add more parameters that pyrogram supports.

[pyrogram]
api_id = your_api_id
api_hash = your_api_hash	

# optional parameters
app_version = '8.8.5'
device_model = 'Vertu IVERTU'
system_version = 'Android'

Sample configuration file *.json

You can add more parameters that pyrogram supports.

{
    "api_id": "your_api_id",
    "api_hash": "your_api_hash",
    ...
}

TODO:

  • code refactoring 🫣