Update dependencies and build to go1.22 (#2113)
* Update dependencies and build to go1.22 * Fix api changes wrt to dependencies * Update golangci config
This commit is contained in:
35
vendor/github.com/slack-go/slack/chat.go
generated
vendored
35
vendor/github.com/slack-go/slack/chat.go
generated
vendored
@@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/slack-go/slack/slackutilsx"
|
||||
@@ -29,9 +30,9 @@ const (
|
||||
|
||||
type chatResponseFull struct {
|
||||
Channel string `json:"channel"`
|
||||
Timestamp string `json:"ts"` //Regular message timestamp
|
||||
MessageTimeStamp string `json:"message_ts"` //Ephemeral message timestamp
|
||||
ScheduledMessageID string `json:"scheduled_message_id,omitempty"` //Scheduled message id
|
||||
Timestamp string `json:"ts"` // Regular message timestamp
|
||||
MessageTimeStamp string `json:"message_ts"` // Ephemeral message timestamp
|
||||
ScheduledMessageID string `json:"scheduled_message_id,omitempty"` // Scheduled message id
|
||||
Text string `json:"text"`
|
||||
SlackResponse
|
||||
}
|
||||
@@ -224,7 +225,7 @@ func (api *Client) SendMessageContext(ctx context.Context, channelID string, opt
|
||||
return "", "", "", err
|
||||
}
|
||||
req.Body = ioutil.NopCloser(bytes.NewBuffer(reqBody))
|
||||
api.Debugf("Sending request: %s", string(reqBody))
|
||||
api.Debugf("Sending request: %s", redactToken(reqBody))
|
||||
}
|
||||
|
||||
if err = doPost(ctx, api.httpclient, req, parser(&response), api); err != nil {
|
||||
@@ -234,6 +235,20 @@ func (api *Client) SendMessageContext(ctx context.Context, channelID string, opt
|
||||
return response.Channel, response.getMessageTimestamp(), response.Text, response.Err()
|
||||
}
|
||||
|
||||
func redactToken(b []byte) []byte {
|
||||
// See https://api.slack.com/authentication/token-types
|
||||
// and https://api.slack.com/authentication/rotation
|
||||
re, err := regexp.Compile(`(token=x[a-z.]+)-[0-9A-Za-z-]+`)
|
||||
if err != nil {
|
||||
// The regular expression above should never result in errors,
|
||||
// but just in case, do no harm.
|
||||
return b
|
||||
}
|
||||
// Keep "token=" and the first element of the token, which identifies its type
|
||||
// (this could be useful for debugging, e.g. when using a wrong token).
|
||||
return re.ReplaceAll(b, []byte("$1-REDACTED"))
|
||||
}
|
||||
|
||||
// UnsafeApplyMsgOptions utility function for debugging/testing chat requests.
|
||||
// NOTE: USE AT YOUR OWN RISK: No issues relating to the use of this function
|
||||
// will be supported by the library.
|
||||
@@ -681,6 +696,14 @@ func MsgOptionMetadata(metadata SlackMetadata) MsgOption {
|
||||
}
|
||||
}
|
||||
|
||||
// MsgOptionLinkNames finds and links user groups. Does not support linking individual users
|
||||
func MsgOptionLinkNames(linkName bool) MsgOption {
|
||||
return func(config *sendConfig) error {
|
||||
config.values.Set("link_names", strconv.FormatBool(linkName))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// UnsafeMsgOptionEndpoint deliver the message to the specified endpoint.
|
||||
// NOTE: USE AT YOUR OWN RISK: No issues relating to the use of this Option
|
||||
// will be supported by the library, it is subject to change without notice that
|
||||
@@ -784,6 +807,7 @@ func (api *Client) GetPermalinkContext(ctx context.Context, params *PermalinkPar
|
||||
|
||||
type GetScheduledMessagesParameters struct {
|
||||
Channel string
|
||||
TeamID string
|
||||
Cursor string
|
||||
Latest string
|
||||
Limit int
|
||||
@@ -803,6 +827,9 @@ func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetS
|
||||
if params.Channel != "" {
|
||||
values.Add("channel", params.Channel)
|
||||
}
|
||||
if params.TeamID != "" {
|
||||
values.Add("team_id", params.TeamID)
|
||||
}
|
||||
if params.Cursor != "" {
|
||||
values.Add("cursor", params.Cursor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user