diff options
Diffstat (limited to 'src/system.rs')
-rw-r--r-- | src/system.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/system.rs b/src/system.rs index 98bd026..d1f9dc9 100644 --- a/src/system.rs +++ b/src/system.rs @@ -182,11 +182,15 @@ impl System { let attachments = join_all(message.attachments.iter().map(|attachment| async { let filename = attachment.filename.clone(); - let description = attachment.description.clone(); + let description_opt = attachment.description.clone(); let bytes = reqwest::get(attachment.proxy_url.clone()).await?.bytes().await?; + let mut new_attachment = Attachment::from_bytes(filename, bytes.try_into().unwrap(), attachment.id.into()); - // TODO: keep description - Ok(Attachment::from_bytes(filename, bytes.try_into().unwrap(), attachment.id.into())) + if let Some(description) = description_opt { + new_attachment.description(description); + } + + Ok(new_attachment) })).await.iter().filter_map(|result: &Result<Attachment, MessageDuplicateError>| match result { Ok(attachment) => Some(attachment.clone()), Err(_) => None, |