A high-performance, asynchronous, 100% TOS-compliant Discord reaction mirroring bot built with Python 3.10+ and the official discord.py (v2.x) library.
AutoReactorPy automatically monitors predefined target Discord channels in a continuous round-robin sequence, scans channel message histories sequentially from oldest to newest, mirrors existing user reactions randomly, and persists progress state across server restarts using MongoDB (motor) or local progress.json. Designed to run flawlessly on both Android Termux and Ephemeral Cloud Hosting (Render / Railway).
+---------------------------------------+
| Discord API |
+-------------------+-------------------+
| (Bot Token Auth)
v
+------------------------+ +-----------+-----------+ +------------------------+
| aiohttp Web Server | <--> | AutoReactorPy Bot | <--> | JSON / MongoDB Atlas |
| (Cloud Health Checks) | | (discord.py v2.x) | | (Progress State Engine)|
+------------------------+ +-----------+-----------+ +------------------------+
|
v
+-------------------+-------------------+
| Round-Robin Channel Scanner Loop |
| - Channel 1 -> Channel 2 -> Ch 3 |
| - History: Oldest to Newest |
| - Reaction Mirroring Logic |
| - 300s Post-Reaction Cooldown |
+---------------------------------------+
- Multi-Channel Round-Robin: Continuously monitors target channel IDs in sequential rotation.
- Sequential History Scanning: Resumes scanning from the last processed
last_message_idstored inprogress.json/ MongoDB. - Smart Reaction Mirroring Rules:
- Skip zero reactions: Ignores messages with no existing reactions.
- Skip duplicate reactions: Ignores messages the bot has already reacted to.
- Mirror existing reactions: Randomly selects ONE existing reaction on eligible messages and duplicates it. Never adds unrepresented emojis.
- Strict Cooldown Enforcement: Enforces a strict 5-minute (300-second) cooldown ONLY after a successful reaction. Skipped messages proceed instantly.
- End-of-History Pointer Reset: Resets channel scan pointers to 0 when history end is reached, restarting from oldest messages.
- Persistent State Management: Uses local
progress.jsonand optional MongoDB Atlas (motor) to maintain progress state across restarts. - Cloud Health Check Web Server: Runs an async
aiohttpHTTP server onPORTfor uptime monitoring and health check pinging. - Error Handling & Rate Limit Mitigation: Handles rate limits (HTTP 429), permissions issues, and API exceptions gracefully without stopping background tasks.
Copy .env.example to .env and configure your credentials:
cp .env.example .env| Variable | Required | Description |
|---|---|---|
USER_TOKEN | Yes | Bot Token from Discord Developer Portal (or DISCORD_TOKEN). |
TARGET_CHANNELS | Yes | Comma-separated target Discord Channel IDs (e.g. 111111,222222,333333). |
PORT | No | Web server port for health checks (Default: 8080). |
MONGO_URI | No | Optional MongoDB connection string (leave blank to use progress.json). |
MONGO_DB_NAME | No | MongoDB Database Name (Default: autoreactor_db). |
COOLDOWN_SECONDS | No | Reaction cooldown interval in seconds (Default: 300). |
Follow these steps to run the bot 24/7 on an Android device using Termux:
Update packages and install dependencies:
pkg update && pkg upgrade -y pkg install python git -yClone the repository:
git clone https://github.com/gtajisan/AutoReactorPy.git cd AutoReactorPyCreate a virtual environment and install packages:
python -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install -r requirements.txtConfigure environment variables:
cp .env.example .env nano .env
- Start the bot:
python main.py
💡 Termux Tip: Acquire wake lock (
termux-wake-lock) to keep CPU active when the screen turns off.
Follow these steps to deploy on Render.com (Web Service):
- Fork or Push repository to GitHub.
- Create New Web Service on Render:
- Connect your GitHub repository.
- Environment:
Python 3 - Build Command:
pip install -r requirements.txt - Start Command:
python main.py
- Set Environment Variables in Render Dashboard:
- Add
USER_TOKEN(orDISCORD_TOKEN),TARGET_CHANNELS, andPORT(10000or8080).
- Add
- Health Check Path:
- Render automatically pings the root
/or/healthendpoint onPORT.
- Render automatically pings the root
- Deploy: Click Create Web Service. Render will build and launch
main.py.
- Never share your Bot Token or credentials: Keep your
.envfile secret and out of source control. - Bot Permissions: Grant your bot only necessary guild permissions:
Read Messages / View ChannelsRead Message HistoryAdd Reactions
- Use Bot Token: Operates strictly via Official Discord Bot API tokens to guarantee compliance with Discord Terms of Service. Never use user tokens.
Maintained and developed by Farhan Muh Tasim / gtajisan (https://github.com/gtajisan). Note: Hosted on secondary mirrors, but all core architecture is managed by gtajisan.
Distributed under the MIT License. See LICENSE for details.



