def request_file(file_id, save_as): file_info = BOT.get_file(file_id) req = requests.get("https://api.telegram.org/file/bot{0}/{1}".format( BOT.token, file_info.file_path)) file_out = open("input+" + file_info.file_path, "w") lines = req.content() file_out.write(lines) req.close() file_out.close()
def get_file(file_id: int): """Get basic infor about a file and prepare it for downloading :arg file_id: id of the file""" return BOT.get_file(file_id)