41 lines
1.8 KiB
Python
41 lines
1.8 KiB
Python
from app import app
|
|
from pyrogram import filters
|
|
from pyrogram.types import Message, ForceReply
|
|
from pyrogram.client import Client
|
|
from classes.holo_user import HoloUser, UserInvalidError, UserNotFoundError
|
|
from modules.logging import logWrite
|
|
from modules.utils import locale
|
|
from modules.database import col_spoilers
|
|
from modules import custom_filters
|
|
|
|
# Spoiler command ==============================================================================================================
|
|
@app.on_message(custom_filters.member & ~filters.scheduled & filters.private & filters.command(["spoiler"], prefixes=["/"]))
|
|
async def cmd_spoiler(app: Client, msg: Message):
|
|
|
|
try:
|
|
holo_user = HoloUser(msg.from_user)
|
|
except (UserInvalidError, UserNotFoundError):
|
|
return
|
|
|
|
if holo_user.application_state()[0] != "fill" and holo_user.sponsorship_state()[0] != "fill":
|
|
|
|
if col_spoilers.find_one( {"user": msg.from_user.id, "completed": False} ) is None:
|
|
|
|
col_spoilers.insert_one(
|
|
{
|
|
"user": msg.from_user.id,
|
|
"completed": False,
|
|
"description": None,
|
|
"photo": None,
|
|
"video": None,
|
|
"animation": None,
|
|
"text": None
|
|
}
|
|
)
|
|
|
|
await msg.reply_text(locale("spoiler_started", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("spoiler_content", "force_reply", locale=msg.from_user)))
|
|
logWrite(f"User {msg.from_user.id} started creating new spoiler")
|
|
|
|
else:
|
|
await msg.reply_text(locale("spoiler_unfinished", "message", locale=msg.from_user))
|
|
# ============================================================================================================================== |