nandub/hubot-irc — pull request #45 by BotDev (2012-10-20 18:30:37+00:00)
Title: Actions

1) I've added a function to perform IRC actions (usually a /me command in user clients). To use it in a script you can do:

```
robot.adapter.action user, "self destructs."
```

Version 0.3.3 of the IRC module already supports sending actions, so this function merely forwards the command to it.

2) I've added action receiving too. In order to do this, the created TextMessage object is given an action property (set to true) when the message is an action. This means that in a script you can do:

```
if message.action
robot.adapter.action message.user, "has received your action."
```

As the action property stays undefined for standard messages, and the action property is also undefined with other adapters, this allows you to write hubot scripts that work with general adapters but can also receive and process IRC actions with the IRC adapter.

Version 0.3.3 of the IRC module (the one this module currently uses) doesn't emit an event for actions, but version 0.3.4 (the latest version) does. What I've done is write my own action detection code (a one line regex) inside the standard 'message' listener, but if the dependency is bumped up to 0.3.4 then the code needs to be changed by adding a new listener to the 'action' event instead.

If you do want to bump up the required version of the IRC module to 0.3.4, let me know and I'll commit the required changes. If you want to stay with 0.3.3 then these changes work fine.