Skip to content

Commit 91e4716

Browse files
committed
Use pack_inline_message_id util function in CallbackQuery
1 parent 4e6c169 commit 91e4716

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

pyrogram/types/bots_and_keyboards/callback_query.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from base64 import b64encode
20-
from struct import pack
2119
from typing import Union, List, Match, Optional
2220

2321
import pyrogram
@@ -102,15 +100,7 @@ async def _parse(client: "pyrogram.Client", callback_query, users) -> "CallbackQ
102100
if not message:
103101
message = await client.get_messages(chat_id, message_id)
104102
elif isinstance(callback_query, raw.types.UpdateInlineBotCallbackQuery):
105-
inline_message_id = b64encode(
106-
pack(
107-
"<iqq",
108-
callback_query.msg_id.dc_id,
109-
callback_query.msg_id.id,
110-
callback_query.msg_id.access_hash
111-
),
112-
b"-_"
113-
).decode().rstrip("=")
103+
inline_message_id = utils.pack_inline_message_id(callback_query.msg_id)
114104

115105
# Try to decode callback query data into string. If that fails, fallback to bytes instead of decoding by
116106
# ignoring/replacing errors, this way, button clicks will still work.

0 commit comments

Comments
 (0)