Simple to-do example
With the basics of Redis covered, we shall now move on to create a simple to-do Slack bot. The aim of this bot is to allow users to create a to-do list, allowing them to add, complete, and delete a task from this list as they go about their day.
This time, we will start with a skeleton of what we want and build each feature step by step. Start by adding this new command to your bot:
bot.respondTo('todo', (message, channel, user) => { let args = getArgs(message.text); switch(args[0]) { case 'add': break; case 'complete': break; case 'delete': break; case 'help': channel.send('Create tasks with \`todo add [TASK]\`, complete them with \`todo complete [TASK_NUMBER]\` and remove them with \`todo delete [TASK_NUMBER]\` or \`todo delete ...
Get Building Slack Bots now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.