mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
fix slack attachment rendering
This commit is contained in:
parent
130407191a
commit
65f5a75bf1
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"github.com/c9s/bbgo/pkg/bbgo/types"
|
||||
"github.com/c9s/bbgo/pkg/slack/slackstyle"
|
||||
"github.com/c9s/bbgo/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/slack-go/slack"
|
||||
|
@ -20,6 +19,10 @@ type NullNotifier struct{}
|
|||
func (n *NullNotifier) Notify(format string, args ...interface{}) {
|
||||
}
|
||||
|
||||
type SlackAttachmentCreator interface {
|
||||
SlackAttachment() slack.Attachment
|
||||
}
|
||||
|
||||
type SlackNotifier struct {
|
||||
Slack *slack.Client
|
||||
|
||||
|
@ -39,12 +42,14 @@ func (t *SlackNotifier) Notify(format string, args ...interface{}) {
|
|||
if slackArgsStartIdx == -1 {
|
||||
slackArgsStartIdx = idx
|
||||
}
|
||||
|
||||
slackAttachments = append(slackAttachments, a)
|
||||
|
||||
case slackstyle.SlackAttachmentCreator:
|
||||
case SlackAttachmentCreator:
|
||||
if slackArgsStartIdx == -1 {
|
||||
slackArgsStartIdx = idx
|
||||
}
|
||||
|
||||
slackAttachments = append(slackAttachments, a.SlackAttachment())
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package slackstyle
|
||||
|
||||
import "github.com/slack-go/slack"
|
||||
|
||||
const Green = "#228B22"
|
||||
const Red = "#800000"
|
||||
|
||||
|
@ -14,7 +12,4 @@ func TrendIcon(trend int) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type SlackAttachmentCreator interface {
|
||||
SlackAttachment() slack.Attachment
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user