-
-
Save riston/c0a2871e0d8309f470d5 to your computer and use it in GitHub Desktop.
Get last event from public calendar
This file contains 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
module.exports = (robot) -> | |
id = 'fr51k59qr9innjdkbikm53qobo@group.calendar.google.com' | |
url = "http://www.google.com/calendar/feeds/#{id}/public/full?alt=json&orderby=starttime&max-results=15&singleevents=true&sortorder=ascending&futureevents=true" | |
robot.respond /school$/i, (msg) -> | |
# msg.send "Hello from school" | |
# msg.send "School called#{res}" | |
getCalendar url, (err) -> | |
console.log "Reached here" | |
msg.send "Alo reached here" | |
getCalendar = (url, cb) -> | |
robot.http(url) | |
.get (err, res, body) -> | |
# return cb err if err | |
# data = null | |
# try | |
# data = JSON.parse(body) | |
# catch error | |
# return cb Error("Ran into an error parsing JSON :(") | |
cb JSON.parse body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment