-
-
Notifications
You must be signed in to change notification settings - Fork 148
Document embed::ImageSource::attachment usage #2460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notes I added to the book version should of course also be reflected in the mod file. After looking again I can see that it is only the book version that has these problems.
It should probably be marked to not run in the mod.rs file as a good example probably loaded the image from disk and we don't want to make the test read from the disk. We still want to make sure it builds though.
|
|
||
| let message = client | ||
| .create_message(channel_id) | ||
| .attachments(&[("bestpony.png".as_bytes(), "bestpony.png".to_owned(), 0)])? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is a bit wrong, you can no longer have the 3-tuple to make a attachment, instead you should use the Attachment struct.
So it should use Attachment::from_bytes(filename: String, file: Vec<[u8]>, id: u64) instead. The first field in the tuple (or file in Attachment::from_bytes) should be the actual image data.
| .attachments(&[("bestpony.png".as_bytes(), "bestpony.png".to_owned(), 0)])? | ||
| .embeds(&[embed.build()])? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attachments and embeds no longer return a result it it instead moved to the end.
Erk-
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes needed to bring the rustdoc version up to scratch
| /// .validate()? | ||
| /// .build(); | ||
| /// | ||
| /// // Then, send both the embed and the attachment with your message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some statements are missing below here.
| /// | ||
| /// Set the image source to a file attachment: | ||
| /// | ||
| /// ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// ``` | |
| /// ```no_run |
|
Please retarget this to |
Closes #2133
This PR has for purpose to address #2133, by adding documentation on how to send attachment file, other than URLs.