mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-28 18:21:35 +00:00
Drop first received message on connection to avoid duplicates (slack). Fixes #55
This commit is contained in:
parent
5249568b8e
commit
96620a3c2c
@ -157,10 +157,14 @@ func (b *Bslack) handleSlack() {
|
||||
}
|
||||
|
||||
func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
|
||||
count := 0
|
||||
for msg := range b.rtm.IncomingEvents {
|
||||
switch ev := msg.Data.(type) {
|
||||
case *slack.MessageEvent:
|
||||
// ignore first message
|
||||
if count > 0 {
|
||||
flog.Debugf("Receiving from slackclient %#v", ev)
|
||||
//ev.ReplyTo
|
||||
channel, err := b.rtm.GetChannelInfo(ev.Channel)
|
||||
if err != nil {
|
||||
continue
|
||||
@ -174,6 +178,8 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
|
||||
m.Channel = channel.Name
|
||||
m.Text = ev.Text
|
||||
mchan <- m
|
||||
}
|
||||
count++
|
||||
case *slack.OutgoingErrorEvent:
|
||||
flog.Debugf("%#v", ev.Error())
|
||||
case *slack.ConnectedEvent:
|
||||
|
Loading…
Reference in New Issue
Block a user