5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 00:00:27 +00:00

Properly set Slack user who initiated slash command (#394)

* Properly set Slack user who initiated slash command
This commit is contained in:
Jerry Heiselman 2018-04-25 14:27:34 -05:00 committed by Wim
parent b69fc30902
commit 76af9cba5a

View File

@ -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