From e0972d8a2a8597ba09ae587f18b58a6419c0523e Mon Sep 17 00:00:00 2001 From: Nefrace Date: Wed, 13 Sep 2023 23:01:58 +0300 Subject: [PATCH] Fixed deleting join message --- kicker/handlers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)