This is a project I wanted to create to add some positivity into the world of social media. Social media is notoriously toxic at times, so I felt like building a bot that would help increase the likelyhood of having a positive moment on Reddit. The messages are simple, randomly chosen and randomly distributed, but genuine nontheless, as a sort of extension of myself.
The first step is to create an app (a bot in my case), which you are permitted to do even as a regular user, and the bot you create will interact with Reddit under your username. During this step, a client ID and secret will be generated for you, and these will be used to interact with the Reddit API. Those keys are not visble here for obvious reasons.
Below is the full script that is run to excute the bot's actions on Reddit. The praw package "Python Reddit API Wrapper" is used to create and manage the actions of a bot for Reddit, so that is the core package for this project. And I'm using the random package to select comments and my personal messages randomly. And as you can see I am storing my API credentials as an environmental variable within the project folder.
Here is a basic script for a batch file that is used to run the .py file and is scheduled to run using Task Manager on Windows to employ some form of automation.
Here are the print statments from the python script. Although I can check the account to see the comments made, I like to see this pop up and look at without having to go on Reddit.
Here is an example of a comment made to r/SuicideWatch. I can only hope that this message has helped this person who is seriously struggling.