Added documents support for spoilers
This commit is contained in:
@@ -30,6 +30,7 @@ async def cmd_spoiler(app: Client, msg: Message):
|
||||
"photo": None,
|
||||
"video": None,
|
||||
"animation": None,
|
||||
"document": None,
|
||||
"caption": None,
|
||||
"text": None
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ async def cmd_start(app: Client, msg: Message):
|
||||
await msg.reply_video(spoiler["video"], caption=spoiler["caption"])
|
||||
if spoiler["animation"] is not None:
|
||||
await msg.reply_animation(spoiler["animation"], caption=spoiler["caption"])
|
||||
if spoiler["document"] is not None:
|
||||
await msg.reply_document(spoiler["document"], caption=spoiler["caption"])
|
||||
if spoiler["text"] is not None:
|
||||
await msg.reply_text(spoiler["text"])
|
||||
except InvalidId:
|
||||
|
@@ -121,7 +121,12 @@ async def any_stage(app: Client, msg: Message):
|
||||
logWrite(f"Adding animation with id {msg.animation.file_id} to {msg.from_user.id}'s spoiler")
|
||||
ready = True
|
||||
|
||||
if spoiler["photo"] is None and spoiler["video"] is None and spoiler["animation"] is None and spoiler["text"] is None:
|
||||
if msg.document is not None:
|
||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"document": msg.document.file_id, "caption": msg.caption, "completed": True}} )
|
||||
logWrite(f"Adding document with id {msg.document.file_id} to {msg.from_user.id}'s spoiler")
|
||||
ready = True
|
||||
|
||||
if spoiler["photo"] is None and spoiler["video"] is None and spoiler["animation"] is None and spoiler["document"] is None and spoiler["text"] is None:
|
||||
if msg.text is not None:
|
||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"text": msg.text, "completed": True}} )
|
||||
logWrite(f"Adding text '{msg.text}' to {msg.from_user.id}'s spoiler")
|
||||
|
Reference in New Issue
Block a user