Answer the question
In order to leave comments, you need to log in
Why isn't more than one button created with pyTelegramBotAPI?
Keyboard send code:
@bot.message_handler(content_types=['text'])
def send_text(message):
query = api_query(message.text)
if query is not None:
keyboard = types.InlineKeyboardMarkup()
for item in query:
print(item)
keyboard.add(types.InlineKeyboardButton(text=item, callback_data=item))
bot.send_message(message.from_user.id, text='Вот, что я нашел:', reply_markup=keyboard)
else:
bot.send_message(message.from_user.id, 'Ой, мне ничего не удалось найти. Ты точно ввел(а) правильное название?')
['Чернобыль: Зона отчуждения (2014)', 'Чернобыльские джунгли. 20 лет без человека (2008)', 'Чернобыль (2019)']
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: BUTTON_DATA_INVALID"}']
Answer the question
In order to leave comments, you need to log in
Actually, as always - the fool inattentively read the documentation and ran to the toaster:
The code is working, only in callback_data I have exceeded the API limit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question