You've already forked grok
log whole update when received
This commit is contained in:
6
main.go
6
main.go
@@ -73,11 +73,11 @@ func (a *App) handleMessage(ctx context.Context, msg *tgbotapi.Message) error {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
question := msg.Text[len("@grok"):]
|
||||
question := msg.Text[len("@grok "):]
|
||||
|
||||
select {
|
||||
case a.sema <- struct{}{}:
|
||||
@@ -122,7 +122,7 @@ func (a *App) HandleUpdates(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if upd.Message != nil {
|
||||
a.log.Info("new message", "chat", upd.Message.Chat)
|
||||
a.log.Info("new message", "update", upd)
|
||||
go func() {
|
||||
if err := a.handleMessage(ctx, upd.Message); err != nil {
|
||||
a.log.Error("handling message", "msg", upd.Message, "err", err)
|
||||
|
||||
Reference in New Issue
Block a user