Skip to content

Rich Messages

Embeds, Markdown, ARK templates, and keyboards can be sent directly from the current reply session. Use the lower-level params structs only when you need custom protocol fields.

Working examples:

Pattern

Build a payload (Embed, Ark, keyboard payload), then pass it to the semantic session helper.

rust
use botrs::models::message::{Embed, EmbedField};

let embed = Embed {
    title: Some("embed消息".to_string()),
    prompt: "消息透传显示".to_string(),
    fields: Some(vec![EmbedField { name: Some("hello world".to_string()), ..Default::default() }]),
    ..Default::default()
};
session.send_embed_message(embed).await?;

Raw markdown is also a session helper:

rust
session.send_markdown_message("# title\n\nbody").await?;

Use params constructors such as MessageParams::new_keyboard(...), GroupMessageParams::new_ark(...), or C2CMessageParams::new_embed(...) when you are sending outside a reply session. Set fields manually only for custom combinations such as template markdown params not covered by the helpers.

See also

Released under the MIT License.