π TokenFarm is a Python automation tool designed to streamline the process of claiming tokens for multiple web accounts. It leverages Selenium with undetected ChromeDriver to interact with a web interface, automatically logging into each account profile and claiming available tokens. The bot also provides Telegram notifications summarizing the results of each run.
This project is for educational purposes only. Automated interaction with web services may violate Terms of Service. Use responsibly and in accordance with the terms of service of any platforms you automate.
- Automated Token Claiming: Iterates through all account profiles and claims tokens if available.
- Headless Operation: Runs Chrome in headless mode for seamless background execution.
- Telegram Notifications: Sends a summary report to a specified Telegram chat after each run.
- Error Screenshots: Automatically captures a screenshot on failure, saves it locally for records, and attaches it directly to the Telegram error notification for instant troubleshooting.
- Configurable via
.env: All sensitive and environment-specific settings are managed via a.envfile. - Cron-Ready: Example cron jobs provided for scheduled and reboot-based execution.
- Python 3.8+
- Google Chrome (compatible with undetected-chromedriver)
- The following Python packages (see
requirements.txt):- selenium
- undetected-chromedriver
- python-dotenv
- requests
- (and others listed in
requirements.txt)
TokenFarm/
βββ assets/
βββ .env
βββ .gitignore
βββ bot.py
βββ launcher.py
βββ LICENSE
βββ log.txt
βββ readme.md
βββ requirements.txt
assets/β Folder containing static resource.envβ Environment variables (not committed; create your own using.env.example).gitignoreβ Git ignored files and foldersbot.pyβ Main automation scriptlauncher.pyβ Interactive script to launch all account profiles in visible windows for manual verification or loginLICENSEβ Project license (MIT)log.txtβ Log output (created at runtime)readme.mdβ Project documentation (this file)requirements.txtβ Python dependencies
After each run, the bot sends a summary notification to your specified Telegram chat. This message contains the number of accounts processed, total duration, and the result for each account.
The notification covers the following possible outcomes for each account:
- Success: Tokens were successfully claimed.
- Logged Out: The account was not logged in and was skipped.
- Already Claimed: The tokens have already been claimed for a specific account for that day.
- Button Not Found: The claim button was not found (the site layout may have changed).
- Site Unreachable: The website could not be reached (network error, downtime, or invalid URL).
- Other Errors: Any other unexpected issue occurred during the process.
Sample Notification:
- The message uses Markdown formatting for clarity.
- You will receive this notification in your Telegram app or group as configured in your
.envfile.
π Sample Log (log.txt)
This log file is automatically generated by the bot each time it runs (including when triggered by the cron job commands above). It records the progress and results of each token claim session.
π Found 3 accounts in the vault: ['acc1', 'acc2', 'acc3']
π STARTING THE TOKEN FARM...
π Starting harvest for: acc1
β
Tokens claimed for acc1!
--- π€ Resting for 15s to stay under the radar ---
π Starting harvest for: acc2
β
Tokens claimed for acc2!
--- π€ Resting for 15s to stay under the radar ---
π Starting harvest for: acc3
β
Tokens claimed for acc3!
--- π€ Resting for 15s to stay under the radar ---
==============================
π DAILY HARVEST REPORT
==============================
acc1: Success
acc2: Success
acc3: Success
==============================
π― FARMING COMPLETE. TOTAL ACCOUNTS PROCESSED: 3
git clone https://github.com/Tanzeebul-Tamim/TokenFarm-Automation
cd TokenFarm-AutomationIt is recommended to use a Python virtual environment to keep dependencies isolated.
python3 -m venv venv
source venv/bin/activate- On Windows, use
venv\Scripts\activateinstead ofsource venv/bin/activate.
pip install -r requirements.txtRename the .env.example file in the project root to .env. All the following values can be found in the .env.example file:
BASE_PATH: Path to your Chrome profiles (e.g.,~/.Profiles/)SS_PATH: Path where the screenshots are saved before uploading them to Telegram (e.g.,~/screenshots/)CLAIM_URL: The URL of the web application you're using to claim tokens fromBOT_FATHER_TOKEN: Telegram bot token for sending notificationsUSER_INFO_BOT_ID: Telegram chat/user ID to receive notifications
To automate multiple accounts, you need a separate Chrome profile directory for each account. You can create a new Chrome profile using the following command:
google-chrome --user-data-dir="<BASE_PATH>/<ProfileName>"- Replace
<BASE_PATH>with your chosen directory (e.g.,~/.TokenFarmProfiles/). - Replace
<ProfileName>with a unique name for each account (e.g.,Acc1,Acc2, etc.). - This will open a new Chrome window. Log in to your account and close the window when done. Repeat for each account.
For example
google-chrome --user-data-dir="/home/$(whoami)/.TokenFarmProfiles/Acc1"- Open Telegram and search for BotFather.
- Start a chat and use
/newbotto create a new bot. Follow the instructions to get your bot token (BOT_FATHER_TOKEN). - Start a chat with your bot to activate it.
- To get your chat/user ID (
USER_INFO_BOT_ID):- Search for userinfobot in Telegram and start it. It will display your user ID.
- Alternatively, add your bot to a group and use the Telegram API to get the group chat ID.
python bot.py8. Manual Management (launcher.py)
If you need to manually log in, check a specific account, or bypass a CAPTCHA that the bot cannot handle, use the launcher:
python launcher.pyWhat it does: It opens all Chrome profiles simultaneously in visible windows. Tiled View: Windows are automatically resized and randomized on your screen so they don't stack on top of each other. Persistence: The windows will stay open until you press Ctrl+C in the terminal or close them manually.
You can automate the bot using cron jobs for scheduled or startup execution. If you do not have cron installed, you can install it or use an alternative task scheduler for your operating system.
Note: Most Linux distributions include
cronby default. If you are on macOS,cronis also available. On Windows, you can use Task Scheduler or install a cron-like tool such as cronw or use WSL to access Linux tools.
crontab -l- If you see a list of jobs or a message like "no crontab for ...", cron is available.
- If you get a "command not found" error, you may need to install it:
- Debian/Ubuntu:
sudo apt install cron - Fedora:
sudo dnf install cronie - Arch:
sudo pacman -S cronie
- Debian/Ubuntu:
-
Scheduled Run at a Specific Time (e.g., 11:55 AM daily):
55 11 * * * DISPLAY=:0 /path/to/venv/bin/python3 /path/to/bot.py >> /path/to/log.txt 2>&1
55 11 * * *means run at 11:55 AM every day.DISPLAY=:0allows Chrome to run in a graphical environment (required for non-headless mode or when testing visually). For seamless background execution (no popups), you can removeDISPLAY=:0and ensure headless mode is enabled in your script.- Adjust
/path/to/venv/bin/python3and/path/to/bot.pyto your actual Python and script paths. - Output and errors are appended to
log.txt.
-
Run at System Reboot:
@reboot sleep 60 && /path/to/venv/bin/python3 /path/to/bot.py >> /path/to/log.txt 2>&1
@rebootruns the command at every system startup.sleep 60before starting, waits 60 seconds after a reboot to ensure that all system services and dependencies have fully started.
- For testing visually (seeing browser windows), make sure to:
- Add or keep
DISPLAY=:0in your cron or shell command (if running in a desktop environment). - Comment out the headless mode line in your
bot.pyscript:# options.add_argument("--headless")
- Add or keep
- For background/production runs (no popups):
- Remove
DISPLAY=:0from your command. - Ensure the headless mode line is uncommented in your
bot.pyscript:options.add_argument("--headless")
- Remove
- Open your crontab editor:
crontab -e
- Add the desired cron job lines as shown above.
- Save and exit. Your jobs will now run automatically as scheduled.
You can create shell aliases to quickly activate your environment and run your scripts with a single command. This is useful for convenience and reduces typing errors.
Add the following lines to your ~/.bashrc, ~/.zshrc, or shell profile:
# Run the automated harvester
alias harvest='source /path/to/venv/bin/activate && python3 /path/to/bot.py'
# Run the manual profile launcher
alias manage='source /path/to/venv/bin/activate && python3 /path/to/launcher.py'harvest: Runs the bot, which automatically iterates through all accounts to claim tokens in the background.manage: Opens all browser profiles in visible windows for manual login or verification.- Setup: Replace
/path/to/with your actual project and virtual environment paths. - Activation: After saving, reload your config (e.g.,
source ~/.bashrc) or restart your terminal.
Now, simply type harvest to start the bot or manage to open your browser windows!
- Never share your
.envfile or Telegram bot token publicly. - Ensure your Chrome profiles and credentials are stored securely.
This project is licensed under the MIT License - see the LICENSE file for details.