Added audio support for spoilers

This commit is contained in:
2023-01-10 12:11:29 +01:00
parent b67b1daf7c
commit 00a408ac6c
4 changed files with 16 additions and 3 deletions

View File

@@ -89,7 +89,7 @@ async def any_stage(app: Client, msg: Message):
await msg.reply_text(locale("spoiler_send_description", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("spoiler_description", "force_reply", locale=msg.from_user)))
return
if spoiler["description"] is None and (spoiler["photo"] is None and spoiler["video"] is None and spoiler["animation"] is None and spoiler["text"] is None):
if spoiler["description"] is None and (spoiler["photo"] is None and spoiler["video"] is None and spoiler["audio"] is None and spoiler["animation"] is None and spoiler["text"] is None):
# for lc in all_locales("spoiler_description", "keyboard"):
# if msg.text == lc[-1][0]:
@@ -115,7 +115,12 @@ async def any_stage(app: Client, msg: Message):
if msg.video is not None:
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"video": msg.video.file_id, "caption": msg.caption, "completed": True}} )
logWrite(f"Adding video with id {msg.video.file_id} to {msg.from_user.id}'s spoiler")
logWrite(f"Adding audio with id {msg.video.file_id} to {msg.from_user.id}'s spoiler")
ready = True
if msg.audio is not None:
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"audio": msg.audio.file_id, "caption": msg.caption, "completed": True}} )
logWrite(f"Adding video with id {msg.audio.file_id} to {msg.from_user.id}'s spoiler")
ready = True
if msg.animation is not None:
@@ -128,7 +133,7 @@ async def any_stage(app: Client, msg: Message):
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 spoiler["photo"] is None and spoiler["video"] is None and spoiler["audio"] 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")