A Reddit bot designed to randomly select the winners of a competition from top level comments in a post
Getting started • Project Files Description • Install Instructions
To randomly select winners from a particular post, you:
- enter the amount of winners you want (defaults to 1)
- copy the URL of the post you are running the contest from
- click Paste URL, which will pull the post URL from the clipboard, and randomly select winners
The selected winners will then be displayed in the text box. It shows up to a maximum of 10 before scrolling is required.
- 📁 Excel Contest Records: A directory containing contest results in a csv format
- 📄 Contest_??????.csv: The contest results for the post with ID ??????
- 📁 Logs: contains up to 2 MB of program logs. This is used for debugging when an issue occurs
- 📄 account.ini: Contains the user account information, which is required to access the Reddit API, and a user configurable list of blacklisted usernames
- 📄 contest_bot.pyw: The main script the user should run
This script was developed and tested on Windows, but likely works on other operating systems. The python version installed was python 3.10.0. Installation for newer version of python 3 should look similar.
1. Install Python 3
-
Download and install the latest version of Python3 from Python Downloads Page, making sure to follow the below instructions during installation.
- In the optional features menu, select "pip", "tcl/tk", "py launcher", and "for all users".
- In the advanced options menu: select "Create shortcuts", "Add Python to environment variables", and "Precompile standard library"
-
Check that Python 3 is properly installed
- First open a command prompt (cmd.exe), then run
python
. If it doesn't produce an error and looks similar to the example, then Python 3 is installed. Typequit()
to exit Python 3 - In the same command prompt, run
pip -V
(capital V), orpython -m pip -V
. If it doesn't produce an error and looks similar to the example, then Pip is installed
- First open a command prompt (cmd.exe), then run
2. Install PRAW
- Open a command prompt, then run
pip install praw
, orpython -m pip install praw
- You should see an lot of output with the final line looking something like
Successfully installed praw-7.5.0 prawcore-2.3.0 update-checker-0.18.0
- You should see an lot of output with the final line looking something like
3. Install the script
- Create a folder where you'd like the script to live
- Download the script files from github by clicking Code and then Download Zip as shown below
- Unzip the files in
Contest-Bot-main.zip
into the folder you created
4. Complete account.ini
- Follow the instructions in the praw documentation to get a
client_id
andclient_secret
. Theusername
andpassword
fields are just your normal Reddit account