dev #43
@ -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 *
|
||||
|
45
modules/handlers/group_message.py
Normal file
45
modules/handlers/group_message.py
Normal 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
|
@ -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
|
||||
|
Reference in New Issue
Block a user