Answer the question
In order to leave comments, you need to log in
How to change buttons when one is clicked in Telegram python bot?
I just started making bots, and I want to change the buttons, but I don't know how. I want to make it so that when the server button is pressed, buttons with the numbering of servers appear.
import telebot
from telebot import types
@bot.message_handler(commands=['start', 'help'])
@bot.message_handler(content_types=['text'])
def send_welcome (message):
if message.text == '/start':
keyboard = telebot.types.ReplyKeyboardMarkup(True)
keyboard.add('Сервера', 'Цена', 'Скуп', 'Передача', 'FAQ')
bot.send_message(message.from_user.id, 'Привет',reply_markup=keyboard )
if message.text == 'Сервера':
bot.send_message(message.from_user.id, 'В разработке.')
Answer the question
In order to leave comments, you need to log in
To the comments:
There are a lot of materials on the Internet with understandable code. One of the main skills is to be able to search for information
On the question:
In your case, try sending a message with a different keyboard. You somehow screwed the first set of buttons.
if message.text == 'Сервера':
keyboard = telebot.types.ReplyKeyboardMarkup(True)
keyboard.add('Первый', 'Второй', 'Третий')
bot.send_message(message.from_user.id, 'Выбери сервер', reply_markup=keyboard)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question