Embeds and attachments
Embeds
Section titled “Embeds”Embeds have a title, description, link, colour, timestamp, author, footer, up to 25 fields, an image and a thumbnail. Up to 10 per message.
import { EmbedBuilder } from "zaun-client";
const embed = new EmbedBuilder() .setTitle("Release 1.2") .setURL("https://example.com/releases/1.2") .setDescription("What changed") .setColor(0x5865f2) .addFields({ name: "Fixes", value: "12", inline: true }, { name: "Features", value: "3", inline: true }) .setImage({ name: "screenshot.png", data: bytes }) .setFooter({ text: "zaun" });await channel.send({ embeds: [embed] });use zaun_client::{EmbedBuilder, MessageOptions, Picture};
let embed = EmbedBuilder::new() .title("Release 1.2") .url("https://example.com/releases/1.2") .description("What changed") .color(0x5865F2) .field("Fixes", "12", true) .field("Features", "3", true) .image(Picture::file("screenshot.png")) .footer("zaun", None);channel.send(MessageOptions::new().embed(embed))?;Attachments
Section titled “Attachments”await channel.send({ content: "my cat", files: [{ name: "cat.png", data: bytes }] });
// on the other sideconst bytes = await message.attachments.first().download();channel.send_files("my cat", &["cat.png"])?;
// on the other side, from an Event::MessageCreatelet saved = message.attachments()[0].download("./downloads")?;Files travel as SimpleX files over the same post-quantum connection, each encrypted with a fresh
key. Sending returns once the host has checked and stored the files; downloading checks the size and
SHA3-256 before anything is saved. The host’s [attachments] settings cap the size (25 MB by
default). With your own SMP relay, add an XFTP relay too, or there is no file server.