replace trolling.py to bot.py

This commit is contained in:
Rykov7
2022-11-30 21:28:03 +03:00
parent eb99288896
commit 4fc2417ec2
3 changed files with 33 additions and 39 deletions
+32 -4
View File
@@ -3,9 +3,9 @@ from datetime import datetime as dt
from flask import Flask, request, abort
from telebot import types
import logging
from urllib import parse
from . import reminder
from . import trolling
from . import admin
from . import report
from .config import bot, URL_RX, ALLOWED_WORDS, ADMIN_ID, TOKEN, PYTHONCHATRU, WHITEUN, WHITEIDS
@@ -31,9 +31,6 @@ zen_rows = ['Beautiful is better than ugly.', 'Explicit is better than implicit.
'If the implementation is easy to explain, it may be a good idea.',
"Namespaces are one honking great idea — let's do more of those!"]
if trolling:
pass
def check_spam_list(type_message: types.Message) -> bool:
""" Check for mentioning unwanted persons in text. """
@@ -241,6 +238,37 @@ def check_chat(message: types.Message):
return True
@bot.message_handler(commands=['tsya'])
def send_tsya_link(message: types.Message):
""" тся/ться """
link = '<a href="https://tsya.ru/">-тся/-ться</a>'
if message.reply_to_message:
bot.reply_to(message.reply_to_message, link, parse_mode='HTML', disable_web_page_preview=True)
@bot.message_handler(commands=['g'])
def google_it(message: types.Message):
""" Google it! """
if message.reply_to_message.text:
search = parse.quote_plus(message.reply_to_message.text)
bot.reply_to(message.reply_to_message, f"https://www.google.ru/search?q={search}", parse_mode='HTML',
disable_web_page_preview=True)
def check_unwanted_list(type_message: types.Message) -> bool:
""" Check for bloggers. """
unwanted_phrases = ['дудар', 'хауди', 'dudar']
for phrase in unwanted_phrases:
if phrase in type_message.text.casefold():
return True
@bot.message_handler(func=check_unwanted_list)
def unwanted_mentions(message: types.Message):
""" Reply to unwanted mentions. """
bot.reply_to(message, f'У нас таких не любят! 🥴', parse_mode='HTML')
@bot.message_handler(func=check_chat, content_types=['text', 'sticker', 'photo', 'animation', 'video',
'audio', 'document'])
def unwanted_mentions(message: types.Message):