mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
interact: use RemoveKeyboard from interact.KeyboardController
This commit is contained in:
parent
ef84742eb7
commit
7b572120a1
|
@ -92,12 +92,15 @@ func (m *PositionInteraction) Commands(i *interact.Interact) {
|
|||
case "yes":
|
||||
m.closePositionTask.confirmed = true
|
||||
reply.Message(fmt.Sprintf("Your %s position is closed", m.closePositionTask.symbol))
|
||||
reply.RemoveKeyboard()
|
||||
|
||||
default:
|
||||
|
||||
}
|
||||
|
||||
// call position close
|
||||
if kc, ok := reply.(interact.KeyboardController); ok {
|
||||
kc.RemoveKeyboard()
|
||||
}
|
||||
|
||||
// reply result
|
||||
return nil
|
||||
|
|
|
@ -127,7 +127,10 @@ func (it *CoreInteraction) Commands(i *interact.Interact) {
|
|||
}
|
||||
}
|
||||
|
||||
reply.RemoveKeyboard()
|
||||
if kc, ok := reply.(interact.KeyboardController) ; ok {
|
||||
kc.RemoveKeyboard()
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
@ -172,7 +175,9 @@ func (it *CoreInteraction) Commands(i *interact.Interact) {
|
|||
|
||||
if position.Base == 0 {
|
||||
reply.Message("No opened position")
|
||||
reply.RemoveKeyboard()
|
||||
if kc, ok := reply.(interact.KeyboardController) ; ok {
|
||||
kc.RemoveKeyboard()
|
||||
}
|
||||
return fmt.Errorf("no opened position")
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +196,9 @@ func (it *CoreInteraction) Commands(i *interact.Interact) {
|
|||
return err
|
||||
}
|
||||
|
||||
reply.RemoveKeyboard()
|
||||
if kc, ok := reply.(interact.KeyboardController) ; ok {
|
||||
kc.RemoveKeyboard()
|
||||
}
|
||||
|
||||
err = it.closePositionContext.closer.ClosePosition(context.Background(), percentage)
|
||||
if err != nil {
|
||||
|
|
|
@ -41,9 +41,6 @@ type Reply interface {
|
|||
// Choose(prompt string, options ...Option)
|
||||
// Confirm shows the confirm dialog or confirm button in the user interface
|
||||
// Confirm(prompt string)
|
||||
|
||||
// RemoveKeyboard hides the keyboard from the client user interface
|
||||
RemoveKeyboard()
|
||||
}
|
||||
|
||||
// KeyboardController is used when messenger supports keyboard controls
|
||||
|
|
Loading…
Reference in New Issue
Block a user