summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/block_object.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-03-20 22:40:23 +0100
committerGitHub <noreply@github.com>2021-03-20 22:40:23 +0100
commitee5d9b43b54a3becf3cb4025198f24608d35500d (patch)
treedd3614db7423da52f5a71da3001e48d1e4195ea1 /vendor/github.com/slack-go/slack/block_object.go
parent3a8857c8c9efb2c67fb8c175f31d2b9c617b771b (diff)
downloadmatterbridge-msglm-ee5d9b43b54a3becf3cb4025198f24608d35500d.tar.gz
matterbridge-msglm-ee5d9b43b54a3becf3cb4025198f24608d35500d.tar.bz2
matterbridge-msglm-ee5d9b43b54a3becf3cb4025198f24608d35500d.zip
Update vendor (#1414)
Diffstat (limited to 'vendor/github.com/slack-go/slack/block_object.go')
-rw-r--r--vendor/github.com/slack-go/slack/block_object.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/slack-go/slack/block_object.go b/vendor/github.com/slack-go/slack/block_object.go
index d17806ca..5ced7f92 100644
--- a/vendor/github.com/slack-go/slack/block_object.go
+++ b/vendor/github.com/slack-go/slack/block_object.go
@@ -2,6 +2,7 @@ package slack
import (
"encoding/json"
+ "errors"
)
// Block Objects are also known as Composition Objects
@@ -135,6 +136,20 @@ func (s TextBlockObject) MixedElementType() MixedElementType {
return MixedElementText
}
+// Validate checks if TextBlockObject has valid values
+func (s TextBlockObject) Validate() error {
+ if s.Type != "plain_text" && s.Type != "mrkdwn" {
+ return errors.New("type must be either of plain_text or mrkdwn")
+ }
+
+ // https://github.com/slack-go/slack/issues/881
+ if s.Type == "mrkdwn" && s.Emoji {
+ return errors.New("emoji cannot be true in mrkdown")
+ }
+
+ return nil
+}
+
// NewTextBlockObject returns an instance of a new Text Block Object
func NewTextBlockObject(elementType, text string, emoji, verbatim bool) *TextBlockObject {
return &TextBlockObject{