dev #43

Merged
profitroll merged 49 commits from dev into master 2023-05-02 14:12:58 +03:00
3 changed files with 49 additions and 0 deletions
Showing only changes of commit 2e7d4aa263 - Show all commits

View File

@ -42,6 +42,7 @@ from modules.callbacks.warnings import *
from modules.handlers.confirmation import *
from modules.handlers.contact import *
from modules.handlers.group_member_update import *
from modules.handlers.group_message import *
from modules.handlers.voice import *
from modules.handlers.welcome import *
from modules.handlers.everything import *

View File

@ -0,0 +1,45 @@
from datetime import datetime
from app import app
from pyrogram import filters
from pyrogram.types import Message
from pyrogram.client import Client
from modules.logging import logWrite
from modules.utils import configGet, locale
from modules.database import col_warnings
from modules import custom_filters
from polyglot.detect import Detector
@app.on_message(
custom_filters.enabled_general
& ~filters.scheduled
& filters.chat(configGet("users", "groups"))
)
async def msg_destination_group(app: Client, msg: Message):
if msg.text is not None:
lang = Detector(msg.text, quiet=True).language
if lang.code == "ru":
logWrite(
f"Message '{msg.text}' from {msg.from_user.first_name} ({msg.from_user.id}) is fucking russian!!! [confidence {lang.confidence}]"
)
else:
logWrite(
f"Message '{msg.text}' from {msg.from_user.first_name} ({msg.from_user.id}) is written {lang.code} [confidence {lang.confidence}]"
)
return
elif msg.caption is not None:
lang = Detector(msg.caption, quiet=True).language
if lang.code == "ru":
logWrite(
f"Message '{msg.caption}' from {msg.from_user.first_name} ({msg.from_user.id}) is fucking russian!!! [confidence {lang.confidence}]"
)
else:
logWrite(
f"Message '{msg.caption}' from {msg.from_user.first_name} ({msg.from_user.id}) is written {lang.code} [confidence {lang.confidence}]"
)
return
else:
logWrite(
f"Message from {msg.from_user.first_name} ({msg.from_user.id}) has no text in it."
)
return

View File

@ -5,6 +5,9 @@ convopyro==0.5
fastapi~=0.95.0
ftfy~=6.1.1
psutil==5.9.4
polyglot~=16.7.4
PyICU==2.10.2
pycld2==0.41
pymongo==4.3.3
Pyrogram~=2.0.102
python_dateutil==2.8.2