4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-03 22:27:44 +00:00

Update dependencies and vendor (#1761)

This commit is contained in:
Wim
2022-03-12 19:41:07 +01:00
committed by GitHub
parent c30e90ff3f
commit b3be2e208c
93 changed files with 14302 additions and 13036 deletions

View File

@ -1,9 +1,9 @@
Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack)
===============
This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization.
This is the original Slack library for Go created by Norberto Lopes, transferred to a GitHub organization.
[![Join the chat at https://gitter.im/go-slack/Lobby](https://badges.gitter.im/go-slack/Lobby.svg)](https://gitter.im/go-slack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
You can also chat with us on the #slack-go, #slack-go-ja Slack channel on the Gophers Slack.
![logo](logo.png "icon")
@ -70,8 +70,15 @@ func main() {
}
```
## Minimal Socket Mode usage:
See https://github.com/slack-go/slack/blob/master/examples/socketmode/socketmode.go
## Minimal RTM usage:
As mentioned in https://api.slack.com/rtm - for most applications, Socket Mode is a better way to communicate with Slack.
See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go

View File

@ -2,9 +2,8 @@ package slack
import (
"encoding/json"
"errors"
"fmt"
"github.com/pkg/errors"
)
type sumtype struct {

View File

@ -103,6 +103,7 @@ type Msg struct {
ReplyCount int `json:"reply_count,omitempty"`
Replies []Reply `json:"replies,omitempty"`
ParentUserId string `json:"parent_user_id,omitempty"`
LatestReply string `json:"latest_reply,omitempty"`
// file_share, file_comment, file_mention
Files []File `json:"files,omitempty"`

View File

@ -61,10 +61,12 @@ type OAuthV2ResponseEnterprise struct {
// OAuthV2ResponseAuthedUser ...
type OAuthV2ResponseAuthedUser struct {
ID string `json:"id"`
Scope string `json:"scope"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ID string `json:"id"`
Scope string `json:"scope"`
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
}
// GetOAuthToken retrieves an AccessToken

View File

@ -1,3 +1,4 @@
//go:build !go1.13
// +build !go1.13
package slack
@ -6,27 +7,26 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"github.com/pkg/errors"
)
func PostWebhookCustomHTTPContext(ctx context.Context, url string, httpClient *http.Client, msg *WebhookMessage) error {
raw, err := json.Marshal(msg)
if err != nil {
return errors.Wrap(err, "marshal failed")
return fmt.Errorf("marshal failed: %v", err)
}
req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(raw))
if err != nil {
return errors.Wrap(err, "failed new request")
return fmt.Errorf("failed new request: %v", err)
}
req = req.WithContext(ctx)
req.Header.Set("Content-Type", "application/json")
resp, err := httpClient.Do(req)
if err != nil {
return errors.Wrap(err, "failed to post webhook")
return fmt.Errorf("failed to post webhook: %v", err)
}
defer resp.Body.Close()

View File

@ -1,3 +1,4 @@
//go:build go1.13
// +build go1.13
package slack
@ -6,26 +7,25 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"github.com/pkg/errors"
)
func PostWebhookCustomHTTPContext(ctx context.Context, url string, httpClient *http.Client, msg *WebhookMessage) error {
raw, err := json.Marshal(msg)
if err != nil {
return errors.Wrap(err, "marshal failed")
return fmt.Errorf("marshal failed: %w", err)
}
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(raw))
if err != nil {
return errors.Wrap(err, "failed new request")
return fmt.Errorf("failed new request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
resp, err := httpClient.Do(req)
if err != nil {
return errors.Wrap(err, "failed to post webhook")
return fmt.Errorf("failed to post webhook: %w", err)
}
defer resp.Body.Close()