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,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)
}
}
}

View File

@ -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, "💊")
}