bbgo: fix telegram message error, there must be one message to send

This commit is contained in:
c9s 2022-09-14 02:51:07 +08:00
parent 53059824a6
commit 1d1ec12417
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -145,16 +145,14 @@ func (it *CoreInteraction) Commands(i *interact.Interact) {
} }
position := reader.CurrentPosition() position := reader.CurrentPosition()
if position != nil { if position == nil || position.Base.IsZero() {
reply.Send("Your current position:") reply.Message(fmt.Sprintf("Strategy %q has no opened position", signature))
reply.Send(position.PlainText()) return fmt.Errorf("strategy %T has no opened position", strategy)
if position.Base.IsZero() {
reply.Message(fmt.Sprintf("Strategy %q has no opened position", signature))
return fmt.Errorf("strategy %T has no opened position", strategy)
}
} }
reply.Send("Your current position:")
reply.Message(position.PlainText())
if kc, ok := reply.(interact.KeyboardController); ok { if kc, ok := reply.(interact.KeyboardController); ok {
kc.RemoveKeyboard() kc.RemoveKeyboard()
} }