Github developers at work are engaged not only in the core business, but also
outside projects . One such project is the
Hubot bot, a program for automating various actions online (initially a chat bot).
The unique features of Hubot are support for any Javascript libraries through the
npm package manager and bot scripts that are uploaded to github to the public (see the CoffeeScript
script directory ).
Chat bot programming is done by simple commands.
')
robot.hear /problem\??/i, (msg) -> msg.send "http://cl.ly/BG7R/trollface.jpg"
For example, this script expects the word “problems?” To appear in the chat and publishes a
classic picture in response.
Or,
such a script searches Google Image Search for a picture for a given keyword and publishes the first result from the search results page in the chat.
imageMe = (msg, query, cb) -> msg.http('http://ajax.googleapis.com/ajax/services/search/images') .query(v: "1.0", rsz: '8', q: query) .get() (err, res, body) -> images = JSON.parse(body) images = images.responseData.results image = msg.random images cb "#{image.unescapedUrl}#.png"
Hubot can be connected to any IRC channel and customized to your taste. However, on this his possibilities are not exhausted. For example, inside the Github company, he was taught to unlock the doors in the office, make a list of employees in the room based on their WiFi status, find removable housing according to specified parameters, install Github, speak arbitrary phrases through the office columns,
etc.