Answer the question
In order to leave comments, you need to log in
How to make the bot accept the command without "/"?
I write on the pyTelegramBotAPI library. There is a bot that is activated only when you write a command with "/", for example "/start". But if you use the bot and restart it, then it will not perceive the "Coronavirus" and "Course" functions as a command without "/". How to make the bot perceive the text as a command? If possible, an example code. And thanks for taking the time to solve my problem!
@bot.message_handler(commands=['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
btn1 = types.KeyboardButton('Коронавирус')
btn2 = types.KeyboardButton('Курс')
markup.add(btn1, btn2)
hi_mes = f"<b>Привет {message.from_user.first_name}!</b>"
start_mes = bot.send_message(
message.chat.id, hi_mes, parse_mode='html', reply_markup=markup)
bot.register_next_step_handler(start_mes, check_start)
def check_start(message):
analize_start = message.text
if analize_start == 'Коронавирус':
command = covid_start(message)
elif analize_start == 'Курс':
command = currency(message)
else:
bot.send_message(message.chat.id, "Ошибка", parse_mode='html')
# Дальше там код функций
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question