Артем Asked:2022-08-18 01:24:24 +0000 UTC2022-08-18 01:24:24 +0000 UTC 2022-08-18 01:24:24 +0000 UTC 确定谁点击了内联按钮 772 我正在使用 Telebot 库在 python 中编程。我想知道如何确定谁按下了按钮。我希望该按钮仅在创建者单击它时触发。怎么做? python telebot 1 个回答 Voted Best Answer oleksandrigo 2022-08-18T01:35:19Z2022-08-18T01:35:19Z 你可以这样 @bot.message_handler() def reserve(message: types.Message): markup = InlineKeyboardMarkup().add(InlineKeyboardButton("text", callback_data="prefix:data")) bot.send_message(message.chat.id, text="text", reply_markup=markup) @bot.callback_query_handler(func=lambda call: call.from_user.id == "your_id" and call.data.startswith("prefix:")) def func(call: types.CallbackQuery): bot.answer_callback_query(call.id) ...
你可以这样