diff options
| author | seth <[email protected]> | 2023-11-20 03:02:41 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-20 08:05:27 +0000 |
| commit | 1ee27a32d03bdc536f87fe065c5978059efa7f37 (patch) | |
| tree | 9a594baffec91c15866f2bc94fe81317f4f6a83e /src/handler | |
| parent | 873b06b8a61e6fc4486167806bc0ac5eb12d9bbc (diff) | |
chore(pinboard): set footer when attachments > 1
Diffstat (limited to 'src/handler')
| -rw-r--r-- | src/handler/pinboard.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/handler/pinboard.rs b/src/handler/pinboard.rs index 53a5838..1d327f7 100644 --- a/src/handler/pinboard.rs +++ b/src/handler/pinboard.rs @@ -58,7 +58,7 @@ impl PinBoard { .and_then(|(role, _)| role.to_role_cached(&ctx.cache)) .map(|role| role.colour); - let attachment = pin + let attached_image = pin .attachments .iter() .filter(|a| { @@ -67,9 +67,11 @@ impl PinBoard { .filter(|ct| ct.contains("image/")) .is_some() }) - .map(|a| a.url.clone()) + .map(|a| &a.url) .next(); + let attachments_len = pin.attachments.len(); + self.target .send_message(&ctx.http, |m| { m.allowed_mentions(|am| am.empty_parse()) @@ -83,14 +85,14 @@ impl PinBoard { embed.color(color); } - if let Some(attachment) = attachment { + if let Some(attachment) = attached_image { embed.image(attachment); } - if !pin.attachments.is_empty() { + if attachments_len > 1 { embed.footer(|footer| { // yes it will say '1 attachments' no i do not care - footer.text(format!("{} attachment(s)", pin.attachments.len())) + footer.text(format!("{} attachments", attachments_len)) }); } |
