public async Task <MemoryAttachment?> DownloadAttachment(InAttachment inAttachment) { var file = await _api.GetFileAsync(inAttachment.Id).ConfigureAwait(false); var url = $"https://api.telegram.org/file/bot{_options.Token}/{file.FilePath}"; var response = await _client.GetByteArrayAsync(url).ConfigureAwait(false); // Todo Refactor this. int index = file.FilePath.LastIndexOf('/'); var fullName = file.FilePath.Substring(index + 1); return(AttachmentFactory.CreateMemoryAttachment(fullName, response, inAttachment.Type)); }