Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 14d2e097535f50d6d3af27f22a34f0f729101945 Author: Wim <wim@42.be> Date: Sat Feb 08 16:50:53 2020 +0000 Fix go-keybase-chat-bot api changes diff --git a/bridge/keybase/handlers.go b/bridge/keybase/handlers.go index 165aeb1..a29208d 100644 --- a/bridge/keybase/handlers.go +++ b/bridge/keybase/handlers.go @@ -47 +47 @@ import (   "strconv"     "github.com/42wim/matterbridge/bridge/config" - "github.com/keybase/go-keybase-chat-bot/kbchat" + "github.com/keybase/go-keybase-chat-bot/kbchat/types/chat1"  )    func (b *Bkeybase) handleKeybase() { @@ -207 +207 @@ func (b *Bkeybase) handleKeybase() {   b.Log.Errorf("failed to read message: %s", err.Error())   }   - if msg.Message.Content.Type != "text" { + if msg.Message.Content.TypeName != "text" {   continue   }   @@ -347 +347 @@ func (b *Bkeybase) handleKeybase() {   }()  }   -func (b *Bkeybase) handleMessage(msg kbchat.Message) { +func (b *Bkeybase) handleMessage(msg chat1.MsgSummary) {   b.Log.Debugf("== Receiving event: %#v", msg)   if msg.Channel.TopicName != b.channel || msg.Channel.Name != b.team {   return @@ -4510 +4510 @@ func (b *Bkeybase) handleMessage(msg kbchat.Message) {   // TODO download avatar     // Create our message - rmsg := config.Message{Username: msg.Sender.Username, Text: msg.Content.Text.Body, UserID: msg.Sender.Uid, Channel: msg.Channel.TopicName, ID: strconv.Itoa(msg.MsgID), Account: b.Account} + rmsg := config.Message{Username: msg.Sender.Username, Text: msg.Content.Text.Body, UserID: string(msg.Sender.Uid), Channel: msg.Channel.TopicName, ID: strconv.Itoa(int(msg.Id)), Account: b.Account}     // Text must be a string - if msg.Content.Type != "text" { + if msg.Content.TypeName != "text" {   b.Log.Errorf("message is not text")   return   } diff --git a/bridge/keybase/keybase.go b/bridge/keybase/keybase.go index 6d0b478..d41e95f 100644 --- a/bridge/keybase/keybase.go +++ b/bridge/keybase/keybase.go @@ -9016 +9017 @@ func (b *Bkeybase) Send(msg config.Message) (string, error) {   return "", err   }   - _, _ = b.kbc.SendAttachmentByTeam(b.team, fpath, fcaption, &b.channel) + _, _ = b.kbc.SendAttachmentByTeam(b.team, &b.channel, fpath, fcaption)   }     return "", nil   }     // Send regular message - resp, err := b.kbc.SendMessageByTeamName(b.team, msg.Username+msg.Text, &b.channel) + text := msg.Username + msg.Text + resp, err := b.kbc.SendMessageByTeamName(b.team, &b.channel, text)   if err != nil {   return "", err   } - return strconv.Itoa(resp.Result.MsgID), err + return strconv.Itoa(int(*resp.Result.MessageID)), err  }