github/hubot — pull request #424 by cupakromer (2013-02-27 14:40:02+00:00)
Title: Add a 'play' method to allow for playing of sounds in Campfire

As a Campfire user, in order to play a sound, you type "/play sound". Attempting to tell Hubot to "/play sound" with `msg.send` does nothing but echo the words. In order to play the sound you need to issue a special sound message. This is in the `Campfire` adapter, but in order to use it, you need to traverse the entire `robot` structure. Additionally, since the `Shell` does not have a `bot`, this condition needs to be checked to prevent errors when testing locally:

```coffee
module.exports = (robot) ->
robot.respond /play( me)? (.*)/i, (msg) ->
msg.send "I'm going to play #{msg.match[2]} for you"
msg.robot.adapter.bot?.Room(msg.user.room).sound msg.match[2]
```

This doesn't provide a clean (or intuitive) method for interacting with Campfire. This patch adds the `play` method to the `Campfire` adapter (and to `Shell` so that the scripts can be tested locally). It also patches on to the `Response` message to allow for users to have an intuitive interface:

```coffee
module.exports = (robot) ->
robot.respond /play( me)? (.*)/i, (msg) ->
msg.send "I'm going to play #{msg.match[2]} for you"
msg.play msg.match[2]
```

It was decided to not attempt to patch this directly into `send` switching on the leading string "/play" as that felt a little too magical.

Also, no changes to `README.md` were made as this feels more adapter specific and should go on the wiki pages if accepted.