/// <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 string that represents the file.</returns> public static async Task <(File file, string content)> GetFileAndDownloadString(this TelegramBot telegramBot, string fileId) { var file = await telegramBot.GetFile(fileId); var content = await telegramBot.DownloadFileString(file.FilePath); return(file, content); }
/// <summary> /// Provides a string representation of 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>String representation of the downloaded File.</returns> public static Task <string> DownloadFileString(this TelegramBot telegramBot, File file) => telegramBot.DownloadFileString(file.FilePath);