If FlackBot was to become a permanent fixture in chat what are some features which should be added to provide merit for it's presence in chat?
As with most other polls please only post one suggestion per answer. In addition to your idea please provide use cases, examples, or other supporting arguments for said feature.
Technical information by George Edison:
In addition to suggesting ideas, actual code for the ideas would be appreciated too. So if you have worked with JavaScript before, you can easily write the code for your idea yourself.
Each 'command' includes two components:
- a RegEx or function that matches against the user's input
- a function that will be executed upon a successful match
So for example, to have FlackBot say 'Hello username.' when a user types 'My name is username.' you would have the following:
/* pattern */
/^my name is (?:\w+)$/i
/* function */
function($, input, message_data, output_callback) {
return 'Hello ' + input.match(/^my name is (\w+)$/i)[1] + '.';
}
Explanation of arguments to the function:
The function that gets executed when the RegEx is matched gets four parameters passed to it. The first is a reference to jQuery. The second is the user's input. The third is metadata about the message the user sent (like username, timestamp). The fourth parameter is a function that can be called to output a message to the user - this is useful if you need to make AJAX requests in order to reply to the user. When using output_callback
, be sure to return null
from the function.