The bot finds comments with imperial units, and replies with metric units. See ./test/converter-test.js for what conversions are currently supported, and see Pivotal Tracker for what's coming up next.
There is a chance it will reply to certain triggers like "good bot". See personality-test.js for what the triggers are.
This is a javascript app built with Node.js, and all of the app code is in the src directory.
The app starts in bot.js, and it polls the Reddit servers in an infinite loop. The app has two major components:
converter.js and conversion_helper.js are responsible for converting imperial units to metric units.
personality.js create sassy responses to certain trigger words
For changes not related to networking, running tests is often enough. But if you want to see the bot hitting the Reddit servers:
- Create your bot's reddit account.
- Create a reddit
script
app through your reddit preferences. (Usehttp://localhost
as your redirect url, we don't need it.) - Get your OAuth username and secret
- Download the bot's code
- Create a file
./private/environment.yaml
that looks like sample-environment.yaml - run
npm install
- run
node ./src/bot.js
- You should have the bot up and running!
Note: You can run the bot in development mode (which won't POST requests to reddit servers) by changing the dev-mode
environment variable to "true"
You do not need to create a reddit app to run the tests, you can use the sample-environment.yaml default values.
run npm test
Note: To run a single spec, add .only
Feel free to drop by the subreddit or open a github issue
Metric Units Bot is participating in Hacktoberfest! See a list of things we need help with and win free T-shirts! You can also take a look at what's in Pivotal Tracker or come up with your own improvements
Feedback & code reviews are always welcome.
This source is distributed under GNU GPLv3
Pull requests or derivative works welcome. but please don't make a freedom_units_bot just to spite me D: