Skip to content

Commit

Permalink
Base64 encode more embeds from bots
Browse files Browse the repository at this point in the history
  • Loading branch information
jdh8 committed Sep 20, 2023
1 parent 8307e2d commit 61b1b4a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tools/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ pub async fn base64_encode(ctx: Context<'_>, message: serenity::Message) -> anyh
let _typing = ctx.serenity_context().http.start_typing(ctx.channel_id().0);
let attachments = message.attachments.into_iter().map(encode_attachment);
let attachments: Vec<_> = attachments.collect::<FuturesOrdered<_>>().collect().await;
let embeds = if message.content.is_empty() { message.embeds } else { Vec::new() };

ctx.send(|m| {
for c in attachments.into_iter().flatten() {
Expand All @@ -96,7 +95,10 @@ pub async fn base64_encode(ctx: Context<'_>, message: serenity::Message) -> anyh
filename: c.filename,
});
}
m.embeds = embeds.into_iter().map(encode_embed).collect();
m.embeds = message.embeds.into_iter()
.filter(|e| matches!(e.kind.as_deref(), Some("rich") | None))
.map(encode_embed)
.collect();
m.content(ENGINE.encode(message.content))
}).await?;
Ok(())
Expand Down

0 comments on commit 61b1b4a

Please sign in to comment.