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

Disable message from other bots when using webhooks (slack)

This commit is contained in:
Wim 2017-07-22 20:03:40 +02:00
parent 10dab1366e
commit bd97357f8d

View File

@ -222,6 +222,9 @@ func (b *Bslack) handleSlack() {
if b.Config.WebhookURL == "" && b.Config.WebhookBindAddress == "" && message.Username == b.si.User.Name { if b.Config.WebhookURL == "" && b.Config.WebhookBindAddress == "" && message.Username == b.si.User.Name {
continue continue
} }
if message.Text == "" || message.Username == "" {
continue
}
texts := strings.Split(message.Text, "\n") texts := strings.Split(message.Text, "\n")
for _, text := range texts { for _, text := range texts {
text = b.replaceURL(text) text = b.replaceURL(text)
@ -279,7 +282,8 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
} }
m.Raw = ev m.Raw = ev
m.Text = b.replaceMention(m.Text) m.Text = b.replaceMention(m.Text)
if ev.BotID != "" { // when using webhookURL we can't check if it's our webhook or not for now
if ev.BotID != "" && b.Config.WebhookURL == "" {
bot, err := b.rtm.GetBotInfo(ev.BotID) bot, err := b.rtm.GetBotInfo(ev.BotID)
if err != nil { if err != nil {
continue continue