Tennu / tennu

IRC Bot Framework for Node.js
https://tennu.github.io/
ISC License
78 stars 14 forks source link

Add response function to the action plugin, expose to client #70

Closed VictorioBerra closed 8 years ago

VictorioBerra commented 8 years ago

Added a function called 'response' which lets you send a response directly to the actions plugin for execution.

Usage:

function (command) {
    client.response({
        intent: 'notice',
        query: true,
        message: ['Hello', 'World']
    }, command);
}

Why?

This is useful for plugins that have response factories which might churn out responses in an array. In my case, I have a database driven plugin which compiles a list of various responses and is essentially re-writing the response.js module to fire act/notice/say/raw when it needs it.

Alternatives?

I suppose if response.js create() function could take an array, that might be a good alternative.

Havvy commented 8 years ago

Response.create taking an array of responses would be useful in addition to this.

I'd rather the function on the Client object be respond, not response.

Havvy commented 8 years ago

Forgot to merge yesterday. Derp.

Thanks! :heart: :yellow_heart: :green_apple: :blue_heart: :purple_heart: