I want to make a simple echo bot, I need that Bot would send the images that the bot was sent.
That’s what I tried:
import telbot
Bot = TELEBOT.TELEBOT (':)')
@ Bot.Message_Handler (CONTENT_TYPES = [Photo '])
DEF Get_Text_Messages (Message):
Bot.Send_Message (Message.From_user.id, Message.photo)
Bot.Polling (None_stop = True, Interval = 0)
But in response I do not get an image, but information about it.
{'file_size': 4501, 'file_unique_id': 'aqadgzigoi4aa4xvaai', 'height': 150, 'width' : 320, 'File_id': 'agacagiaaxkbaammyg25zzrjbpzcsa1kfpn9aztxveiaapqymrsljmll5cnnbrxfox0boiailgadaqadagadbqadhduaah4e'}
As using Message.Photo Send Image ?
Answer 1, Authority 100%
You need to use the send_photo
method and is enough to specify the image file ID:
@ bot.message_handler (content_types = ['photo'])
DEF Get_Text_Messages (Message):
Bot.Send_Photo (message.from_user.id, Message.photo [0] .file_id)