N
N
NikolaiHryshkov2020-06-21 19:27:35
Python
NikolaiHryshkov, 2020-06-21 19:27:35

Telegram bot in Python. How to make a back button?

How to make a back button? So that in ReplyKeyboardMarkup and InlineKeyboardButton each time the button sends the user to the pre-menu?
Already climbed everything.
There is an option to insert the entire menu, but then there are a lot of lines. Can you tell me how you can translate to the previous me.
1) How to make a button back to the previous. menu??
2) How to make a button from the first menu?
CODE:
import config
import telebot
from telebot import types
from requests import get

bot = telebot.TeleBot(config.token)

@bot.message_handler(commands=['start'])
def welcome(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard =True)
item1 = types.KeyboardButton("cob")
item2 = types.KeyboardButton ("Kіnets")
markup.add(item1, item2)
bot.send_photo(message.chat.id, get(" https://tms1.visicom.ua/2.0.0/planet3/base/17 /7669... ").content)
bot.send_message(message.chat.id, "Good day " + message.from_user.first_name + ", I'm a bot consultant ", reply_markup=markup)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2020-06-21
@NikolaiHryshkov

Implement a simple Finite State Machine
https://groosha.gitbook.io/telegram-bot-lessons/ch...
https://mastergroosha.github.io/telegram-tutorial/...
And a classic of the genre ( site search):
Multi-level menu in Bot Telegram, how to make a back button?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question