Last active
February 16, 2017 15:33
-
-
Save stephenyeargin/8175153 to your computer and use it in GitHub Desktop.
NashvillePollen hubot script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Description | |
| # Get pollen forecast for Nashville, Tennessee | |
| # | |
| # Dependencies: | |
| # None | |
| # | |
| # Configuration: | |
| # None | |
| # | |
| # Commands: | |
| # hubot pollen - Gets pollen status for Nashville, Tennessee | |
| # | |
| # Notes: | |
| # Uses the pollen forecast that powers https://twitter.com/NashvillePollen | |
| # | |
| # Author: | |
| # stephenyeargin | |
| # jt2k | |
| api_url = 'https://jasontan.org/api/pollen' | |
| module.exports = (robot) -> | |
| robot.respond /pollen/i, (msg) -> | |
| msg.http(api_url) | |
| .get() (err,res,body) -> | |
| try | |
| result = JSON.parse(body) | |
| if result.error | |
| msg.send result.error | |
| else | |
| msg.send "Nashville pollen level: #{result.count} (#{result.level}) - #{result.types}" | |
| catch error | |
| msg.send "Could not retrieve pollen data." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment