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

Commit

Permalink
Add hearing for impersonating bots.
Browse files Browse the repository at this point in the history
I made a bot that impersonates me, but this disabled hearing for my messages.
I can separate my messages from the bot's messages by checking for message.bot_id .
  • Loading branch information
lauripiisang committed Jun 8, 2016
1 parent 93a151e commit 6db1cff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/SlackBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ function Slackbot(configuration) {
// set up a couple of special cases based on subtype
if (message.subtype && message.subtype == 'channel_join') {
// someone joined. maybe do something?
if (message.user == bot.identity.id) {
if (message.user == bot.identity.id && message.bot_id) {
slack_botkit.trigger('bot_channel_join', [bot, message]);
return false;
} else {
Expand All @@ -485,7 +485,7 @@ function Slackbot(configuration) {
}
} else if (message.subtype && message.subtype == 'group_join') {
// someone joined. maybe do something?
if (message.user == bot.identity.id) {
if (message.user == bot.identity.id && message.bot_id) {
slack_botkit.trigger('bot_group_join', [bot, message]);
return false;
} else {
Expand All @@ -497,7 +497,7 @@ function Slackbot(configuration) {
return false;
} else if (message.channel.match(/^D/)) {
// this is a direct message
if (message.user == bot.identity.id) {
if (message.user == bot.identity.id && message.bot_id) {
return false;
}
if (!message.text) {
Expand All @@ -515,7 +515,7 @@ function Slackbot(configuration) {
return false;

} else {
if (message.user == bot.identity.id) {
if (message.user == bot.identity.id && message.bot_id) {
return false;
}
if (!message.text) {
Expand Down

0 comments on commit 6db1cff

Please sign in to comment.