mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-28 00:56:19 +00:00
Fix serialization of empty optional lists
This commit is contained in:
parent
371700ddec
commit
95aae430a8
@ -444,7 +444,7 @@ def start(format: bool = False):
|
|||||||
sub_type = arg_type.split("<")[1][:-1]
|
sub_type = arg_type.split("<")[1][:-1]
|
||||||
|
|
||||||
write_types += "\n "
|
write_types += "\n "
|
||||||
write_types += f"if self.{arg_name}:\n "
|
write_types += f"if self.{arg_name} is not None:\n "
|
||||||
write_types += "b.write(Vector(self.{}{}))\n ".format(
|
write_types += "b.write(Vector(self.{}{}))\n ".format(
|
||||||
arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else ""
|
arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else ""
|
||||||
)
|
)
|
||||||
|
@ -131,15 +131,10 @@ class SendPoll:
|
|||||||
await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
|
await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message, entities = (await utils.parse_text_entities(
|
solution, solution_entities = (await utils.parse_text_entities(
|
||||||
self, explanation, explanation_parse_mode, explanation_entities
|
self, explanation, explanation_parse_mode, explanation_entities
|
||||||
)).values()
|
)).values()
|
||||||
|
|
||||||
# For some reason passing None or [] as solution_entities will lead to INPUT_CONSTRUCTOR_INVALID_00
|
|
||||||
# Add a dummy message entity with no length as workaround
|
|
||||||
solution = message or None
|
|
||||||
solution_entities = entities or ([raw.types.MessageEntityBold(offset=0, length=0)] if solution else None)
|
|
||||||
|
|
||||||
r = await self.invoke(
|
r = await self.invoke(
|
||||||
raw.functions.messages.SendMedia(
|
raw.functions.messages.SendMedia(
|
||||||
peer=await self.resolve_peer(chat_id),
|
peer=await self.resolve_peer(chat_id),
|
||||||
|
Loading…
Reference in New Issue
Block a user