From 8a1cce087df75fe2c7c067c8685a66ff696c189d Mon Sep 17 00:00:00 2001 From: Lennard Brinkhaus Date: Fri, 15 Nov 2024 21:10:09 +0100 Subject: [PATCH] feat: more bot variants and ignore leave message if admin deletes message by himself --- channels/verifiychecker.go | 29 +++++++++++++++-------------- telegram/routines/joinchecker.go | 8 ++++++++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/channels/verifiychecker.go b/channels/verifiychecker.go index 76b7731..778f76a 100644 --- a/channels/verifiychecker.go +++ b/channels/verifiychecker.go @@ -78,13 +78,23 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group kickMessage := groups[user.GroupID].UserKickMessage kickMessage = message.ReplaceMessage(kickMessage, member.User, groups[user.GroupID]) - msg := tgbotapi.NewMessage(user.GroupID, kickMessage) - msg.ParseMode = "Markdown" - _, err = bot.Send(msg) + _, err = bot.DeleteMessage(tgbotapi.DeleteMessageConfig{ + ChatID: user.GroupID, + MessageID: user.MessageID, + }) if err != nil { - log.Println("problem while send a message in the verifier:") - log.Printf("Problem Error Message: %v", err) + log.Println("problem while deleting a message in the verifier:") + log.Println(err) + } else { + msg := tgbotapi.NewMessage(user.GroupID, kickMessage) + msg.ParseMode = "Markdown" + _, err = bot.Send(msg) + + if err != nil { + log.Println("problem while send a message in the verifier:") + log.Printf("Problem Error Message: %v", err) + } } kickConfig := tgbotapi.KickChatMemberConfig{ @@ -105,15 +115,6 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group } } - _, err = bot.DeleteMessage(tgbotapi.DeleteMessageConfig{ - ChatID: user.GroupID, - MessageID: user.MessageID, - }) - - if err != nil { - log.Println("problem while deleting a message in the verifier:") - log.Println(err) - } } } diff --git a/telegram/routines/joinchecker.go b/telegram/routines/joinchecker.go index 0de7465..1fd0399 100644 --- a/telegram/routines/joinchecker.go +++ b/telegram/routines/joinchecker.go @@ -96,5 +96,13 @@ func hasDrugNames(name string) bool { strings.Contains(name, "mdma") || strings.Contains(name, "xanax") || strings.Contains(name, "😘") || + strings.Contains(name, "𝗗𝗘𝗔𝗟𝗘𝗥") || + strings.Contains(name, "𝗪𝗘𝗘𝗗") || + strings.Contains(name, "🥰") || + strings.Contains(name, "😍") || + strings.Contains(name, "COKE") || + strings.Contains(name, "💊") || + strings.Contains(name, "KOKA") || + strings.Contains(name, "WEED") || strings.Contains(name, "💊") }