Answer the question
In order to leave comments, you need to log in
The photo from the user's message in the telegram bot does not download?
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");
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