@@ -31,6 +31,14 @@ var emailRegExp = regexp.MustCompile("`^(?P<name>[a-zA-Z0-9.!#$%&'*+/=?^_ \\x60{
31
31
32
32
var typeNamePrefixRE = regexp .MustCompile (`^\*?([a-zA-Z0-9_]+\.)?` )
33
33
34
+ type SlackAttachmentCreator interface {
35
+ SlackAttachment () slack.Attachment
36
+ }
37
+
38
+ type SlackBlocksCreator interface {
39
+ SlackBlocks () slack.Blocks
40
+ }
41
+
34
42
type notifyTask struct {
35
43
channel string
36
44
@@ -297,7 +305,7 @@ func (n *Notifier) PostLiveNote(obj livenote.Object, opts ...livenote.Option) er
297
305
}
298
306
299
307
var attachment slack.Attachment
300
- if creator , ok := note .Object .(types. SlackAttachmentCreator ); ok {
308
+ if creator , ok := note .Object .(SlackAttachmentCreator ); ok {
301
309
attachment = creator .SlackAttachment ()
302
310
} else {
303
311
return fmt .Errorf ("livenote object does not support types.SlackAttachmentCreator interface" )
@@ -422,7 +430,7 @@ func filterSlackAttachments(args []interface{}) (slackAttachments []slack.Attach
422
430
423
431
slackAttachments = append (slackAttachments , * a )
424
432
425
- case types. SlackAttachmentCreator :
433
+ case SlackAttachmentCreator :
426
434
if firstAttachmentOffset == - 1 {
427
435
firstAttachmentOffset = idx
428
436
}
@@ -471,7 +479,7 @@ func (n *Notifier) NotifyTo(channel string, obj interface{}, args ...interface{}
471
479
case * slack.Attachment :
472
480
opts = append (opts , slack .MsgOptionAttachments (append ([]slack.Attachment {* a }, slackAttachments ... )... ))
473
481
474
- case types. SlackAttachmentCreator :
482
+ case SlackAttachmentCreator :
475
483
// convert object to slack attachment (if supported)
476
484
opts = append (opts , slack .MsgOptionAttachments (append ([]slack.Attachment {a .SlackAttachment ()}, slackAttachments ... )... ))
477
485
0 commit comments