Created
August 10, 2018 11:44
-
-
Save KeesCBakker/012f01db0ce5c304b1b264e9ab353250 to your computer and use it in GitHub Desktop.
Todo Add - Hubot Command Mapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { mapper, RestParameter } = require('hubot-command-mapper') | |
module.exports = robot => { | |
let todos = [] | |
mapper(robot, { | |
name: 'todo', | |
commands: [{ | |
name: 'add', | |
alias: [''], | |
parameters: [new RestParameter('item')], | |
invoke: (tool, robot, res, match, values) => { | |
const item = values.item | |
todos.push(item) | |
res.reply(`Added _${item}_ to the list.`) | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment