summaryrefslogtreecommitdiff
path: root/src/handler
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-27 17:17:48 -0500
committerseth <[email protected]>2023-11-27 22:35:56 +0000
commit0ee00e040c4c0b466825e9207e9899fc6a64160f (patch)
tree6a31bf8bd27ade61c8f371f7d143aba7e84423d2 /src/handler
parent710a71a5bb38887751b79beefecadf8f0b4b73df (diff)
chore(pinboard): don't create multiple embeds
Diffstat (limited to 'src/handler')
-rw-r--r--src/handler/pinboard.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/handler/pinboard.rs b/src/handler/pinboard.rs
index bb7c7d1..35d477d 100644
--- a/src/handler/pinboard.rs
+++ b/src/handler/pinboard.rs
@@ -72,19 +72,16 @@ impl PinBoard {
let attachments_len = pin.attachments.len();
- let embeds = pin
- .embeds
- .iter()
- .take(9) // 10 embeds max per message, this should never matter but better safe than sorry :^)
- .cloned()
- .map(|e| e.into())
- .collect::<Vec<CreateEmbed>>();
-
self.target
.send_message(&ctx.http, |m| {
m.allowed_mentions(|am| am.empty_parse())
.content(format!("📌'd by {pinner} in {}", pin.link()))
.add_embed(|embed| {
+ // only use the first embed if it's in the message, since more could be a little spammy
+ if let Some(pinned_embed) = pin.embeds.first() {
+ embed.clone_from(&CreateEmbed::from(pinned_embed.clone()))
+ }
+
embed.author(|author| {
author.name(&pin.author.name).icon_url(pin.author.face())
});
@@ -106,7 +103,6 @@ impl PinBoard {
embed.description(truncated_content)
})
- .add_embeds(embeds)
})
.await
.expect("couldn't redirect message");