Answer the question
In order to leave comments, you need to log in
How to make the telegram bot give a specific message to any user text?
If you write any message to the bot in a personal, roughly speaking, how to respond with one message without touching the commands / / /
For example: I don’t understand you - send me a command.
At the same time, so that the bot does not react to a public chat, only if you write to him in a personal :)
Thanks for any help :)
python - telegrambotapi
Answer the question
In order to leave comments, you need to log in
@bot.message_handler(content_types=['text'])
def text_handler(message):
if message.chat.type == 'private':
bot.send_message(message.chat.id, 'Я тебя не понимаю - отправь мне команду')
bot = telebot.TeleBot('token')
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, 'Привет!')
@bot.message_handler(content_types=['text'])
def start(message):
bot.send_message(message.chat.id, 'Я тебя не понимаю - отправь мне команду')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question