From 838efe8295d61c371d63b40472dd9a429ab7b857 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 15 Nov 2024 10:41:23 +0800 Subject: [PATCH] bbgo: add slack enable interaction config --- pkg/bbgo/config.go | 7 ++++--- pkg/bbgo/environment.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/bbgo/config.go b/pkg/bbgo/config.go index 35aad9822..c71b17a55 100644 --- a/pkg/bbgo/config.go +++ b/pkg/bbgo/config.go @@ -63,9 +63,10 @@ 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"` + DefaultChannel string `json:"defaultChannel,omitempty" yaml:"defaultChannel,omitempty"` + ErrorChannel string `json:"errorChannel,omitempty" yaml:"errorChannel,omitempty"` + QueueSize int `json:"queueSize,omitempty" yaml:"queueSize,omitempty"` + EnableInteraction bool `json:"enableInteraction,omitempty" yaml:"enableInteraction,omitempty"` } type SlackNotificationRouting struct { diff --git a/pkg/bbgo/environment.go b/pkg/bbgo/environment.go index cbd90178e..e94e1251f 100644 --- a/pkg/bbgo/environment.go +++ b/pkg/bbgo/environment.go @@ -871,7 +871,7 @@ func (environ *Environment) setupSlack(userConfig *Config, slackToken string, pe var notifier = slacknotifier.New(client, conf.DefaultChannel, notifierOpts...) Notification.AddNotifier(notifier) - if hasSlackAppToken { + if hasSlackAppToken && conf.EnableInteraction { // allocate a store, so that we can save the chatID for the owner var messenger = interact.NewSlack(client) var sessions = interact.SlackSessionMap{}