L
L
LotusColen2021-06-21 01:14:37
Bots
LotusColen, 2021-06-21 01:14:37

How to create a command with custom text in telegram bot?

Suppose we need to create a command that will record the data entered by the user "/command text"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jerwright, 2021-06-21
@jerwright

Try like this:

@bot.message_handler(commands=['start'])
def welcome(message):
    important_text = message.text.replace('/start ', '')
    #Весь остальной текст будет добавлен в переменную important_text

Instead of start, you can insert any commands.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question