##[fit] ChatOps ##[fit]Look Who's Talking
#We all know our friend
@Hubot pug me
#[fit] What if Hubot could do more?
#[fit] What if Hubot was part of the ##[fit] team?
#Where did he come from?
- Created by GitHub
- github.com/github/hubot
- github.com/github/hubot-scripts
jonathan @Hubot deploy github/myfeature to production Hubot @jonathan deployed myfeature
jonathan @Hubot deployed Hubot @jonathan deployed myfeature today at 3:30 PM
Hubot @nick deployed hotfix yesterday at 4:43 PM
Hubot @sha deployed awesome yesterday at 12:23 PM
jonathan @Hubot deploy github/myfeature to production
Hubot @jonathan deployed myfeature
jonathan @Hubot I'm working on the best presentation ever
Hubot got it!
nick @Hubot what is jonathan working on?
Hubot Jonathan is working on the best presentation ever
rick @Hubot shake cam
##[fit]What about #[fit]Chipotle?
##[fit] But why not just write a script?
module.exports = function(robot) {
robot.respond(/is it (weekend|holiday)\s?\?/i, function(msg){
var today = new Date();
msg.reply(today.getDay() === 0 || today.getDay() === 6 ? "YES" : "NO");
});
}
module.exports = (robot) ->
robot.respond /shake cam/i, (msg) ->
msg.send 'http://www.shakeshack.com/camera.jpg'
robot.hear /badger/i
jonathan I don't want to badger anyone
robot.respond /open the pod bay doors/i
nick @Hubot open the pod bay doors
##Talking Back
module.exports = (robot) ->
robot.hear /badger/i, (res) ->
res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS"
jonathan I don't want to badger anyone Hubot Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS"
module.exports = (robot) ->
robot.respond /open the pod bay doors/i, (res) ->
res.reply "I'm afraid I can't let you do that."
nick @Hubot open the pod bay dooors Hubot @nick I'm afraid I can't let you do that.
- What if I want to open a different door?
robot.respond /open the (.*) doors/i, (res) ->
doorType = res.match[1]
if doorType is "pod bay"
res.reply "I'm afraid I can't let you do that."
else
res.reply "Opening #{doorType} doors"
robot.http("https://midnight-train")
.header('Accept', 'application/json')
.get() (err, res, body) ->
# error checking code here
data = JSON.parse body
res.send "#{data.passenger} taking midnight train going #{data.destination}"
- Provides in-memory key-value storage
robot.brain
robot.respond /have a soda/i, (res) ->
sodasHad = robot.brain.get('totalSodas') * 1 or 0
if sodasHad > 4
res.reply "I'm too fizzy.."
else
res.reply 'Sure!'
robot.brain.set 'totalSodas', sodasHad+1
robot.respond /sleep it off/i, (res) ->
robot.brain.set 'totalSodas', 0
msg.reply 'zzzzz'
- Restricted Access to Commands
- XML Parsing
- Screen Scraping (cheerio and jsdom)
- Watch if topic changes
- Know when someone enters or leaves a room
##How could we use Hubot?
##Ideas?
- Deployments
- Phonegap Builds
- Jira Integration?
- Time logging into jira?