log whole update when received

This commit is contained in:
2026-02-01 17:49:24 +03:00
parent 0bb11c3bd7
commit ff79cfd786

View File

@@ -73,11 +73,11 @@ func (a *App) handleMessage(ctx context.Context, msg *tgbotapi.Message) error {
} }
chatID := msg.Chat.ID chatID := msg.Chat.ID
if chatID != a.config.ChatID || !strings.HasPrefix(msg.Text, "@grok") { if chatID != a.config.ChatID || !strings.HasPrefix(msg.Text, "@grok ") {
return nil return nil
} }
question := msg.Text[len("@grok"):] question := msg.Text[len("@grok "):]
select { select {
case a.sema <- struct{}{}: case a.sema <- struct{}{}:
@@ -122,7 +122,7 @@ func (a *App) HandleUpdates(ctx context.Context) error {
} }
if upd.Message != nil { if upd.Message != nil {
a.log.Info("new message", "chat", upd.Message.Chat) a.log.Info("new message", "update", upd)
go func() { go func() {
if err := a.handleMessage(ctx, upd.Message); err != nil { if err := a.handleMessage(ctx, upd.Message); err != nil {
a.log.Error("handling message", "msg", upd.Message, "err", err) a.log.Error("handling message", "msg", upd.Message, "err", err)