deposit2transfer: pass customized channel

This commit is contained in:
c9s 2024-11-12 15:49:29 +08:00
parent 9e2cb4bd7f
commit f37fab08a0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -42,6 +42,7 @@ func init() {
} }
type SlackAlert struct { type SlackAlert struct {
Channel string `json:"channel"`
Mentions []string `json:"mentions"` Mentions []string `json:"mentions"`
} }
@ -213,6 +214,7 @@ func (s *Strategy) checkDeposits(ctx context.Context) {
if s.SlackAlert != nil { if s.SlackAlert != nil {
bbgo.PostLiveNote(&d, bbgo.PostLiveNote(&d,
livenote.Channel(s.SlackAlert.Channel),
livenote.Comment(fmt.Sprintf("Transferring deposit asset %s %s into the margin account", amount.String(), d.Asset)), livenote.Comment(fmt.Sprintf("Transferring deposit asset %s %s into the margin account", amount.String(), d.Asset)),
) )
} }
@ -225,6 +227,7 @@ func (s *Strategy) checkDeposits(ctx context.Context) {
if s.SlackAlert != nil { if s.SlackAlert != nil {
bbgo.PostLiveNote(&d, bbgo.PostLiveNote(&d,
livenote.Channel(s.SlackAlert.Channel),
livenote.Comment(fmt.Sprintf("Margin account transfer error: %+v", err2)), livenote.Comment(fmt.Sprintf("Margin account transfer error: %+v", err2)),
) )
} }
@ -238,6 +241,7 @@ func (s *Strategy) addWatchingDeposit(deposit types.Deposit) {
if s.SlackAlert != nil { if s.SlackAlert != nil {
bbgo.PostLiveNote(&deposit, bbgo.PostLiveNote(&deposit,
livenote.Channel(s.SlackAlert.Channel),
livenote.CompareObject(true), livenote.CompareObject(true),
livenote.OneTimeMention(s.SlackAlert.Mentions...), livenote.OneTimeMention(s.SlackAlert.Mentions...),
) )