Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Sample_taskbot fix #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions skills/sample_taskbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,23 @@ module.exports = function(controller) {

var item = user.tasks.splice(number,1);

// reply with a strikethrough message...
bot.reply(message, '~' + item + '~');

if (user.tasks.length > 0) {
bot.reply(message, 'Here are our remaining tasks:\n' + generateTaskList(user));
} else {
bot.reply(message, 'Your list is now empty!');
}
controller.storage.users.save(user, function(err,saved) {

if (err) {
bot.reply(message, 'I experienced an error adding your task: ' + err);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably say 'I experienced an error removing your task: '

} else {
// reply with a strikethrough message...
bot.reply(message, '~' + item + '~');

if (user.tasks.length > 0) {
bot.reply(message, 'Here are our remaining tasks:\n' + generateTaskList(user));
} else {
bot.reply(message, 'Your list is now empty!');
}
}

});

}
});
}
Expand Down