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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.