D
D
Doit2021-04-30 22:47:07
Python
Doit, 2021-04-30 22:47:07

How to combine 'Hi' and message.text?

if message.text in HELLOUSER:
bot.send_message(message.chat.id, 'привет' )
I am making my first telegram bot and I have several greetings in the HELLOUSER code, that is, when I write hello to the bot, he answers with the phrase hello written below, but if I write hello bot or (hello + any other text) he will answer what is written below in else I don't understand. I want to make it respond to (hello + any other text) with hello, and not with the text from else. Ie combine HELLOUSER + message.textprobably, but I do not understand how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2021-05-01
@stik3228

bot.send_message(message.chat.id, 'привет '+message.text)

or
bot.send_message(message.chat.id, f'привет {message.text}')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question