Skip to content
Snippets Groups Projects
Commit 096bf4f4 authored by Stephen D's avatar Stephen D
Browse files

support images

parent 0c78512f
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,13 @@ impl StarboardHandler {
.await
.unwrap_or_else(|| msg.author.tag());
let image = msg
.attachments
.iter()
.filter(|a| a.width.is_some())
.map(|a| &a.url)
.next();
let repost = ChannelId(
gs.starboard_channel
.to_u64()
......@@ -101,9 +108,20 @@ impl StarboardHandler {
)
.send_message(ctx, |m| {
m.embed(|e| {
e.description(format!("[Jump to source]({})\n{}", msg.link(), msg.content))
let mut e = e
.description(format!(
"[Jump to source]({})\n{}",
msg.link(),
msg.content
))
.author(|a| a.name(&name).icon_url(msg.author.face()))
.timestamp(&msg.timestamp)
.timestamp(&msg.timestamp);
if let Some(url) = image {
e = e.image(url);
}
e
})
})
.await?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment