mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-23 19:22:03 -08:00
Update gozulipbot dependency (#1618)
This commit is contained in:
parent
831ff6d0a9
commit
8967f02fc9
2
go.mod
2
go.mod
@ -25,7 +25,7 @@ require (
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20211016222428-79310a412696
|
||||
github.com/matterbridge/discordgo v0.21.2-0.20210201201054-fb39a175b4f7
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20200820220548-be5824faa913
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75
|
||||
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
|
||||
github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d
|
||||
github.com/mattermost/mattermost-server/v5 v5.39.0
|
||||
|
6
go.sum
6
go.sum
@ -661,12 +661,10 @@ github.com/matterbridge/discordgo v0.21.2-0.20210201201054-fb39a175b4f7 h1:4J2YZ
|
||||
github.com/matterbridge/discordgo v0.21.2-0.20210201201054-fb39a175b4f7/go.mod h1:411nZYv0UMMrtppR5glXop1foboJiFAowy+42U+Ahvw=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f h1:1hfavl4YOoRjgTBWezeX8WXCGnhrxnfEgQtb38wQnyg=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q=
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20200820220548-be5824faa913 h1:5UGr9fLsvAvhjP6i5XJmd0ZIwYVR2gZCzU1lJZ7wfLY=
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20200820220548-be5824faa913/go.mod h1:yAjnZ34DuDyPHMPHHjOsTk/FefW4JJjoMMCGt/8uuQA=
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 h1:GslZKF7lW7oSisycGLpxPO+TnKJuA4VZuTWIfYZrClc=
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75/go.mod h1:yAjnZ34DuDyPHMPHHjOsTk/FefW4JJjoMMCGt/8uuQA=
|
||||
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba h1:XleOY4IjAEIcxAh+IFwT5JT5Ze3RHiYz6m+4ZfZ0rc0=
|
||||
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba/go.mod h1:iXGEotOvwI1R1SjLxRc+BF5rUORTMtE0iMZBT2lxqAU=
|
||||
github.com/matterbridge/matterclient v0.0.0-20211016195328-346acac403d8 h1:6U64ukl/GOvjPTKvUE9jmMLlvJCa+M2aoiq7myoE8RE=
|
||||
github.com/matterbridge/matterclient v0.0.0-20211016195328-346acac403d8/go.mod h1:Gh3tFUjkcPIBBeEkfXBbGio4ONMMKNmlmGECvXLY0TE=
|
||||
github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d h1:zOIeYDh2WcqEZkJTiV5tHynjuP40IFHubliqhvfhc/0=
|
||||
github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d/go.mod h1:Gh3tFUjkcPIBBeEkfXBbGio4ONMMKNmlmGECvXLY0TE=
|
||||
github.com/mattermost/go-i18n v1.11.0 h1:1hLKqn/ZvhZ80OekjVPGYcCrBfMz+YxNNgqS+beL7zE=
|
||||
|
36
vendor/github.com/matterbridge/gozulipbot/bot.go
generated
vendored
36
vendor/github.com/matterbridge/gozulipbot/bot.go
generated
vendored
@ -10,14 +10,15 @@ import (
|
||||
)
|
||||
|
||||
type Bot struct {
|
||||
APIKey string
|
||||
APIURL string
|
||||
Email string
|
||||
Queues []*Queue
|
||||
Streams []string
|
||||
Client Doer
|
||||
Backoff time.Duration
|
||||
Retries int64
|
||||
APIKey string
|
||||
APIURL string
|
||||
Email string
|
||||
Queues []*Queue
|
||||
Streams []string
|
||||
Client Doer
|
||||
Backoff time.Duration
|
||||
Retries int64
|
||||
UserAgent string
|
||||
}
|
||||
|
||||
type Doer interface {
|
||||
@ -117,6 +118,11 @@ func (b *Bot) Subscribe(streams []string) (*http.Response, error) {
|
||||
body := "subscriptions=" + string(bodyBts)
|
||||
|
||||
req, err := b.constructRequest("POST", "users/me/subscriptions", body)
|
||||
if b.UserAgent != "" {
|
||||
req.Header.Set("User-Agent", b.UserAgent)
|
||||
} else {
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("gozulipbot/%s", Release))
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -174,6 +180,20 @@ func (b *Bot) RegisterEvents(ets []EventType, n Narrow) (*Queue, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != 200 {
|
||||
// Try to parse the error out of the body
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err == nil {
|
||||
var jsonErr map[string]string
|
||||
err = json.Unmarshal(body, &jsonErr)
|
||||
if err == nil {
|
||||
if msg, ok := jsonErr["msg"]; ok {
|
||||
return nil, fmt.Errorf("Failed to register: %s", msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("Got non-200 response code when registering: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
|
2
vendor/github.com/matterbridge/gozulipbot/queue.go
generated
vendored
2
vendor/github.com/matterbridge/gozulipbot/queue.go
generated
vendored
@ -151,6 +151,8 @@ func (q *Queue) GetEvents() ([]EventMessage, error) {
|
||||
switch {
|
||||
case resp.StatusCode == 429:
|
||||
return nil, BackoffError
|
||||
case resp.StatusCode == 401:
|
||||
return nil, UnauthorizedError
|
||||
case resp.StatusCode == 403:
|
||||
return nil, UnauthorizedError
|
||||
case resp.StatusCode >= 400:
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -183,7 +183,7 @@ github.com/matterbridge/discordgo
|
||||
# github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f
|
||||
## explicit
|
||||
github.com/matterbridge/go-xmpp
|
||||
# github.com/matterbridge/gozulipbot v0.0.0-20200820220548-be5824faa913
|
||||
# github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75
|
||||
## explicit
|
||||
github.com/matterbridge/gozulipbot
|
||||
# github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
|
||||
|
Loading…
Reference in New Issue
Block a user