Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hacking Culture with Javascript - CascadiaFest ...

Hacking Culture with Javascript - CascadiaFest 2015

Robots are for automation, and what you choose to automate has a feedback effect on the people who use it.

Ben Straub

July 09, 2015
Tweet

More Decks by Ben Straub

Other Decks in Technology

Transcript

  1. module.exports = (robot) -> robot.respond /address\s*(me)?$/i, (msg) -> msg.send ":office:

    9565 Semiahmoo Parkway, Blaine, WA, 98230, US" robot.respond /(tele)?phone\s*(me)?$/i, (msg) -> msg.send ":phone: tel:360-318-2000"
  2. module.exports = (robot) -> unless trelloKey and trelloToken console.log "Provide

    HUBOT_TRELLO_KEY and HUBOT_TRELLO_TOKEN to enable Trello subscriptions" return robot.brain.data.trelloSubscriptions ?= {} robot.brain.data.trelloState ?= {} # UTILITIES sendToRooms = (listid, message) -> # Figure out which rooms get this message for roomid of robot.brain.data.trelloSubscriptions if listid in robot.brain.data.trelloSubscriptions[roomid] robot.messageRoom roomid, message isReportable = (listid, action) -> switch action.type when 'updateCard' then action.data.listAfter.id == listid else true listName = (action) -> if action.data.list? action.data.list.name else action.data.listAfter.name updateStateForList = (listid) -> new TrelloApp(robot).fetchAddActionsForList listid, (actions) -> for a in actions when isReportable(listid, a) unless robot.brain.data.trelloState[a.id]? sendToRooms listid, "Trello card '#{a.data.card.name}' added to '#{listName a}'\n" + ":point_right: https://trello.com/c/#{a.data.card.shortLink}" robot.brain.data.trelloState[a.id] = true updateState = -> # Get a set of lists to query listids = {} for roomid of robot.brain.data.trelloSubscriptions for listid in robot.brain.data.trelloSubscriptions[roomid] listids[listid] = true for listid of listids updateStateForList listid # Check status every 30 seconds setInterval updateState, 30*1000 updateState()
  3. ▸ Address and phone number ▸ Trello notifications ▸ Foursquare

    location ▸ Package tracking ▸ Rainforest test runs ▸ AWS EC2 instance management ▸ Twitter search ▸ …
  4. AUTOMATING AN ACTION SAYS ▸ We want this thing to

    be easy ▸ We want this thing to be correct
  5. AUTOMATING AN ACTION SAYS ▸ We want this thing to

    be easy ▸ We want this thing to be correct ▸ We don't care how personal it is
  6. !!!

  7. ▸ 150 gifts in first six months ▸ Average givings:

    $24/gift ▸ Average receivings: $25/mo
  8. GO DO THIS RIGHT NOW GET A CHAT GET A

    ROBOT AUTOMATE ALL THE THINGS