K
K
khan22021-07-28 11:42:03
Python
khan2, 2021-07-28 11:42:03

Why doesn't callback_data return?

probably a simple question, but I’m just starting to write, and I can’t find anything on the Internet, I’m writing a simple keyboard, but callback_data doesn’t work

import config
import telebot
import types
import sqlite3
from telebot import types


bot = telebot.TeleBot(config.token)



@bot.message_handler(content_types=["text"])


def phone(message):
    bot.send_message(message.chat.id, message.text)
    keyboard = types.InlineKeyboardMarkup()
    callback_button2 = types.InlineKeyboardButton(text="Нажми меня2", callback_data='sadsasdasdd')
    callback_button = types.InlineKeyboardButton(text="Нажми меня", callback_data='sadsad')
    keyboard.add(callback_button2, callback_button)
    bot.send_message(message.chat.id, "Привет! Нажми на кнопку.",
                                 reply_markup=keyboard)




if __name__ == '__main__':
  bot.polling()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UberPool, 2021-07-28
@khan2

You didn't make a handler for callback
Read more in the documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question