diff --git a/src/commands.py b/src/commands.py index fbd3918..ff0ab85 100644 --- a/src/commands.py +++ b/src/commands.py @@ -44,7 +44,7 @@ async def moderate_messages(message: types.Message): @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): +async def catch_media(message: types.Message): """Catch offensive media""" await bot.delete_message(message.chat.id, message.id) await bot.ban_chat_member(message.chat.id, message.from_user.id) diff --git a/src/filters.py b/src/filters.py index 7e749b0..b8c3aa1 100644 --- a/src/filters.py +++ b/src/filters.py @@ -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 CAPTION!" + 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.caption)) return True return False diff --git a/src/stan.py b/src/stan.py index 8a44740..ca12567 100644 --- a/src/stan.py +++ b/src/stan.py @@ -101,7 +101,8 @@ async def add_spam_handler(message: types.Message): await bot.delete_message(message.chat.id, ok_message.id) logging.info(LOG_COMM % (message.chat.title, message.from_user.id, message.from_user.full_name, f'[SPAM] {message.reply_to_message.text}')) else: - await bot.send_message(message.chat.id, f"⛔️🤬 Не добавил, есть такое в спаме: {quote}", parse_mode='Markdown') + no_message = await bot.send_message(message.chat.id, f"⛔️🤬 Не добавил, есть такое в спаме: {quote}", parse_mode='Markdown') + await bot.delete_message(message.chat.id, no_message.id) @bot.message_handler(func=is_white_id, commands=["info"])