private static async void DownloadFile(string fileId, string path)
{
try
{
var file = await botclient.GetFileAsync(fileId);
FileStream fs = new FileStream(path, FileMode.Create);
await botclient.DownloadFileAsync(file.FilePath, fs);
fs.Close();
fs.Dispose();
}
catch (Exception ex)
{
Console.WriteLine("Error downloading: " + ex.Message);
}
}
DownloadFile(message.Photo[message.Photo.Count() - 1].FileId, "photo" + id + ".jpg");