B
B
batalek2021-01-26 13:47:42
Bots
batalek, 2021-01-26 13:47:42

How to make the bot automatically reply to the specified message with the specified answer?

An example is this:
I indicate the response to the message "Hello everyone!" the answer is "Hi!"
And when any person writes Hello everyone! The bot answered with the given answer, that is, "Hi!"
And so I want to do with many messages. Not limited to one message 

  • hello = hello
  • Yes, you went = You went yourself
  • etc. so that you can add a message and indicate how to respond to them

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Carl43, 2021-01-26
@Carl43

If this is a telegram bot and you are using pyTelegramBotAPI
You can do this:
@bot.message_handler(content_types=["text"])
def message_reply(message):
if message.text == 'Hi':
bot.send_message(message.chat. id,'Hi')
elif message.text =='Fuck you':
bot.send_message(message.chat.id,'Here you go')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question