E
E
esskimos2021-03-24 14:01:20
Python
esskimos, 2021-03-24 14:01:20

How to fix video ratio in telebot bot?

Hello!
There is a problem with displaying videos in the bot. It comes in a 1:1 aspect ratio. Is there a solution to this problem?
605b1b904aefb294270889.jpeg
There are still they question.
Whether it is possible to make so that the server did not load it to each user? Because it slows down the process a lot.

Thank you very much in advance!

The code:

@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    try:
        if call.message:
            if call.data == 'spring_jackets':
                vid = open('Desktop/Tele/spring_jackets.mp4', 'rb')
                bot.send_video(call.message.chat.id, vid)
                vid.close()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexa2007, 2021-03-26
@esskimos

When you send something via cart, it stores it on its servers.
Send the video to the bot once, and then send the ID of this video to everyone, and the cart will do everything by itself, and you can even delete the file from the phone ... it's on the server

@bot.message_handler(content_types=["video"])
def confirming(message):
    if message.content_type == 'video':
        print(message.video.file_id) #ID видео файла на сервере 
        bot.send_video(message.chat.id, message.video.file_id)# Отправляешь его сам себе
    else:
        pass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question