mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 19:13:52 +00:00
bbgo: load slack notifier queue size from config
This commit is contained in:
parent
2eca15bb61
commit
a9c51e824d
|
@ -65,6 +65,7 @@ func (m *ExchangeStrategyMount) Map() (map[string]interface{}, error) {
|
|||
type SlackNotification struct {
|
||||
DefaultChannel string `json:"defaultChannel,omitempty" yaml:"defaultChannel,omitempty"`
|
||||
ErrorChannel string `json:"errorChannel,omitempty" yaml:"errorChannel,omitempty"`
|
||||
QueueSize int `json:"queueSize,omitempty" yaml:"queueSize,omitempty"`
|
||||
}
|
||||
|
||||
type SlackNotificationRouting struct {
|
||||
|
|
|
@ -862,7 +862,12 @@ func (environ *Environment) setupSlack(userConfig *Config, slackToken string, pe
|
|||
|
||||
var client = slack.New(slackToken, slackOpts...)
|
||||
|
||||
var notifier = slacknotifier.New(client, conf.DefaultChannel)
|
||||
var notifierOpts []slacknotifier.NotifyOption
|
||||
if conf.QueueSize > 0 {
|
||||
notifierOpts = append(notifierOpts, slacknotifier.OptionQueueSize(conf.QueueSize))
|
||||
}
|
||||
|
||||
var notifier = slacknotifier.New(client, conf.DefaultChannel, notifierOpts...)
|
||||
Notification.AddNotifier(notifier)
|
||||
|
||||
// allocate a store, so that we can save the chatID for the owner
|
||||
|
|
Loading…
Reference in New Issue
Block a user