File Uploads
Two distinct flows depending on the destination:
- Channel image by URL — set
MessageParams::imageto a remote image URL. Seeexamples/guild/reply_image.rs. - Group / C2C rich media — upload a URL via the reply session's
post_file, then send the returnedMediawithsend_media_message. Seeexamples/group/reply_file.rsandexamples/c2c/reply_file.rs.
Channel Image
rust
let params = MessageParams {
content: Some("here you go".into()),
image: Some("https://example.com/image.png".into()),
..Default::default()
};
session.send_message(params).await?;Group / C2C two-step
rust
let media = session.post_file(/* file_type */ 1, file_url, None).await?;
session.send_media_message(media).await?;C2CReplySession::post_file + send_media_message follow the exact same pattern. file_type is 1 for image; see the example source for other constants.
See also
- Guide:
docs/guide/messages.md - Examples:
examples/guild/reply_image.rs,examples/group/reply_file.rs,examples/c2c/reply_file.rs