Tracking down mysterious refusal to handle commands.
This commit is contained in:
parent
3f91c9f3bf
commit
43d3cdc508
2 changed files with 10 additions and 2 deletions
|
|
@ -282,8 +282,9 @@ func (b *bot) SetWebhook(ctx context.Context, conf *settings.Settings) (err erro
|
|||
}
|
||||
fmt.Println("webhook info:", info)
|
||||
err = b.tgbot.SetWebhook(b.ctx, &telego.SetWebhookParams{
|
||||
URL: b.settings.Service.Webhook.URI,
|
||||
SecretToken: b.tgbot.SecretToken(),
|
||||
URL: b.settings.Service.Webhook.URI,
|
||||
AllowedUpdates: []string{"message", "edited_message", "callback_query"},
|
||||
SecretToken: b.tgbot.SecretToken(),
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -304,6 +305,11 @@ func (b *bot) SetWebhook(ctx context.Context, conf *settings.Settings) (err erro
|
|||
return
|
||||
}
|
||||
|
||||
b.handler.HandleMessage(func(ctx *th.Context, message telego.Message) error {
|
||||
fmt.Println("received raw message:", message.Text)
|
||||
return nil
|
||||
})
|
||||
|
||||
go func() {
|
||||
_ = http.ListenAndServe(
|
||||
conf.Service.Webhook.ListenAddr(),
|
||||
|
|
@ -317,6 +323,7 @@ func (b *bot) Run() error {
|
|||
fmt.Println("bot.Run()")
|
||||
defer func() {
|
||||
b.handler.Stop()
|
||||
fmt.Println("handler.Stop()")
|
||||
b.cancel()
|
||||
}()
|
||||
return b.handler.Start()
|
||||
|
|
|
|||
Loading…
Reference in a new issue