Repository navigation
zaun-bot v0.2.0
Pre-release
Pre-release
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_networkinzaun-bot.toml: exacthost:portaddresses beside the host, such as a media server on127.0.0.1:8787.http://is allowed for these, forhttp.fetchandplay_url. Only the operator can allow it, and a host may refuse it.- Bot configuration: a
[config]table with descriptions, defaults andsecret = true. A newon-config-changeexport delivers changes, asBot::on_configin Rust andbot.on('config')in TypeScript. TypeScript entry lines must now exportonConfigChange. - 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'sparticipants; - queue control:
remove,move,shuffle,clear-queue,set-loop(off, track or queue), and aqueue-endedevent; position-ms,duration-msandseek;set-volume(0–200 %);- WebM Opus sources (YouTube itag 251), on hosts that demux it.
- the caller's voice channel (
- Low-level audio (
zaun:bot/audio): write Opus packets or 16-bit PCM yourself.audio-lowevents 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 answersUNSUPPORTED(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;/nowplayingwith 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 pluszaun-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.