Bug fixes and improvements #8

Merged
profitroll merged 23 commits from dev into master 2023-01-11 17:22:34 +02:00
4 changed files with 16 additions and 3 deletions
Showing only changes of commit 00a408ac6c - Show all commits

View File

@ -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,

View File

@ -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:

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")

View File

@ -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"