mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-27 09:15:15 +00:00
telegram: add callback handler
This commit is contained in:
parent
a3cc101c79
commit
68a544383a
|
@ -97,6 +97,10 @@ func (it *Interact) getNextState(session Session, currentState State) (nextState
|
|||
return session.GetOriginState(), final
|
||||
}
|
||||
|
||||
func (it *Interact) handleCallback(session Session, payload string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (it *Interact) handleResponse(session Session, text string, ctxObjects ...interface{}) error {
|
||||
// We only need response when executing a command
|
||||
switch session.GetState() {
|
||||
|
|
|
@ -119,6 +119,15 @@ func (tm *Telegram) SetTextMessageResponder(textMessageResponder Responder) {
|
|||
}
|
||||
|
||||
func (tm *Telegram) Start(context.Context) {
|
||||
tm.Bot.Handle(telebot.OnCallback, func(c *telebot.Callback) {
|
||||
log.Infof("[telegram] onCallback: %+v", c)
|
||||
if c.Message != nil {
|
||||
session := tm.loadSession(c.Message)
|
||||
_ = session
|
||||
}
|
||||
// c.Sender
|
||||
})
|
||||
|
||||
tm.Bot.Handle(telebot.OnText, func(m *telebot.Message) {
|
||||
log.Infof("[telegram] onText: %+v", m)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user