This will allow you to automate the voting process for Discord bots on Top.gg.
With this, you can vote for any number of bots with any number of users.
From my experience other scripts using Puppeteer often fail to submit votes. In an effort to avoid seem as much like a real user as possible (therefore succeeding at voting more frequently), this project uses GhostCursor to emulate realistic mouse movement and a more elaborate Puppeteer setup that hooks into a Chromium instance post-launch. Furthermore, to allow this script to run on headless servers and to avoid getting detected as running headless Chromium but still get the same convenience as running headless, this project optionally utilizes Xvfb to emulate a virtual screen for Chromium to run in.
Linux is supported both natively and through Docker. For MacOS and Windows, you must use Docker. Details for running the system on each platform are below.
*Note*: Make sure you get an up-to-date installation of Node (18.0 or above). Older versions of Node will not work!
- Download the repository.
- Install the
jq
andxvfb
packages on your system. - Change to the source/ directory and run
make init
. - Edit
data/config.json
- Run
./run.sh
. After initial setup, this is the only step you need to do.
For all x86_64 operating systems, the following steps will work. If you are using an Arm processor (e.g. MacOS with Apple silicon chip), you need to use the instructions here You must have Docker installed. After installing Docker, do the following:
- Download the repository.
- Open the Docker desktop app. You can close it as soon as it finishes loading. This starts the background process (daemon) that's needed for the application.
- Edit
data/config.json
- Double click on
run_container.bat
. For MacOS, copy the command from the file and run it in your terminal. The default behavior of this solution will reopen the voter on system reboot (if Docker is set to automatically start). To change this, replace the--restart=unless-stopped
in the .bat file with--rm
.
- Download the repository.
- Open the Docker desktop app (Windows/Mac only). You can close it as soon as it finishes loading. This starts the background process (daemon) that's needed for the application.
- Edit
data/config.json
. *NOTE*: You will need to set the "chromiumInstallDirectory" to "/usr/bin/chromium". - From a terminal in the root of the repository, run the command
docker build -t botvoter-backend -f Dockerfile.arm64 .
- To run the solution, use the command:
docker run --cap-add=SYS_ADMIN --rm -v ./data/:/app/bot_voter/data/ -it botvoter-backend
If you would like the solution to automatically relaunch on system reboot, replace the--rm
in the command above with--restart=unless-stopped
. To launch the voter in the future, simply run the command above.
This file contains all configuration settings for the project. You will need to edit this for the program to work! Details for each entry are as follows. As it is a JSON file, be sure to format accordingly. I strongly recommend you paste it into a JSON checker after you are done, such as this: https://jsonlint.com/
- Settings
- real_screen
- twocaptchaAPIKey
- autoloop
"TRUE" if you want to see Chromium pop up and the process be done. "FALSE" otherwise. If you are using Docker, leave this as "FALSE".
If you have a 2Captcha account with funds you can paste your API key here for the script to use. Write anything other than a 32 character string for this field and the script will not use 2Captcha. If you don't include your API key here, in the very likely event you do get a CAPTCHA challenge, the script will most likely fail to vote for the bot(s).
"TRUE" if you want to have the script repeat the voting process every twelve hours*. "FALSE" otherwise.
* the interval is specified in advanced settings. - Advanced Settings
Feel free to skip over this section unless you are having problems.
- chromiumInstallDirectory
- chromeLaunchPause
- sleepCountDown
- minTimeToWaitForLoop
- maxTimeToWaitForLoop
This option only affects running natively. Some systems (such as non-Mac machines running ARM64 architecture) do not have builds available for Chrome/Chromium from Puppeteer. As such, puppeteer will fail to work on these systems. To get around this you can install Chromium (or Chrome) yourself and specify the absolute path to the executable here. In most cases you should just leave this blank.
The number of seconds to wait after launching Chromium before attempting a connection to attach via websocket. If you have a slow machine, changing this to a higher value may be necessary.
When autoloop is set to "TRUE", the script will count down, displaying how much time is left until it starts the voting process again. This is convenient most of the time. However, for users seeking to run the process on a server or use nohup, this can create giant log files. Set to "FALSE" to disable this countdown.
The minimum number of seconds to wait before voting again. Only used if "autoloop" is true.
The maximum number of seconds to wait before voting again. Only used if "autoloop" is true.
- Bots
This is a user defined list of short hand bot names and Discord user ids for bots. If you'd like to vote for other bots than the ones included in that file, make sure to edit it and add bot ids. You can get the bot id either from within Discord or by going to their voting link and extracting the number from the URL.
- Users
- discord_displayname
- discord_username
- discord_password
- bots_to_vote_for
Discord recently changed how usernames worked when they moved away from the discriminators. As such, this is your real, unique username, not nicknames or anything else . This is used as a failsafe to verify which user is signed in when the browser opens.
This is where you should put whatever you use to sign in to Discord. Likely, this will be an email or a phone number.
Your Discord password. Be sure not to share this file with anyone later.
A list of bots you would like this account to vote for, seperated by commas. Use the names as declared in the "Bots" section.
That should be all you need to do! To reduce the occurance of CAPTCHA puzzles and other headaches, userdata is cached in data/. This is largely beneficial. However, if for whatever reason this is causing trouble, you can safely delete these folders and it will act like a fresh install for each user. Further, the voter will remember where it left off with respect to the countdown (autoloop). If you'd like to prevent it from resuming the countdown, delete the file "countdown" in data/breadcrumbs/
As you must store your Discord username and password in plain text to use this, do be careful. This program doesn't steal your info, but it very well could. I've done my best to write this in a readable way, so feel free to check! If you have suggestions or contributions feel free to open a pull request or an issue.
This project is licensed under the Creative Commons Zero v1.0 Universal license.