mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Update unpack_inline_message_id
This commit is contained in:
parent
6087c2a974
commit
2ad53ec00b
@ -166,15 +166,27 @@ def pack_inline_message_id(msg_id: "raw.base.InputBotInlineMessageID"):
|
|||||||
return base64.urlsafe_b64encode(inline_message_id_packed).decode().rstrip("=")
|
return base64.urlsafe_b64encode(inline_message_id_packed).decode().rstrip("=")
|
||||||
|
|
||||||
|
|
||||||
def unpack_inline_message_id(inline_message_id: str) -> "raw.types.InputBotInlineMessageID":
|
def unpack_inline_message_id(inline_message_id: str) -> "raw.base.InputBotInlineMessageID":
|
||||||
r = inline_message_id + "=" * (-len(inline_message_id) % 4)
|
padded = inline_message_id + "=" * (-len(inline_message_id) % 4)
|
||||||
r = struct.unpack("<iqq", base64.b64decode(r, altchars=b"-_"))
|
decoded = base64.urlsafe_b64decode(padded)
|
||||||
|
|
||||||
return raw.types.InputBotInlineMessageID(
|
if len(decoded) == 20:
|
||||||
dc_id=r[0],
|
unpacked = struct.unpack("<iqq", decoded)
|
||||||
id=r[1],
|
|
||||||
access_hash=r[2]
|
return raw.types.InputBotInlineMessageID(
|
||||||
)
|
dc_id=unpacked[0],
|
||||||
|
id=unpacked[1],
|
||||||
|
access_hash=unpacked[2]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
unpacked = struct.unpack("<iqiq", decoded)
|
||||||
|
|
||||||
|
return raw.types.InputBotInlineMessageID64(
|
||||||
|
dc_id=unpacked[0],
|
||||||
|
owner_id=unpacked[1],
|
||||||
|
id=unpacked[2],
|
||||||
|
access_hash=unpacked[3]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
MIN_CHANNEL_ID = -1002147483647
|
MIN_CHANNEL_ID = -1002147483647
|
||||||
|
Loading…
Reference in New Issue
Block a user