D
D
Donald2019-08-16 21:03:50
Python
Donald, 2019-08-16 21:03:50

How to make the bot send photos to Telegram?

I am writing a Telegram bot. How to make the bot send a photo with the word "Photo", for example, this is https://imbt.ga/hwq4tukOvf i.e. from the Internet. Or you can from the directory. In general, it doesn’t matter what method the main thing is to send a photo)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akakiy1880, 2019-08-16
@Donald777

import telebot
bot = telebot.TeleBot("BOT_TOKEN")
@bot.message_handler(regexp="Photo")
def send_echolalia(message):
file_id = "AgADAgADMaoxG94MWEnecVWaFaBvVi0_OQ8ABOlKCYOLocyNOy4BAAEC" #file_id of the photo itself
bot.send_photo(message.chat.id, file_id) #sending this photo to the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question