eternnoir / pyTelegramBotAPI

Python Telegram bot api.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InlineKeyboardButton doesn't work last time

LazyPythonCoder opened this issue · comments

Telebot 4.15.3/OS -WIN 10 64
Sо I have simple code, when I start program I can see meesage and button, but when pressed the button - nothing! In is very strange because this code worked some mounths ago!

import telebot
from telebot import types

bot = telebot.TeleBot('key')

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
button_text = "Press me"
button_value = "button_pressed"
button = types.InlineKeyboardButton(text=button_text, callback_data=button_value)
message_text = "Press the button"
reply_markup = types.InlineKeyboardMarkup(row_width=1)
reply_markup.add(button)
bot.send_message(message.from_user.id, text=message_text, reply_markup=reply_markup)

@bot.callback_query_handler(func=lambda call: True)
def handle_button_press(call):
print(call.message)
bot.send_message(call.message.chat.id, text='Button pressed')

bot.infinity_polling()

Telebot 4.15.3/OS -WIN 10 64: works fine.

image

Very strange. My code does not work at all. I press the button and nothihg..

I have done problem. I created new bot and that everythibg is OK. But I very surprized that I had not done any changes in old bot.