Created
February 3, 2011 22:06
-
-
Save snay2/810317 to your computer and use it in GitHub Desktop.
Modified SMS rules
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
rule sms is active { | |
select when twilio sms | |
pre { | |
messagetext = event:param("Body"); | |
sender = event:param("From"); | |
nextevent = officehours:next("Office hours"); | |
eventtime = nextevent => smsdate(nextevent.pick("$.when[0].start")) | "not scheduled. See the class wiki for info"; | |
} | |
if officehours:onnow("Office hours") then { | |
noop(); | |
} | |
fired { | |
raise explicit event sms_present; | |
} else { | |
raise explicit event sms_not_present with next=eventtime; | |
} | |
} | |
rule sms_present is active { | |
select when explicit sms_present | |
twilio:sms("Steve is holding office hours right now in Cubicle 13. Go visit him!"); | |
} | |
rule sms_not_present is active { | |
select when explicit sms_not_present | |
pre { | |
next = event:param("next"); | |
} | |
twilio:sms("Sorry, but Steve isn't there right now. His next office hours are #{next}."); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment