B
B
Bumpy972020-05-12 18:30:03
Python
Bumpy97, 2020-05-12 18:30:03

How to upload images to a telegram bot using python?

How to make my telegram bot automatically send my pre-loaded picture to a person using the /start command.
For example, the name of the picture is pic.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilkhomjon Matazimov, 2020-05-12
@Bumpy97

howdy ho is his code

@bot.message_handler(commands=['start'])
def welcome(message):
    sti = open('путь до каталога/название.webp', 'rb')
    bot.send_sticker(message.chat.id, sti)
 
    bot.send_message(message.chat.id, "Добро пожаловать, {0.first_name}!\nЯ - <b>{1.first_name}</b>, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
        parse_mode='html')

A
Armenian Radio, 2020-05-12
@gbg

I did this - I sent (himself) a picture to the bot, remembered its ID on the bot, and then sent it to the user. To this day it works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question