А еще, если я передаю URL-адрес inlineKeyboardButton работает правильно
@bot.message_handler()
def add_city(message):
if user_status[message.chat.id] == Statuses.AddCity:
logger.info("User adding the city")
request = {
"name": message.text
}
response = requests.post(f'{api_url}/api/users/{message.chat.id}/add-city', json=request, headers=headers)
if response.status_code == 200:
logger.info("User got city. Waiting for confirmation")
data = response.json()
user_status[message.chat.id] = Statuses.ConfirmCity
markup = InlineKeyboardMarkup()
markup.add(InlineKeyboardButton("Confirm", callback_data="Confirm"))
markup.add(InlineKeyboardButton("Deny", callback_data="Deny"))
bot.send_message(message.chat.id, f'{data.get("name")}', reply_markup=ReplyKeyboardRemove())
bot.send_message(message.chat.id, "message")
bot.send_message(message.chat.id, f'Підтверди що це саме те місто, яке ти хотів додати:',
reply_markup=markup)
else:
logger.info("Bad Request")
bot.send_message(message.chat.id, f'Виникла помилка при додаванні міста
@bot.callback_query_handler(func=lambda call: True)
def handle_city_confirmation(call):
logger.info(call)
if user_status[call.message.chat.id] == Statuses.ConfirmCity:
call.answer("smtj")
if user_status[call.chat.id] == Statuses.ConfirmCity:
if call.data.split(' ')[0] == "Confirm":
bot.send_message(call.message.chat.id, 'success')
else:
bot.send_message(call.message.chat.id, "deny")
else:
bot.send_message(call.message.chat.id, "fail")
Подробнее здесь: https://stackoverflow.com/questions/792 ... nt-working
Мобильная версия