/// <summary> /// Provides detailed information for a File and the content of the File based on the fileId. /// </summary> /// <param name="telegramBot">Extended object</param> /// <param name="fileId">Identifier of the file.</param> /// <returns>Tupel of a file and a stream that represents the file.</returns> public static async Task <(File file, Stream content)> GetFileAndDownloadStream(this TelegramBot telegramBot, string fileId) { var file = await telegramBot.GetFile(fileId); var content = await telegramBot.DownloadFileStream(file.FilePath); return(file, content); }
/// <summary> /// Provides a stream to download a file. /// </summary> /// <param name="telegramBot">Extended object</param> /// <param name="file">The file to Download. File object is returned by <see cref="TelegramBot.GetFile(string,CancellationToken)"/></param> /// <returns>Stream for the file to download.</returns> public static Task <Stream> DownloadFileStream(this TelegramBot telegramBot, File file) => telegramBot.DownloadFileStream(file.FilePath);