feat: more bot variants and ignore leave message if admin deletes message by himself

This commit is contained in:
Lennard Brinkhaus 2024-11-15 21:10:09 +01:00
parent c8a751b468
commit 8a1cce087d
2 changed files with 23 additions and 14 deletions

View File

@ -78,6 +78,15 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group
kickMessage := groups[user.GroupID].UserKickMessage kickMessage := groups[user.GroupID].UserKickMessage
kickMessage = message.ReplaceMessage(kickMessage, member.User, groups[user.GroupID]) kickMessage = message.ReplaceMessage(kickMessage, member.User, groups[user.GroupID])
_, 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)
} else {
msg := tgbotapi.NewMessage(user.GroupID, kickMessage) msg := tgbotapi.NewMessage(user.GroupID, kickMessage)
msg.ParseMode = "Markdown" msg.ParseMode = "Markdown"
_, err = bot.Send(msg) _, err = bot.Send(msg)
@ -86,6 +95,7 @@ func CheckUnverifiedUser(ticker *time.Ticker, quitChannel <-chan struct{}, group
log.Println("problem while send a message in the verifier:") log.Println("problem while send a message in the verifier:")
log.Printf("Problem Error Message: %v", err) log.Printf("Problem Error Message: %v", err)
} }
}
kickConfig := tgbotapi.KickChatMemberConfig{ kickConfig := tgbotapi.KickChatMemberConfig{
ChatMemberConfig: tgbotapi.ChatMemberConfig{ ChatMemberConfig: tgbotapi.ChatMemberConfig{
@ -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)
}
} }
} }

View File

@ -96,5 +96,13 @@ func hasDrugNames(name string) bool {
strings.Contains(name, "mdma") || strings.Contains(name, "mdma") ||
strings.Contains(name, "xanax") || strings.Contains(name, "xanax") ||
strings.Contains(name, "😘") || 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, "💊") strings.Contains(name, "💊")
} }