Answer the question
In order to leave comments, you need to log in
How to search word in message (Bot Telegram Python)?
In my code, I want to implement that if the user of the bot writes the message "Does he want to leave?", And in this message there is the right word, for example, "wants", then the bot would send the answer "does not want".
import telebot
from telebot import types
token = 'Insert token'
bot = telebot.TeleBot(token)
@bot.message_handler(content_types='text')
def send(message):
Don't know how to proceed...
bot.send_message(chat_id= '@bottopli' , text='Don't want')
bot.polling()
Answer the question
In order to leave comments, you need to log in
import telebot
token = ''
bot = telebot.TeleBot(token)
@bot.message_handler(content_types=['text'])
def repeat_all_message(message):
if 'хочет' in message.text:
bot.send_message(message.chat.id,'не хочет')
if __name__ == '__main__':
bot.polling(none_stop=True)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question