From b555c33f33ab9856162d04371780365ef99874c7 Mon Sep 17 00:00:00 2001 From: Luke Bonaccorsi Date: Tue, 18 Apr 2017 20:32:30 +0100 Subject: [PATCH] Make the example respond when "Hello." is said instead of every message --- docs/_pages/bots.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/_pages/bots.md b/docs/_pages/bots.md index 1bdab7f16..20deb37bc 100644 --- a/docs/_pages/bots.md +++ b/docs/_pages/bots.md @@ -193,7 +193,9 @@ var rtm = new RtmClient(bot_token); rtm.start(); rtm.on(RTM_EVENTS.MESSAGE, function handleRtmMessage(message) { - var channel = "#general"; //could also be a channel, group, DM, or user ID (C1234), or a username (@don) - rtm.sendMessage("Hello <@" + message.user + ">!", message.channel); +  if (message.text === "Hello.") { +    var channel = "#general"; //could also be a channel, group, DM, or user ID (C1234), or a username (@don) +   rtm.sendMessage("Hello <@" + message.user + ">!", message.channel); +  } }); ```