A bot for /r/xkcd that posts detailed comments about xkcd comics
After seeing this suggestion on the /r/xkcd subreddit, I began working on this bot. It is intended to be a non-intrusive bot that provides a detailed and well formatted comment with information regarding the relevant comic.
It is currently running 24/7 in the cloud. You can find the bot at /u/BobbyTablesBot.
There are two ways to use the bot.
-
The first way is to post a comment in /r/xkcd with the number of the xkcd comic you would like to link prefixed by an exclamation mark (!) or a pound sign (#).
Examples:!327
or
#327
or even
Show me !327
-
The second way is to mention the bot from any subreddit with the number of the xkcd comic you would like to link. If the bot is mentioned, the comic number does not need to be prefixed.
Examples:/u/BobbyTablesBot 327
or
/u/BobbyTablesBot !327
or even
Hey /u/BobbyTablesBot, can you link me 327?
In any of the previous cases, the bot would respond with:
327: Exploits of a Mom
Alt-text: Her daughter is named Help I'm trapped in a driver's license factory.
Image
Mobile
Explanationxkcd.com | Feedback | Stop Replying | GitHub | Programmer
To host your own xkcd bot, follow these simple example steps.
- Python 3.8
- A Reddit Account
-
Clone the repo
git clone git@github.com:joeyvanlierop/xkcdbot.git
-
Create an app here
- Create a copy of config.example.json and rename it to config.json
- Paste the appropritate credentials into the newly created config.json
- Make sure to also add an appropriate user agent in the config.json
-
Install the requirements
pip install -r requirements.txt
-
From the base directory run:
python -m bot.bot
-
From the base directory run:
python -m unittest
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- Task list:
- Blacklisting users through inbox messages
- Implement databases for blacklisted users and statistics
- Respond to mentions regardless of subreddit
- Remove duplicate entries
- Track comic reference popularity
- Include statistics in comment
- Implement logging
- !latest
- Ignore hyperlinks
- Literalize certain Markdown reserves characters when they appear as part of a URL
- Reference comic by title/alias
- Backlog/queue script
- Handle range of ids
- Call bot with "Relevant xkcd: {}"
- Return random comic
- Match submissions (currently only matches comments)