Make Tutorial bot's 'exit' reply the same type as the exit message.

I.e. if you sent a stream message, Tutorial bot will reply to that
stream, and if you sent a PM, Tutorial bot will reply with a PM.

(imported from commit 05b7d1848f6eb1f70dcd5fb365fba9daee52a5dd)
This commit is contained in:
Tim Abbott 2013-03-06 16:41:27 -05:00
parent f7d189feb8
commit bb97019720
1 changed files with 9 additions and 2 deletions

View File

@ -64,8 +64,15 @@ exports.message_was_sent = function(message) {
var trimmed_content = message.content.trim().toLowerCase();
if (any_message_to_me(message) &&
(trimmed_content === 'exit' || trimmed_content === 'stop')) {
sleep(1000).then(go(pm, "OK, cool, we'll stop the tutorial here. If you have any questions, you can always email support@humbughq.com!"));
sleep(1000).then(function () {
var text = "OK, cool, we'll stop the tutorial here. If you have any questions, you can always email support@humbughq.com!";
if (pm_to_me(message)) {
pm(text);
} else {
stream_message(message.subject, text);
}
exports.stop();
});
return;
}
received_messages.push(message);