💋 Abusive Word Detector in TPY [TBC]
💹 Commands:- *
✅ TPY:-
# List of abusive words
abusive_words = ["fuck", "lamao", "bc", "madarchod", "bc", "bhenkalowda"]
def contains_abusive_word(message):
message_lower = message.lower()
for word in abusive_words:
if word in message_lower:
return True
return False
if contains_abusive_word(message.text):
bot.sendChatAction(chat_id=message.chat.id, action="typing")
delete_url = f"https://api.telegram.org/bot{Bot.info().token}/deleteMessage?chat_id={message.chat.id}&message_id={message.message_id}"
delete_response = HTTP.get(delete_url)
if delete_response.status_code == 200:
username = message.from_user.username
if username:
notification_text = f"🚫 @{username} used abusive language and the message has been deleted. 🗑️"
else:
notification_text = "🚫 The user used abusive language and the message has been deleted. 🗑️"
bot.sendMessage(chat_id=message.chat.id, text=notification_text)
else:
bot.sendMessage(chat_id=message.chat.id, text="❌ Failed to delete the message. Please try again later.")
📌 Note:- Add Words which U want to ban In Chat in Array Add unlimited Words add Words in list Of Words.
💹 Commands:- *
✅ TPY:-
# List of abusive words
abusive_words = ["fuck", "lamao", "bc", "madarchod", "bc", "bhenkalowda"]
def contains_abusive_word(message):
message_lower = message.lower()
for word in abusive_words:
if word in message_lower:
return True
return False
if contains_abusive_word(message.text):
bot.sendChatAction(chat_id=message.chat.id, action="typing")
delete_url = f"https://api.telegram.org/bot{Bot.info().token}/deleteMessage?chat_id={message.chat.id}&message_id={message.message_id}"
delete_response = HTTP.get(delete_url)
if delete_response.status_code == 200:
username = message.from_user.username
if username:
notification_text = f"🚫 @{username} used abusive language and the message has been deleted. 🗑️"
else:
notification_text = "🚫 The user used abusive language and the message has been deleted. 🗑️"
bot.sendMessage(chat_id=message.chat.id, text=notification_text)
else:
bot.sendMessage(chat_id=message.chat.id, text="❌ Failed to delete the message. Please try again later.")
📌 Note:- Add Words which U want to ban In Chat in Array Add unlimited Words add Words in list Of Words.