Getting started
You need a Fluxer bot token and a channel the bot can access. Use the raw token: Talos adds theBot prefix to REST requests itself.
Install
bun add talos-fluxer. The core package has no runtime dependencies.
The package supports Node 20 and newer. The bot below uses the global WebSocket
available in Node 22+ and Bun. On Node 20, install ws and use the adapter shown
below. REST-only scripts do not need a WebSocket implementation.
Run a ping bot
Save this asbot.mjs:
bun bot.mjs. Once it prints the connected username,
send !ping in a channel where the bot can read and send messages. It should reply
with Pong!. The bot-author check prevents bots from answering each other.
Register listeners before connect(). It resolves after the gateway’s READY
event; initialization failures reject the promise. The error listener also
receives errors thrown or rejected by your event handlers.
Node 20 WebSocket adapter
Installws with npm install ws. Add its import to bot.mjs and replace the
client construction:
@types/ws as a development dependency.
Connect to another instance
Client discovers the public API and gateway through /.well-known/fluxer.
The default origin is https://fluxer.app. To use another instance:
api_public, including its path prefix. Talos handles the /v1 suffix.
Supplying endpoints skips discovery.
When startup or replies fail
connect() has a 60-second deadline by default. Call disconnect() to stop an
established client. A second connect() while it is running rejects.