translate logging Russian, add spam word, add deleting Stan's messages

This commit is contained in:
Rykov7
2024-03-08 01:38:15 +03:00
parent d0122a959b
commit 6a9a8c9ba5
3 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -365,7 +365,7 @@ async def handle_invalid_name(message: types.Message):
reply_markup=markup) reply_markup=markup)
warn_user(user_id) warn_user(user_id)
if warnings_count(user_id) >= 3: if warnings_count(user_id) >= 3:
logging.info(f"[MUTED] User {user_id} has been muted for violating 6 rule") logging.info(f"[MUTED] {user_id} заглушен за нарушение правила 6.")
await mute_for_one_day(message.chat.id, user_id) await mute_for_one_day(message.chat.id, user_id)
await bot.delete_message(message.chat.id, message.id) await bot.delete_message(message.chat.id, message.id)
+1 -1
View File
@@ -53,7 +53,7 @@ SPAM = {"me.sv/", "tg.sv/", "goo.by/", "go.sv/", "intim.video/", "uclck.ru/",
'💎', '🔞', '➡️', '💰', '💸', '‼️', '💎', '🔞', '➡️', '💰', '💸', '‼️',
'раб0т', '0плат', 'новый способ заработка', 'криптовалют', 'цифровых валют', 'Binance', 'ByBit', 'раб0т', '0плат', 'новый способ заработка', 'криптовалют', 'цифровых валют', 'Binance', 'ByBit',
'Помогу заработать', 'арбитраж', 'DEX бирж', 'любую девушку', 'прибыль у вaс', 'обучaю быстро', 'Помогу заработать', 'арбитраж', 'DEX бирж', 'любую девушку', 'прибыль у вaс', 'обучaю быстро',
'Предлагаю новый вид заработка', 'межбиржев', 'КУПЮРЫ', 'в неделю выходит до', 'Предлагаю новый вид заработка', 'межбиржев', 'КУПЮРЫ', 'в неделю выходит до', 'soax',
'предложить заработок', 'голые фот', 'интимные фот', 'заработка в крипте', 'Веду набор', 'Идёт набор', 'предложить заработок', 'голые фот', 'интимные фот', 'заработка в крипте', 'Веду набор', 'Идёт набор',
'Доход от', 'Trading', 'P2P', 'Идет набор', '$ в неделю', 'обучаю с нуля', 'доходы для всех', 'Доход от', 'Trading', 'P2P', 'Идет набор', '$ в неделю', 'обучаю с нуля', 'доходы для всех',
'по трейдингу', 'фальшивые рубли', 'зароботку', 'Обучу вас', 'остались курсы', 'Crypt', 'по трейдингу', 'фальшивые рубли', 'зароботку', 'Обучу вас', 'остались курсы', 'Crypt',
+13 -6
View File
@@ -7,6 +7,7 @@ from time import time
from telebot import types from telebot import types
from .constants import LOG_COMM
from .filters import is_white_id from .filters import is_white_id
from .helpers import is_nongrata, short_user_data, has_links from .helpers import is_nongrata, short_user_data, has_links
from .models import all_chat_quotes, add_quote, is_quote_in_chat, delete_quote_in_chat from .models import all_chat_quotes, add_quote, is_quote_in_chat, delete_quote_in_chat
@@ -53,7 +54,7 @@ async def mute_for_one_week(chat_id: int, user_id: int):
async def mute(chat_id, user_id, period): async def mute(chat_id, user_id, period):
logging.info(f"[MUTED] User {user_id} has been muted for: {period} seconds") logging.info(f"[MUTED] {user_id} заглушен на: {period} секунд.")
await bot.restrict_chat_member(chat_id, user_id, until_date=time() + period) await bot.restrict_chat_member(chat_id, user_id, until_date=time() + period)
@@ -63,10 +64,13 @@ async def add_stan_quote(message: types.Message):
quote = message.reply_to_message.text quote = message.reply_to_message.text
if not is_quote_in_chat(quote, message.chat.id): if not is_quote_in_chat(quote, message.chat.id):
add_quote(message.chat.id, quote.replace("\n", " ")) add_quote(message.chat.id, quote.replace("\n", " "))
await bot.send_message(message.chat.id, "➕\n └ " + quote.replace("\n", " "), parse_mode='Markdown') ok_message = await bot.send_message(message.chat.id, "⭐️ Добавил: " + quote, parse_mode='Markdown')
await bot.delete_message(message.chat.id, message.id) await bot.delete_message(message.chat.id, message.id)
await asyncio.sleep(3)
await bot.delete_message(message.chat.id, ok_message.id)
else: else:
await bot.send_message(message.chat.id, f"⛔️ Не добавил, есть токое\n └ {quote}", parse_mode='Markdown') await bot.send_message(message.chat.id, f"⛔️ Не добавил, есть токое: {quote}", parse_mode='Markdown')
logging.info(LOG_COMM % (message.chat.title, message.from_user.id, message.from_user.full_name, message.text))
@bot.message_handler(func=is_white_id, commands=["remove"]) @bot.message_handler(func=is_white_id, commands=["remove"])
@@ -75,10 +79,13 @@ async def remove_stan_quote(message: types.Message):
quote = message.reply_to_message.text quote = message.reply_to_message.text
if is_quote_in_chat(quote, message.chat.id): if is_quote_in_chat(quote, message.chat.id):
delete_quote_in_chat(quote, message.chat.id) delete_quote_in_chat(quote, message.chat.id)
await bot.send_message(message.chat.id, f"➖ \n └ {quote}", parse_mode='Markdown') remove_message = await bot.send_message(message.chat.id, f"🗑 Удалил: {quote}", parse_mode='Markdown')
await bot.delete_message(message.chat.id, message.id) await bot.delete_message(message.chat.id, message.id)
await asyncio.sleep(3)
await bot.delete_message(message.chat.id, remove_message.id)
else: else:
await bot.send_message(message.chat.id, f"⛔️ Нет такого\n └ {quote}", parse_mode='Markdown') await bot.send_message(message.chat.id, f"⛔️ Нет такого: {quote}", parse_mode='Markdown')
logging.info(LOG_COMM % (message.chat.title, message.from_user.id, message.from_user.full_name, message.text))
@bot.message_handler(func=is_nongrata) @bot.message_handler(func=is_nongrata)
@@ -100,7 +107,7 @@ async def check_new_members(message: types.Message):
info['photo'] = more_data.photo.big_file_id info['photo'] = more_data.photo.big_file_id
if info['bio'] and has_links(info['bio']): if info['bio'] and has_links(info['bio']):
await bot.ban_chat_member(message.chat.id, info['id']) await bot.ban_chat_member(message.chat.id, info['id'])
logging.info(f"[BANNED] User {info['full_name']} has url in bio: {info['bio']}") logging.info(f"[BANNED] У {info['full_name']} ссылка в био: {info['bio']}")
else: else:
logging.info(f"[JOINED] {info['full_name']}") logging.info(f"[JOINED] {info['full_name']}")
if message.content_type == "left_chat_member": if message.content_type == "left_chat_member":