diff --git a/kicker/handlers.go b/kicker/handlers.go index 8149706..1f948c0 100644 --- a/kicker/handlers.go +++ b/kicker/handlers.go @@ -22,6 +22,10 @@ func userJoined(b *bot, update *echotron.Update) error { store := tongo.NewStore[db.User](Client) usr := update.Message.NewChatMembers[0] message := update.Message + _, err := b.DeleteMessage(message.Chat.ID, message.ID) + if err != nil { + log.Printf("Can't delete message: %v", err) + } user, err := store.GetOne(ctx, tongo.E("chat_id", update.ChatID()), tongo.E("user_id", usr.ID)) var captcha *captchagen.Captcha if err != nil { @@ -47,10 +51,6 @@ func userJoined(b *bot, update *echotron.Update) error { if captcha == nil { return nil } - _, err = b.DeleteMessage(message.Chat.ID, message.ID) - if err != nil { - log.Printf("Can't delete message: %v", err) - } bytes, err := captcha.ToBytes() if err != nil { log.Printf("Error creating captcha bytes: %v", bytes)