NTSB is a reddit bot that scans comments for 'note to self' and replies with a reminder one day later.
The bot uses reddit-stream to scan comments, MongoDB/Mongoose to save them locally, and raw.js to send comment replies. The bot uses socket.io to communicate with the frontend dashboard and Pushover to notify your phone when it picks up a comment. NTSB runs forever using Forever.
ntsb-bot.coffee
performs the scanning and database operations.
ntsb-api.coffee
provides a REST-ful API for CRUD operations against the comment database.
dashboard/
contains a Brunch project that provides a front-end web application for easy comment monitoring and manipulation (via the API.) Here are some screenshots:
To run the bot, you'll need to install Brunch, Bower, and MongoDB. Then follow these steps:
- Start a MongoDB database:
$ mongod --config mongodb.conf
Here's a good mongodb.conf:
fork = true
bind_ip = 127.0.0.1
port = 27017
quiet = true
dbpath = /data/db
logpath = /var/log/mongodb/mongod.log
logappend = true
journal = true
- Install NPM packages for the backend:
$ cd note-to-self-bot
$ npm install
- Create
lib/auth.coffee
and supply your reddit and Pushover credentials:
module.exports =
reddit:
username: 'your-bot-name'
password: 'your-password'
app:
id: 'reddit-app-id'
secret: 'reddit-app-secret'
pushover:
user: 'pushover-user'
token: 'pushover-token'
If you do not have a reddit app created, visit this page and create a new "script" application to obtain an app id & secret. Put whatever you want in "redirect uri" as it will not be used.
- Install NPM & Bower packages for the frontend:
$ cd dashboard
$ npm install && bower install
- Build the frontend:
$ brunch build -P
- Start the API server and bot:
$ cd ..
$ chmod +x backend.sh
$ ./backend.sh start api
$ ./backend.sh start bot
- Load the frontend by pointing your browser to the dashboard's
public
folder (probablyhttp://localhost/note-to-self-bot/dashboard/public/
)
Comments will appear in this list as the bot picks them up. You're free to edit the responses before the bot comments.