feat: customizable message for required params #36

Merged
amovah merged 4 commits from master into master 2017-09-12 16:04:27 +00:00
Showing only changes of commit bc5f14ebde - Show all commits

View File

@ -117,12 +117,7 @@ export default class Bot extends EventEmitter {
* gets the update
* @return {object} returns the bot object
*/
command(command, customMessage, listener) {
if (!listener) {
listener = customMessage;
customMessage = {};
}
command(command, listener, customMessage = {}) {
const regex = /[^\s]+/;
const cmd = command.match(regex)[0].trim();
@ -130,8 +125,8 @@ export default class Bot extends EventEmitter {
this._userEvents.push({
pattern: new RegExp(`^/${cmd}`),
parse: argumentParser.bind(null, command),
customMessage,
listener
listener,
customMessage
});
return this;