B
B
Baga2021-05-24 19:46:27
Python
Baga, 2021-05-24 19:46:27

How to make the bot react to the text replayed on the message?

Code I made (it doesn't work):

@bot.message_handler(content_types=['text'])
def get_text_messages(message):
elif message.reply_to.text.lower() == 'Mda':
mda = open(' D:\GX downloa\zloy.mp4', 'rb')
bot.send_video(message.repl, mda, caption=message.reply_to.from_user.first_name+'Hmm, even I don't like you')

We need the bot to respond to the message ' Mda' and sent the photo as a replay to the message to which the text "Mda" was replayed and gave out the user of the person to whom the text "Mda" was replayed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Master Ruby, 2021-05-24
@Baga12324

@bot.message_handler(content_types=['text'])
def get_text_messages(message):
    if message.text == 'Мда'.lower():
        bot.send_video(chat_id=update.message.chat_id, 
                       video=open('output.mp4', 'rb'), supports_streaming=True)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question