Fix inline_message_id for ChosenInlineResultHandler pyrogram/pyrogram#1345

This commit is contained in:
KurimuzonAkuma 2024-08-27 13:33:18 +03:00
parent 3351e00cdc
commit fc68162263

View File

@ -16,12 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from base64 import b64encode
from struct import pack
import pyrogram import pyrogram
from pyrogram import raw from pyrogram import raw
from pyrogram import types from pyrogram import types
from pyrogram import utils
from ..object import Object from ..object import Object
from ..update import Update from ..update import Update
@ -73,18 +71,9 @@ class ChosenInlineResult(Object, Update):
@staticmethod @staticmethod
def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) -> "ChosenInlineResult": def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) -> "ChosenInlineResult":
inline_message_id = None inline_message_id = utils.pack_inline_message_id(
chosen_inline_result.msg_id
if isinstance(chosen_inline_result.msg_id, raw.types.InputBotInlineMessageID): )
inline_message_id = b64encode(
pack(
"<iqq",
chosen_inline_result.msg_id.dc_id,
chosen_inline_result.msg_id.id,
chosen_inline_result.msg_id.access_hash
),
b"-_"
).decode().rstrip("=")
return ChosenInlineResult( return ChosenInlineResult(
result_id=str(chosen_inline_result.id), result_id=str(chosen_inline_result.id),