SDK for building bots on Fluxer.
pnpm add @fluxerjs/coreFluxer has no Discord-style gateway intents. Construct a client with no options (or only cache / instance options you need):
import { Client, Events } from '@fluxerjs/core';
const client = new Client();
client.on(Events.Ready, () => console.log('Ready'));
client.on(Events.MessageCreate, async (m) => {
if (m.content === '!ping') await m.reply('Pong');
});
await client.login(process.env.FLUXER_BOT_TOKEN);Full guides, examples, REST reference, and SDK API docs: https://fluxer.js.org
Start with Installation → Basic bot → Prefix commands → Errors → Caching.
Coming from discord.js? Read From discord.js. Upgrading from 2.x? See Upgrading to 3.0. Coming from 1.x? See Migrating to 2.0 first.
From this repo:
# Dev server: http://localhost:3333
pnpm run docs:dev
# Build packages + generate docs + Next build
pnpm run docs:build
# Preview the production build
pnpm run docs:previewdocs:dev: Next.js on port 3333docs:build: Generates API docs JSON, then builds the Next.js docs site (via turbo)docs:preview:next starton port 3333
- Runnable bots:
examples/(copyexamples/.env.example) - Caching when you care about memory and identity
- Collectors, permissions, embeds
One Client = one Fluxer instance (token, REST, gateway, caches, CDN/invite URLs).
Each instance needs its own bot token.
Beta: ClientCluster can add/remove/restart runtimes without restarting the process.
The API may change; constructing a cluster emits a FluxerClientClusterBeta warning.
restart(id, { token }) requires re-supplying the instance token (never stored).
import { ClientCluster, ClientClusterEvents, Events } from '@fluxerjs/core';
// or: import { ClientCluster } from '@fluxerjs/core/cluster';
const cluster = new ClientCluster({
configure(runtime) {
runtime.client.on(Events.MessageCreate, async (m) => {
if (m.content === '!ping') await m.reply(`Pong from ${runtime.id}`);
});
},
});
await cluster.add({ id: 'hosted', token: process.env.FLUXER_BOT_TOKEN });
await cluster.add({
id: 'self',
token: process.env.SELFHOST_BOT_TOKEN, // must be issued by the self-hosted instance
discovery: 'https://api.my.instance',
});
// Later: no process restart
await cluster.restart('self', { token: process.env.SELFHOST_BOT_TOKEN });
await cluster.remove('self');You can still manage raw Client instances yourself. See examples/multi-instance-bot.js and the multi-instance guide.
For process-per-shard scaling, see @fluxerjs/sharding and examples/sharded-bot.js.
Apache-2.0