An experimantal Reddit bot that posts explanation of the xkcd links posted in the comments. The explanation is extracted from the explain xkcd wiki.
Obtaining Reddit API access credentials
Running the bot
- Create a Reddit account, and while logged in, navigate to preferences > apps
- Click on the are you a developer? create an app... button
- Fill in the details-
- name: Name of your bot/script
- Select the option 'script'
- decription: Put in a description of your bot/script
- redirect uri:
- Click create app
- You will be given a
client_id and a
client_secret. Keep them confidential.
- Clone this repository and navigate to its directory.
- Create a file named praw.ini with its contents as:
username: reddit username
password: reddit password
client_id: client id you got
client_secret: client secret you got
python3 explainxkcdbot.py to start the bot.
- It is possible to use other file types (even plain text) to store the authentication credentials, but creating and using praw.ini is recommended.
- If the Reddit API returns an error due to too many requests, adjust
val in the instances of
time.sleep(val) in explainxkcdbot.py