F
F
flex7r2020-02-10 17:34:32
Python
flex7r, 2020-02-10 17:34:32

Why can't python see the call variable?

telebot library : https://github.com/eternnoir/pyTelegramBotAPI

elif message.text == "Каталог":
        bot.send_message(message.chat.id, "⬇️Каталог игр:", reply_markup=keyboard2)
        bot.register_next_step_handler(message, catalog)

def catalog(message):
    if message.text == "Не нашёл свою игру?":
        bot.send_message(message.chat.id, "Обратитесь в поддержку\nПоддержка 24/7 - @flex7r")
    elif message.text == "⬅️Назад":
        bot.send_message(message.chat.id, "Главное меню", reply_markup=keyboard1)
        bot.register_next_step_handler(message, main)
    else:
        try:
            keyboard = types.InlineKeyboardMarkup()
            callback_button = types.InlineKeyboardButton(text="Купить", callback_data="test")
            keyboard.add(callback_button)
            catalogvar = c.games_list.index(message.text)
            bot.send_photo(message.chat.id, c.games_photo[catalogvar], c.games_list[catalogvar] + "\nЦена: " + str(c.games_price[catalogvar]) + " руб.", reply_markup=keyboard)
            if call.data == "test":
                bot.send_message(message.chat.id, "success")
        except ValueError:
            bot.send_message(message.chat.id, "Игра не найдена")
    bot.register_next_step_handler(message, catalog)


I wanted to make an inline button, but there is a problem with the call variable

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question