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,15 +145,13 @@ func (it *CoreInteraction) Commands(i *interact.Interact) {
}
position := reader.CurrentPosition()
if position != nil {
reply.Send("Your current position:")
reply.Send(position.PlainText())
if position.Base.IsZero() {
if position == nil || 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 {
kc.RemoveKeyboard()