Installation
Install @fluxerjs/core, set your token, and run a first bot.
Requirements
Node.js 22.13 or newer. ESM works out of the box ("type": "module" in package.json, or .mjs files).
Install
Prefer pnpm:
pnpm add @fluxerjs/coreAlso fine: npm install @fluxerjs/core or yarn add @fluxerjs/core.
Optional packages when you need them:
pnpm add @fluxerjs/voice # see the Voice guide
pnpm add @fluxerjs/builders # if you import builders separately (also re-exported from core)
pnpm add @fluxerjs/sharding # process sharding when one process is not enough
pnpm add @fluxerjs/sharding-redis # multi-machine shard leasesBot token
Create a bot in the Fluxer developer portal and copy the token. Put it in the environment rather than hardcoding it:
# Windows PowerShell
$env:FLUXER_BOT_TOKEN="your_token"
node bot.js
# macOS / Linux
FLUXER_BOT_TOKEN=your_token node bot.jsOr use a .env file with a loader of your choice. The examples folder has an .env.example you can copy.
First run
import { Client, Events } from '@fluxerjs/core';
const client = new Client();
client.on(Events.Ready, () => {
console.log(`Logged in as ${client.user?.username}`);
});
await client.login(process.env.FLUXER_BOT_TOKEN);When you are ready to reply to messages, listen for Events.MessageCreate and match !ping yourself (see Basic bot). For several commands, parse with parsePrefixCommand (see Prefix commands).
Getting Started path
- Installation (this page)
- Basic bot
- Prefix commands
- Errors (
FluxerErrorcheat sheet) - Caching (limits, get vs fetch, sweeps)
- Where do I...? (task index)
Upgrading an existing bot: Upgrading to 3.0 (from 2.x) or Migrating to 2.0 (from 1.x). Coming from discord.js: From discord.js.
Verify it works
From this repo after pnpm install && pnpm run build:
FLUXER_BOT_TOKEN=your_token node examples/minimal-bot.jsThen send !ping in a channel the bot can see. Next stop: the Basic bot guide, or browse examples.
Custom API host
Most bots use the default hosted API. For a custom base URL (legacy):
const client = new Client({
rest: { api: process.env.FLUXER_API_URL },
});For self-hosted discovery and multi-instance setups, see the Multi-instance guide.