from libbot import sync
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import Message, User
from classes.pyroclient import PyroClient
from modules import custom_filters
@Client.on_message(
custom_filters.mode_post
& ~filters.scheduled
& filters.chat(sync.config_get("comments", "posting"))
& filters.reply
& filters.command(["report"], prefixes=["", "/"])
)
async def command_report(app: PyroClient, message: Message):
if (
message.reply_to_message.forward_from_chat.id
!= app.config["posting"]["channel"]
):
return
user = await app.find_user(message.from_user)
await message.reply_text(
app._(
"report_sent",
"message",
locale=user.locale if message.from_user is not None else None,
report_sent = await message.reply_to_message.forward(app.owner)
sender = message.from_user if message.from_user is not None else message.sender_chat
sender_name = sender.first_name if isinstance(sender, User) else sender.title
await report_sent.reply_text(
app._("report_received", "message", locale=user.locale).format(
sender_name, sender.username, sender.id
),
quote=True,