From 4c97531293bb38bf0de56c95eda1554449e49b95 Mon Sep 17 00:00:00 2001 From: nefrace Date: Wed, 18 Jan 2023 22:46:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BE=20=D0=B2=D1=85=D0=BE=D0=B4=D0=B5,=20=D0=B2=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=D0=B5=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicker/handlers.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kicker/handlers.go b/kicker/handlers.go index 6db1f44..dbbbe28 100644 --- a/kicker/handlers.go +++ b/kicker/handlers.go @@ -15,6 +15,10 @@ import ( func userJoined(b *bot, update *tb.Update) error { captcha := captchagen.GenCaptcha() + _, err := b.DeleteMessage(update.Message.Chat.ID, update.Message.ID) + if err != nil { + log.Printf("Can't delete message: %v", err) + } bytes, err := captcha.ToBytes() if err != nil { fmt.Printf("Error creating captcha bytes: %v", bytes) @@ -95,7 +99,22 @@ func checkCaptcha(b *bot, update *tb.Update) error { solved = true b.DeleteMessage(message.Chat.ID, message.ID) b.DeleteMessage(message.Chat.ID, user.CaptchaMessage) - + msg := fmt.Sprintf("Приветствую тебя, *[%s](tg://user?id=%d)* успешно прошёл капчу\\!", EscapeText(tb.MarkdownV2, user.FirstName), user.Id) + options := tb.MessageOptions{ + ParseMode: tb.MarkdownV2, + } + if message.Chat.IsForum { + options.MessageThreadID = int(b.CaptchaTopic) + } + res, err := b.SendMessage(msg, message.Chat.ID, &options) + if err != nil { + log.Printf("Can't send welcome message: %s", err) + } + time.Sleep(time.Second * 10) + _, err = b.DeleteMessage(message.Chat.ID, res.Result.ID) + if err != nil { + log.Printf("Can't delete welcome message: %s", err) + } } } if !solved { -- 2.40.1