TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.17k stars 686 forks source link

Save Audio File #623

Closed NimaZare closed 6 years ago

NimaZare commented 6 years ago

Hi Sir When i want save a audio file whit this code :

string savepath = System.Windows.Forms.Application.StartupPath + @"\DownloadMusic\";
var filePath = Path.Combine(savepath, new Random().Next(1111, 99999).ToString() + ".mp3");
using (var file = File.OpenWrite(filePath))
{
      botN.GetInfoAndDownloadFileAsync(msg.Audio.FileId, file);
}

i recieved file success but this saved file size is 0kb !

please help me ! sorry for my bad english :(

poulad commented 6 years ago

@AppleAssistant Read issue template before posting issues.

See here for examples: https://github.com/TelegramBots/Telegram.Bot/blob/ac5d22e22c836c07af8cfcabdd5826e639f2e1c3/test/Telegram.Bot.Tests.Integ/Other/FileDownloadTests.cs