summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/chat.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-08-13 16:14:26 +0200
committerGitHub <noreply@github.com>2022-08-13 16:14:26 +0200
commit6a3fc713978a0c1c9290a4afd08b47886b49b635 (patch)
treeaa62cd85cf5671646c75ee38b3fc140ef7edcea8 /vendor/github.com/slack-go/slack/chat.go
parent3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (diff)
downloadmatterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.gz
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.bz2
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.zip
Update dependencies and go1.18 (#1873)
* Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18
Diffstat (limited to 'vendor/github.com/slack-go/slack/chat.go')
-rw-r--r--vendor/github.com/slack-go/slack/chat.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/chat.go b/vendor/github.com/slack-go/slack/chat.go
index 34848d15..4448e9f4 100644
--- a/vendor/github.com/slack-go/slack/chat.go
+++ b/vendor/github.com/slack-go/slack/chat.go
@@ -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