You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit misleading as you can use local files when attached to the message. I tried fixing the docs, but have not a setup ready at the moment to test if the docs are working and if it works in pure Serenity. (In poise it works, but uses the CreateReply function.)
Would love if someone could check this and add something to the docs about how to use local files.
use serenity::builder::{CreateEmbed,CreateAttachment,CreateEmbedFooter};// First we create an attachmentlet attachment = CreateAttachment::path("images/loss.jpg").await.expect("Could not find image");// Then we create an embed where we add the image/footer/thumbnaillet embed = CreateEmbed::default().image("attachment://loss.jpg").thumbnail("attachment://loss.jpg").footer(CreateEmbedFooter::new("Loss footer").icon_url("attachment://loss.jpg"),);// I think this should work in Serenity:let builder = CreateMessage::new().embed(embed).add_file(attachment);// In Poise we do the following and that works for sure:
ctx.send(CreateReply::default().embed(embed).attachment(attachment)).await?;
The text was updated successfully, but these errors were encountered:
let img_path:&Path = Path::new("./img.png");let attachment_bytes:Vec<u8> = std::fs::read(img_path).expect("Failed to read card file");let attachment:CreateAttachment = CreateAttachment::bytes(
attachment_bytes,"img.png");// attachment can be routed thru an embed aswellCreateMessage::default().add_file(attachment).content("@everyone")
This seems correct, not sure why the docs say it only supports HTTPS for those methods. CreateEmbed::attachment even specifies CreateEmbed::image works with local attachments by using the attachment:// syntax. So do the Discord docs.
In the documentation it states that the Footer, Thumbnail & Image only support HTTP(S).
https://docs.rs/serenity/latest/serenity/builder/struct.CreateEmbed.html#method.image
https://docs.rs/serenity/latest/serenity/builder/struct.CreateEmbed.html#method.thumbnail
https://docs.rs/serenity/latest/serenity/builder/struct.CreateEmbedFooter.html#method.icon_url
This is a bit misleading as you can use local files when attached to the message. I tried fixing the docs, but have not a setup ready at the moment to test if the docs are working and if it works in pure Serenity. (In poise it works, but uses the
CreateReply
function.)Would love if someone could check this and add something to the docs about how to use local files.
The text was updated successfully, but these errors were encountered: