Login and choose comments randomly from a thread. By default excludes all moderators, and duplicate comments by the same user. Supports excluding specific users too.
Completely configurable with the following parameters:
no_of_winners
- The number of winners to choosepost_url
- The url of the post to pull winners fromthreshold_age
- The age of the user account. Accounts younger than this are excluded from winning.winner_filename
- Create a text file with usernames of the winners and a permalink to their comment nicely formatted for a Reddit post.winner_filename_csv
- Only output the usernames of the winners to a text filewinner_filename_pm
- A python compatible string that is read bysendPMs.py
to send modmails to the winnersusers_to_exclude
- A python list with the names of users who need to be excluded. For instance setting it to say ["hello", "world"] will exclude u/Hello and u/world from winning apart from the moderators.
Create a new script application in your reddit account here and note down the client_id
and client_secret
Paste these values in the raffle.py
file within the quotes.
Also do this for sendPMs.py
to authenticate and send modmails. Ensure that you have mail permissions to send a modmail.
cd
to the project folder Install dependencies by usingpip3 install -r requirements.txt
.- Run
raffle.py
usingpython3 raffle.py
- Verify that the users in
winner_usernames.py
andwinner_usernames.txt
all match. - Open
sendPMs.py
to customize the modmail message and subject. You need to enter the credentials of a user/moderator with the mail permissions. (Follow the setup as above. If you already used a moderator account for the giveaway, you can reuse the credentials here.) - Run
python3 sendPMs.py
to send a modmail to the user with the message.
praw==6.5.1 tqdm==4.43.0