public async void CanDownload_AFile() { byte[] audioBytes = File.ReadAllBytes(Path.Combine(_resourcesPath, "Audio.mp3")); byte[] downloadedBytes = await _telegramBot.Download("AwADBAADbQYAAtQHAVMH6C2nlJBQnRYE"); Assert.Equal(audioBytes, downloadedBytes); }
public async Task SendBackReplay() { byte[] uploadedFile = await _telegramApi.Download(_messageVoice.fileId); _repository.Save( uploadedFile, async savedTo => await _telegramApi.SendMessage(_from.Id, $"ok: saved to {savedTo}"), async error => await _telegramApi.SendMessage(_from.Id, $"error: {error.Message}")); List <int> waitingList = _repository.GetWaitingList(); using (MemoryStream ms = new MemoryStream(uploadedFile)) { foreach (var telegramId in waitingList) { await _telegramApi.SendAudioMessage(telegramId, ms); } } }