#Reddit Auto Responder
This bot continuously checks for new private messages and responds with a given message if the subject conforms to a certain pattern.
To use the bot, you will need python and praw installed.
Get a copy of the code by running
$ git clone git://github.com/kragniz/reddit-auto-respond.git
Run the bot with
$ cd reddit-auto-respond
$ ./responder
To configure, open config.json
in a text editor and add your username and
password in the fields provided.
#Response rules
The rules for choosing what response to give use regex. To configure the bot you will only need to use a very small subset of the regex language. Have a look at this quick overview, or modify the examples below.
Examples
.+
Respond to any subject.*subreddit.*
Respond to a message withsubreddit
in the title
The order of the rules matter. Rules earlier in the config file take precedence over later rules in the case of multiple rules matching the same subject text.
#Example config
{
"username": "POTATO_IN_YOUR_RESPONSE",
"password": "correcthorsebatterystaple",
"responses":
{
".*report.*": "Please send this message via mod mail instead",
".*help.*": "Help yourself to some:\n\n* Cheese\n\n* Cake\n\n* Some bees",
"^hello.*": "Well hello there",
".+": "It might take me a while to get back to you, sorry\n\nSent by a bot"
}
}
Some points about the config:
- Full reddit markdown notation can be used in the body of the messages, but
newline characters are not directly permitted within the config file. Use
\n
in the place of a newline character - Regular expressions used are case insensitive for simplicity
- The rules used in the example config above (in plain english) are:
- Any subject including the word
report
- Any subject including the word
help
- Any subject beginning with
hello
- Any subject with one or more characters
- Any subject including the word
#Licence
This code is licenced under the terms of the WTFPLv2. See the COPYING
file for
more details.