Add ban for photo captions

This commit is contained in:
Rykov7
2024-08-09 17:35:11 +03:00
parent f1979fc030
commit b637abe3ff
3 changed files with 30 additions and 29 deletions
+3 -2
View File
@@ -42,9 +42,10 @@ async def moderate_messages(message: types.Message):
increment(message.chat.id, banned=True)
@bot.message_handler(func=in_caption_spam_list, content_types=["video"], chat_types=["supergroup", "group"])
@bot.edited_message_handler(func=in_caption_spam_list, content_types=["video", "photo", "animation"], chat_types=["supergroup", "group"])
@bot.message_handler(func=in_caption_spam_list, content_types=["video", "photo", "animation"], chat_types=["supergroup", "group"])
async def catch_videos(message: types.Message):
"""Catch offensive videos"""
"""Catch offensive media"""
await bot.delete_message(message.chat.id, message.id)
await bot.ban_chat_member(message.chat.id, message.from_user.id)
increment(message.chat.id, banned=True)
+1 -1
View File
@@ -22,7 +22,7 @@ def in_caption_spam_list(message: types.Message) -> bool:
"""Check for mentioning unwanted words in caption."""
if message.caption and is_ban_words_in_caption(message.caption):
from_user_id, title, from_user_name = message.from_user.id, message.chat.title, message.from_user.first_name
logging.info("!BAN!" + LOG_COMM % (title, from_user_id, from_user_name, message.video.file_name))
logging.info("!BAN CAPTION!" + LOG_COMM % (title, from_user_id, from_user_name, message.video.file_name))
return True
return False