This is a reddit bot framework (v2!)
- Message-triggered bots (PMs, comment replies, post replies, username mentions)
- Comment-triggered bots
- Submission-triggered bots
- Vote-triggered bots
Included working bots:
- Emote counter (triggered through PMs)
- XKCD transcriber (trigged via submission and comments, monitors messages to add to ignore list, vote monitoring)
Requires: python 2.7, praw, simplejson, snudown, a bunch of other stuff (see requirements.txt)
Subclass UserCommentsVoteTriggeredBot, MailTriggeredBot, SubredditCommentTriggeredBot, SubredditSubmissionTriggeredBot or BotHandler if you need a new type.
Implement the _check() and _do() functions at a minimum. If you are subclassing a template, be sure to call the super() function for each. If not, implement _get_content() as well.
In v1, the built-in bot templates auto checked to ensure it doesn't reply twice. This functionality has been moved into the
utilsmodule, and needs to be called yourself.
MultiBotHandlercan be used to run multiple bots at the same time in a single python process.
It is important that
# Must be first for monkey_patch() from redditbot.base import patch_all patch_all()
are the first lines that execute when the python process is started. These lines ensure that gevent's monkey patches are made correctly.
The example bots can be run with
Accounts and settings are configured in settings.py
local_settings.py can be used to configure dev settings and have git ignore it.
Oauth2 support is included (script type apps only).