Probably fix for static emojis from #25
This commit is contained in:
parent
eaec6f2fe8
commit
f98fb0b6dc
@ -319,7 +319,7 @@ class HoloUser():
|
|||||||
if progress["state"] == "fill" and progress["sent"] is False:
|
if progress["state"] == "fill" and progress["sent"] is False:
|
||||||
|
|
||||||
if msg.text is not None:
|
if msg.text is not None:
|
||||||
msg.text = fix_text(msg.text)
|
msg.text = fix_text(str(msg.text))
|
||||||
|
|
||||||
if stage == 2:
|
if stage == 2:
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ class HoloUser():
|
|||||||
stage = progress["stage"]
|
stage = progress["stage"]
|
||||||
|
|
||||||
if msg.text is not None:
|
if msg.text is not None:
|
||||||
msg.text = fix_text(msg.text)
|
msg.text = fix_text(str(msg.text))
|
||||||
elif msg.caption is not None:
|
elif msg.caption is not None:
|
||||||
msg.caption = fix_text(msg.caption)
|
msg.caption = fix_text(msg.caption)
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ async def cmd_message(app: Client, msg: Message):
|
|||||||
except (ValueError, UserInvalidError):
|
except (ValueError, UserInvalidError):
|
||||||
destination = HoloUser(await find_user(app, query=msg.command[1]))
|
destination = HoloUser(await find_user(app, query=msg.command[1]))
|
||||||
|
|
||||||
if ((msg.text is not None) and (len(msg.text.split()) > 2)):
|
if ((msg.text is not None) and (len(str(msg.text).split()) > 2)):
|
||||||
await destination.message(context=msg, text=" ".join(msg.text.split()[2:]), caption=msg.caption, photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
await destination.message(context=msg, text=" ".join(str(msg.text).split()[2:]), caption=msg.caption, photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
||||||
elif ((msg.caption is not None) and (len(msg.caption.split()) > 2)):
|
elif ((msg.caption is not None) and (len(msg.caption.split()) > 2)):
|
||||||
await destination.message(context=msg, text=msg.text, caption=" ".join(msg.caption.split()[2:]), photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
await destination.message(context=msg, text=str(msg.text), caption=" ".join(msg.caption.split()[2:]), photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
||||||
else:
|
else:
|
||||||
await destination.message(context=msg, text=None, caption=None, photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
await destination.message(context=msg, text=None, caption=None, photo=msg.photo, video=msg.video, file=msg.document, voice=msg.voice, animation=msg.animation, adm_context=True)
|
||||||
|
|
||||||
|
@ -36,10 +36,13 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
|
|
||||||
destination_user = HoloUser(context_message.from_user)
|
destination_user = HoloUser(context_message.from_user)
|
||||||
|
|
||||||
|
if destination_user is None:
|
||||||
|
return
|
||||||
|
|
||||||
await destination_user.message(
|
await destination_user.message(
|
||||||
origin=context_message,
|
origin=context_message,
|
||||||
context=msg,
|
context=msg,
|
||||||
text=msg.text,
|
text=str(msg.text),
|
||||||
caption=msg.caption,
|
caption=msg.caption,
|
||||||
photo=msg.photo,
|
photo=msg.photo,
|
||||||
video=msg.video,
|
video=msg.video,
|
||||||
@ -58,14 +61,14 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
if msg.text is not None:
|
if msg.text is not None:
|
||||||
|
|
||||||
if configGet("enabled", "features", "applications") is True:
|
if configGet("enabled", "features", "applications") is True:
|
||||||
await holo_user.application_next(msg.text, msg=msg)
|
await holo_user.application_next(str(msg.text), msg=msg)
|
||||||
|
|
||||||
if configGet("enabled", "features", "sponsorships") is True:
|
if configGet("enabled", "features", "sponsorships") is True:
|
||||||
|
|
||||||
await holo_user.sponsorship_next(msg.text, msg)
|
await holo_user.sponsorship_next(str(msg.text), msg)
|
||||||
|
|
||||||
if msg.photo is not None:
|
if msg.photo is not None:
|
||||||
await holo_user.sponsorship_next(msg.text, msg=msg, photo=msg.photo)
|
await holo_user.sponsorship_next(str(msg.text), msg=msg, photo=msg.photo)
|
||||||
|
|
||||||
if holo_user.application_state()[0] != "fill" and holo_user.sponsorship_state()[0] != "fill":
|
if holo_user.application_state()[0] != "fill" and holo_user.sponsorship_state()[0] != "fill":
|
||||||
|
|
||||||
@ -84,7 +87,7 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
# Find category in all locales
|
# Find category in all locales
|
||||||
for lc in all_locales("spoiler_categories", "message"):
|
for lc in all_locales("spoiler_categories", "message"):
|
||||||
for key in lc:
|
for key in lc:
|
||||||
if lc[key] == msg.text:
|
if lc[key] == str(msg.text):
|
||||||
found = True
|
found = True
|
||||||
category = key
|
category = key
|
||||||
|
|
||||||
@ -104,16 +107,16 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
# return
|
# return
|
||||||
|
|
||||||
|
|
||||||
if msg.text != "-":
|
if str(msg.text) != "-":
|
||||||
msg.text = fix_text(msg.text)
|
msg.text = fix_text(str(msg.text))
|
||||||
if len(msg.text) > 1024:
|
if len(str(msg.text)) > 1024:
|
||||||
await msg.reply_text(locale("spoiler_description_too_long", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("spoiler_description", "force_reply", locale=msg.from_user)))
|
await msg.reply_text(locale("spoiler_description_too_long", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("spoiler_description", "force_reply", locale=msg.from_user)))
|
||||||
return
|
return
|
||||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": msg.text}} )
|
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": msg.text}} )
|
||||||
else:
|
else:
|
||||||
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": ""}} )
|
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"description": ""}} )
|
||||||
|
|
||||||
logWrite(f"Adding description '{msg.text}' to {msg.from_user.id}'s spoiler")
|
logWrite(f"Adding description '{str(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=ForceReply(placeholder=locale("spoiler_content", "force_reply", locale=msg.from_user)))
|
await msg.reply_text(locale("spoiler_using_description", "message", locale=msg.from_user).format(msg.text), reply_markup=ForceReply(placeholder=locale("spoiler_content", "force_reply", locale=msg.from_user)))
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -147,8 +150,8 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
|
|
||||||
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 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:
|
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}} )
|
col_spoilers.find_one_and_update( {"user": msg.from_user.id, "completed": False}, {"$set": {"text": str(msg.text), "completed": True}} )
|
||||||
logWrite(f"Adding text '{msg.text}' to {msg.from_user.id}'s spoiler")
|
logWrite(f"Adding text '{str(msg.text)}' to {msg.from_user.id}'s spoiler")
|
||||||
ready = True
|
ready = True
|
||||||
|
|
||||||
if ready is True:
|
if ready is True:
|
||||||
@ -191,7 +194,7 @@ async def any_stage(app: Client, msg: Message):
|
|||||||
async def message_in_group(app: Client, msg: Message):
|
async def message_in_group(app: Client, msg: Message):
|
||||||
if (msg.chat is not None) and (msg.via_bot is not None):
|
if (msg.chat is not None) and (msg.via_bot is not None):
|
||||||
if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("users", "groups")):
|
if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("users", "groups")):
|
||||||
if msg.text.startswith(locale("spoiler_described", "message").split()[0]) or msg.text.startswith(locale("spoiler_empty", "message").split()[0]):
|
if str(msg.text).startswith(locale("spoiler_described", "message").split()[0]) or str(msg.text).startswith(locale("spoiler_empty", "message").split()[0]):
|
||||||
logWrite(f"User {msg.from_user.id} sent spoiler to user's group")
|
logWrite(f"User {msg.from_user.id} sent spoiler to user's group")
|
||||||
try:
|
try:
|
||||||
logWrite("Forwarding spoiler to admin's group")
|
logWrite("Forwarding spoiler to admin's group")
|
||||||
|
Reference in New Issue
Block a user