Z
Z
ZAKZAKZAK2021-11-14 19:08:35
Python
ZAKZAKZAK, 2021-11-14 19:08:35

How to set up telegram so that it responds to certain images?

There is a telegram bot that responds to messages to users, now there is a need to respond to certain images sent by the user.
I suppose that the chat bot sent by the user should save the image in the database, if the next time the user sends the same image, the bot is looking for matches in the database, if there are any, then the bot somehow answers the user.

please help me with the implementation, I don’t quite understand how to do it
Example:

import telebot

bot = telebot.TeleBot('BOT TOKEN')

dnr1 = "hello"
dnr2 = "hello"
dnr3 = "hello"

@bot.message_handler(content_types=['text '])
def handle_text(message):
if message.text.casefold() == dnr1 or message.text.casefold() == dnr2 or message.text.casefold() == dnr3:
bot.send_message(message.chat.id, f'Hi, {message .from_user.first_name}!')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question