Skip to content

File Uploads

Two distinct flows depending on the destination:

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

Released under the MIT License.