diff --git a/modules/commands/spoiler.py b/modules/commands/spoiler.py index 3f0e5e7..48b203e 100644 --- a/modules/commands/spoiler.py +++ b/modules/commands/spoiler.py @@ -30,6 +30,7 @@ async def cmd_spoiler(app: Client, msg: Message): "description": None, "photo": None, "video": None, + "audio": None, "animation": None, "document": None, "caption": None, diff --git a/modules/commands/start.py b/modules/commands/start.py index 55d42ab..85b8e0c 100644 --- a/modules/commands/start.py +++ b/modules/commands/start.py @@ -36,6 +36,8 @@ async def cmd_start(app: Client, msg: Message): await msg.reply_cached_media(spoiler["photo"], caption=spoiler["caption"]) if spoiler["video"] is not None: await msg.reply_cached_media(spoiler["video"], caption=spoiler["caption"]) + if spoiler["audio"] is not None: + await msg.reply_cached_media(spoiler["audio"], caption=spoiler["caption"]) if spoiler["animation"] is not None: await msg.reply_cached_media(spoiler["animation"], caption=spoiler["caption"]) if spoiler["document"] is not None: diff --git a/modules/handlers/everything.py b/modules/handlers/everything.py index 6270e8e..78d3fc3 100644 --- a/modules/handlers/everything.py +++ b/modules/handlers/everything.py @@ -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") diff --git a/validation/spoilers.json b/validation/spoilers.json index c54cc48..a8a1cfe 100644 --- a/validation/spoilers.json +++ b/validation/spoilers.json @@ -7,6 +7,7 @@ "description", "photo", "video", + "audio", "animation", "document", "caption", @@ -38,6 +39,10 @@ "bsonType": ["string", "null"], "description": "Spoilered video" }, + "audio": { + "bsonType": ["string", "null"], + "description": "Spoilered audio" + }, "animation": { "bsonType": ["string", "null"], "description": "Spoilered animation/GIF"