From 76af9cba5a28b0879751c6ec7254b4454d9da40f Mon Sep 17 00:00:00 2001 From: Jerry Heiselman Date: Wed, 25 Apr 2018 14:27:34 -0500 Subject: Properly set Slack user who initiated slash command (#394) * Properly set Slack user who initiated slash command --- bridge/slack/slack.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 0abd83c3..95c85158 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -485,7 +485,7 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er rmsg := config.Message{Text: ev.Text, Channel: channel.Name, Account: b.Account, ID: "slack " + ev.Timestamp, Extra: make(map[string][]interface{})} // find the user id and name - if ev.BotID == "" && ev.SubType != messageDeleted && ev.SubType != "file_comment" { + if ev.User != "" && ev.SubType != messageDeleted && ev.SubType != "file_comment" { user, err := b.rtm.GetUserInfo(ev.User) if err != nil { return nil, err @@ -509,7 +509,7 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er } // when using webhookURL we can't check if it's our webhook or not for now - if ev.BotID != "" && b.GetString("WebhookURL") == "" { + if rmsg.Username == "" && ev.BotID != "" && b.GetString("WebhookURL") == "" { bot, err := b.rtm.GetBotInfo(ev.BotID) if err != nil { return nil, err -- cgit v1.2.3