Answer the question
In order to leave comments, you need to log in
What needs to be changed in the finished bot that you send mp4 video to telegram to receive the id file of the code?
At the moment, the bot is working, but there is a problem associated with the fact that the id file comes only if you send a file and you need to make sure that the id file comes when you send a video
, that is, I send a video from my personal account to the bot through the telegram client and in response the bot sends the id file of this video,
help here, as I understand it, you need to change a little variable or something like that, but where I don’t understand, I’m not strong in programming
import telebot
import requests
token = 'xxx:xxxx'
bot = telebot.TeleBot(token)
@bot.message_handler(content_types=['text'])
def repeat_all_message(message):
print(message.text)
bot.send_message(message.chat.id,message.text)
@bot.message_handler(content_types=["text", "video", "video_note", "document", "audio"])
def handle_files(message):
document_id = message.document.file_id
file_info = bot.get_file(document_id)
print(document_id) # Выводим file_id
print(f'http://api.telegram.org/file/bot{token}/{file_info.file_path}') # Выводим ссылку на файл
bot.send_message(message.chat.id, document_id) # Отправляем пользователю file_id
if name == 'main':
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question