1
0
forked from lug/matterbridge

Update dependencies and go1.18 (#1873)

* Update dependencies and go1.18

* Exclude unnecessary linters and update build to go1.18
This commit is contained in:
Wim
2022-08-13 16:14:26 +02:00
committed by GitHub
parent 3c4192ebf6
commit 6a3fc71397
396 changed files with 350176 additions and 309792 deletions

View File

@@ -64,6 +64,9 @@ type PostMessageParameters struct {
// chat.postEphemeral support
Channel string `json:"channel"`
User string `json:"user"`
// chat metadata support
MetaData SlackMetadata `json:"metadata"`
}
// NewPostMessageParameters provides an instance of PostMessageParameters with all the sane default values set
@@ -285,6 +288,7 @@ type sendConfig struct {
endpoint string
values url.Values
attachments []Attachment
metadata SlackMetadata
blocks Blocks
responseType string
replaceOriginal bool
@@ -306,6 +310,7 @@ func (t sendConfig) BuildRequestContext(ctx context.Context, token, channelID st
endpoint: t.endpoint,
values: t.values,
attachments: t.attachments,
metadata: t.metadata,
blocks: t.blocks,
responseType: t.responseType,
replaceOriginal: t.replaceOriginal,
@@ -336,6 +341,7 @@ type responseURLSender struct {
endpoint string
values url.Values
attachments []Attachment
metadata SlackMetadata
blocks Blocks
responseType string
replaceOriginal bool
@@ -352,6 +358,7 @@ func (t responseURLSender) BuildRequestContext(ctx context.Context) (*http.Reque
Timestamp: t.values.Get("ts"),
Attachments: t.attachments,
Blocks: t.blocks,
Metadata: t.metadata,
ResponseType: t.responseType,
ReplaceOriginal: t.replaceOriginal,
DeleteOriginal: t.deleteOriginal,
@@ -662,6 +669,18 @@ func MsgOptionIconEmoji(iconEmoji string) MsgOption {
}
}
// MsgOptionMetadata sets message metadata
func MsgOptionMetadata(metadata SlackMetadata) MsgOption {
return func(config *sendConfig) error {
config.metadata = metadata
meta, err := json.Marshal(metadata)
if err == nil {
config.values.Set("metadata", string(meta))
}
return err
}
}
// 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