Skip to content

Commit

Permalink
fix(callback): add callback handler to dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisin0 committed Jul 17, 2024
1 parent 0058a1e commit d89f68b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ func CbCommand(bot *gotgbot.Bot, ctx *ext.Context) error {
fmt.Println(err)
}

return nil
return ext.EndGroups
}
3 changes: 3 additions & 0 deletions plugins/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/PaulSonOfLars/gotgbot/v2"
"github.com/PaulSonOfLars/gotgbot/v2/ext"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers/filters/callbackquery"
)

var Dispatcher *ext.Dispatcher = ext.NewDispatcher(&ext.DispatcherOpts{
Expand All @@ -32,6 +33,8 @@ func init() {
Dispatcher.AddHandlerToGroup(handlers.NewCommand("start", Start), commandHandlerGroup)
Dispatcher.AddHandlerToGroup(handlers.NewCommand("batch", Batch), commandHandlerGroup)

Dispatcher.AddHandlerToGroup(handlers.NewCallback(callbackquery.Prefix("cmd_"), CbCommand), callbackHandlerGroup)

// Static Commands.
Dispatcher.AddHandlerToGroup(handlers.NewMessage(allCommand, CommandHandler), commandHandlerGroup)
}
Expand Down

0 comments on commit d89f68b

Please sign in to comment.