Skip to content

Releases

zaun-bot v0.2.0

zaun-bot v0.2.0 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 04 Dec 04:17

Needs a host with WIT zaun:bot@0.2.0. zaun-host 0.3.0 runs only 0.1.0 bots. A bot built with this release installs there but never loads. What the host has to add is written down in docs/host-requirements.md. Bots built with 0.1.0 keep working.

Everything a music bot ported from Node (yt-dlp, ffmpeg, a queue, now-playing) needs, plus a low-level audio API, settings the owner fills in, and member/message objects.

New

  • local_network in zaun-bot.toml: exact host:port addresses beside the host, such as a media server on 127.0.0.1:8787. http:// is allowed for these, for http.fetch and play_url. Only the operator can allow it, and a host may refuse it.
  • Bot configuration: a [config] table with descriptions, defaults and secret = true. A new on-config-change export delivers changes, as Bot::on_config in Rust and bot.on('config') in TypeScript. TypeScript entry lines must now export onConfigChange.
  • Members and messages carry their own actions:
    • interaction.member.send(...), member.kick(), member.timeout(), member.roles.add();
    • message.reply(), react(), edit(), delete().
    • In Rust: ctx.member.send(..), message.reply(..), member.add_role(..).
  • Voice:
    • the caller's voice channel (ctx.member.voice_channel, interaction.member.voiceChannelId) and the bot's participants;
    • queue control: remove, move, shuffle, clear-queue, set-loop (off, track or queue), and a queue-ended event;
    • position-ms, duration-ms and seek;
    • set-volume (0–200 %);
    • WebM Opus sources (YouTube itag 251), on hosts that demux it.
  • Low-level audio (zaun:bot/audio): write Opus packets or 16-bit PCM yourself. audio-low events pace the writes, so no timers are needed. The stream is output only.
  • Every new call returns result<_, host-error>. A host that lacks a feature answers UNSUPPORTED (is_unsupported() in Rust, isUnsupported() in TS) instead of trapping.
  • Music examples (Rust and TS):
    • /play <song> through the media server set in config, joining the caller's channel;
    • /nowplaying with a progress bar, /seek, /remove, /move, /shuffle, /loop, /clear, /volume, /tone;
    • the bot leaves when it is alone.
    • Each command falls back cleanly on UNSUPPORTED.

Still needs the host

  • Linking both WIT versions side by side.
  • local_network, configuration storage plus zaun-host bot config / bot.configure, and members' voice state.
  • Queue control, seeking, WebM demuxing, the audio stream, and an Opus encoder (for volume and PCM).

The full list is in docs/host-requirements.md.

Not on npm or crates.io yet

@zaun/bot 0.2.0 and the zaun-bot crate are built but not published. Use npm install ../zaun-bot/sdk/js or a git dependency.

zaun-bot v0.1.0

Choose a tag to compare

@github-actions github-actions released this 04 Dec 03:16

The first release of the Zaun bot toolkit: bots that a community's owner installs on their own zaun-host and that run there as sandboxed WebAssembly components.

  • WIT world zaun:bot@0.1.0: commands, interactions, components and modals, messages, typed events, DMs, voice, presence, storage, timers and HTTP (only to hosts you grant).
  • TypeScript SDK @zaun/bot, the default. It is not on npm yet, so until it is, build it from sdk/js and point a project at it (npm install ../zaun-bot/sdk/js).
  • Rust SDK zaun-bot: a smaller and faster component (about 300 KB, against about 24 MB for TypeScript).
  • zbot for Linux, macOS and Windows: new, build, pack, inspect, keygen and sign.
  • Examples in both languages: ping, poll buttons, feedback modal, welcome DM and music. Each comes as a component and as a .zbot package.

Needs zaun-host 0.3.0 or newer. Docs and the quickstart: https://zaunchat.github.io/docs/guide/bots/quickstart/