Merge pull request 'Small fix for spoiler with an empty description' (#5) from dev into master
Reviewed-on: profitroll/HoloCheckerBot#5
This commit is contained in:
commit
4fba305b05
@ -6,6 +6,7 @@ from pyrogram.client import Client
|
|||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import configGet, logWrite, locale, all_locales
|
from modules.utils import configGet, logWrite, locale, all_locales
|
||||||
from modules.database import col_messages, col_spoilers
|
from modules.database import col_messages, col_spoilers
|
||||||
|
from bson import ObjectId
|
||||||
|
|
||||||
async def message_involved(msg: Message) -> bool:
|
async def message_involved(msg: Message) -> bool:
|
||||||
message = col_messages.find_one({"destination.id": msg.reply_to_message.id, "destination.chat": msg.reply_to_message.chat.id})
|
message = col_messages.find_one({"destination.id": msg.reply_to_message.id, "destination.chat": msg.reply_to_message.chat.id})
|
||||||
@ -95,6 +96,8 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
return
|
return
|
||||||
if msg.text != "-":
|
if msg.text != "-":
|
||||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": msg.text, "completed": True}} )
|
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": msg.text, "completed": True}} )
|
||||||
|
else:
|
||||||
|
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": None, "completed": True}} )
|
||||||
logWrite(f"Adding description '{msg.text}' to {msg.from_user.id}'s spoiler")
|
logWrite(f"Adding description '{msg.text}' to {msg.from_user.id}'s spoiler")
|
||||||
await msg.reply_text(locale("spoiler_using_description", "message", locale=msg.from_user).format(msg.text), reply_markup=ReplyKeyboardRemove())
|
await msg.reply_text(locale("spoiler_using_description", "message", locale=msg.from_user).format(msg.text), reply_markup=ReplyKeyboardRemove())
|
||||||
await msg.reply_text(locale("spoiler_ready", "message", locale=msg.from_user), quote=False, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("spoiler_send", "button", locale=msg.from_user), switch_inline_query=f"spoiler:{spoiler['_id'].__str__()}")]]))
|
await msg.reply_text(locale("spoiler_ready", "message", locale=msg.from_user), quote=False, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("spoiler_send", "button", locale=msg.from_user), switch_inline_query=f"spoiler:{spoiler['_id'].__str__()}")]]))
|
||||||
|
Reference in New Issue
Block a user