Building a Bot on Fluxer
A complete guide - from enabling developer mode inside the Fluxer app, to writing and running your first bot with @fluxerjs/core. No prior Fluxer experience needed.
Your First Fluxer Bot
In this guide, you'll create a bot from scratch - no prior experience needed! We'll go slow and explain everything in plain English. By the end, you'll have a working bot that responds to commands.
Enable Developer Mode
The developer tools are built into the Fluxer app - there's no separate website portal.
Fluxer doesn't have a browser-based developer portal. Everything for creating and managing bot applications lives directly inside the client. You unlock it by toggling Developer Mode in the app settings.
Click the gear icon next to your username at the bottom-left of the Fluxer window. You can also use Ctrl+, on Windows/Linux or Cmd+, on macOS.
Scroll down the settings sidebar until you see the Advanced tab and click it.
Find the Developer Mode toggle and switch it on. The toggle turns blue when active.
A Developer entry will appear in the settings sidebar. This is where you create applications, manage bots, and copy tokens.
Step 1: Enable Developer Mode
Unlocking the bot-building features in Fluxer.
Think of Developer Mode as a secret switch that reveals all the advanced features in Fluxer - the ones you need to create bots!
Look for the gear icon at the bottom-left of Fluxer and click it. Or simply press Ctrl+, (Windows) or Cmd+, (Mac).
On the left side of Settings, scroll down until you see Advanced - click on it.
Find the Developer Mode toggle and flip it ON. It turns blue when it's active.
A new Developer option now appears in your Settings! This is where you'll create and manage your bots.
Create an Application
Register your bot and grab its token from the Developer section.
With Developer Mode on, go to Settings > Developer. You'll see a list of your existing applications, or an empty state if this is your first one.
Click New Application, give it a name, and confirm. The name is what shows in server member lists when your bot is online.
Inside the application settings, go to the Bot tab and click Add Bot. This turns the application into an actual bot account.
Click Reset Token to generate one and copy it right away. You won't see it again after leaving the screen.
Go to the OAuth2 tab, pick the bot scope, choose the permissions your bot needs, then copy the generated invite URL.
Step 2: Create Your Bot Account
Setting up your bot so it can come online.
Now that Developer Mode is enabled, let's create your bot! Go to Settings - Developer on the left side of Fluxer.
Click the + New Application button. Give your bot a cool name like "MyFirstBot" or "ServerHelper" - this is what people will see!
Inside your new application, go to the Bot tab and click Add Bot. This turns your application into an actual bot account.
Click Reset Token to generate a secret password for your bot. COPY IT NOW and save it somewhere safe - you won't see it again!
Go to the OAuth2 tab, pick the bot option, choose what permissions your bot needs, then copy the invite URL.
Invite the Bot to a Server
Authorize your bot to join a guild you own or manage.
Paste the OAuth2 invite URL into your browser. You'll be prompted to pick a server - choose one where you have the Manage Server permission, then click Authorize.
The bot will appear offline in the member list until you start your process. Set up a private test server so you can work without affecting anyone else.
Project Setup
Initialize a Node.js project and install the Fluxer library.
You need Node.js 18 or newer. Create a directory for your bot and initialize it:
mkdir my-fluxer-bot && cd my-fluxer-bot npm init -y
Install @fluxerjs/core and dotenv:
npm install @fluxerjs/core dotenv
The library uses ES module syntax. Open package.json and add "type": "module":
{ "name": "my-fluxer-bot", "version": "1.0.0", "type": "module", "main": "index.js" }
Create a .env file at the project root for your token:
FLUXER_BOT_TOKEN=your-bot-token-here
.env to .gitignore before your first commit. Running echo ".env" >> .gitignore takes care of it.File structure
my-fluxer-bot/
├── .env
├── .gitignore
├── index.js
├── package.json
└── node_modules/
Writing the Bot
The entry point and your first working command.
Create index.js. This logs in, ignores other bots, and responds to !ping with the measured round-trip latency:
import { Client, Events } from '@fluxerjs/core'; import 'dotenv/config'; const client = new Client({ intents: 0 }); client.on(Events.Ready, () => { console.log(`Logged in as ${client.user.tag}`); }); client.on(Events.MessageCreate, async (message) => { if (message.author.bot) return; if (message.content === '!ping') { const t = Date.now(); const msg = await message.reply('Pong!'); await msg.edit(`Pong! \`${Date.now() - t}ms\``); } }); client.on(Events.Error, console.error); await client.login(process.env.FLUXER_BOT_TOKEN);
What each part does
Creates the bot client. intents: 0 requests no privileged gateway data. If you need to read message content from other users, enable the Message Content intent in the Developer section and set its bitmask value here.
Fires once after login completes and the gateway is up. client.user is available at this point.
Skips messages from any bot account. Without this, two bots in the same channel can trigger each other in a loop.
Prevents gateway errors from throwing unhandled exceptions and crashing the process. Passing console.error is a reasonable minimum.
Authenticates and opens the WebSocket connection to the gateway. Always call this last.
Handling multiple commands
A prefix-based switch keeps things clean without pulling in extra libraries:
client.on(Events.MessageCreate, async (message) => { if (message.author.bot) return; const prefix = '!'; if (!message.content.startsWith(prefix)) return; const [cmd, ...args] = message.content .slice(prefix.length).trim().split(/\s+/); try { switch (cmd.toLowerCase()) { case 'ping': await message.reply('Pong!'); break; case 'hello': await message.reply(`Hey, ${message.author.username}.`); break; case 'echo': await message.reply(args.join(' ') || 'Nothing to echo.'); break; } } catch (err) { console.error('Command failed:', err); } });
Running the Bot
Start the process and test it.
node index.js
If the token is valid and the gateway connects, you'll see:
Logged in as MyBot#1234
Go into a channel the bot can read and write in, type !ping, and it should reply with Pong! and the latency.
nodemon as a dev dependency and use npx nodemon index.js - it restarts the bot automatically on every file save.node index.js in a terminal for production - it stops when the session closes. Use PM2 or a Docker container instead.Step 3: Start Your Bot!
Making your bot come alive.
This is the fun part - getting your bot online! Open your terminal (Command Prompt on Windows, Terminal on Mac) and navigate to your bot's folder.
node index.js
If everything worked, you should see this message:
Logged in as MyBot#1234
Now go to your server, find a text channel, and type !ping. Your bot should reply with Pong! - congratulations, you made a working bot!
npm install nodemon, then use npx nodemon index.js instead!Classes
Main exports from @fluxerjs/core.
Client constructor options
| Option | Type | Description |
|---|---|---|
| intents | number | Bitmask of gateway intents. Controls which events the gateway forwards. Use 0 for basic use with no privileged data. |
| presence | object | Initial presence set on login - status, activity, etc. Optional. |
| rest | object | Forwarded to the REST client. Set baseUrl here when targeting a self-hosted Fluxer instance. |
Using REST directly
You can instantiate the REST class on its own for cases where a higher-level method doesn't exist yet:
import { REST, Routes } from '@fluxerjs/core'; import 'dotenv/config'; const rest = new REST().setToken(process.env.FLUXER_BOT_TOKEN); const guilds = await rest.get(Routes.userGuilds()); console.log(`Bot is in ${guilds.length} guild(s).`);
Events
What you can listen to via client.on().
client.user is set at this point.Message object.Permissions
Commonly used permission bits for bot invite URLs.
When generating the invite URL in the Developer section, the interface handles the bitwise combination for you - just check what your bot needs.
| Permission | Bit | When you need it |
|---|---|---|
| Send Messages | 2048 | Required to post any message in a text channel. |
| Read Message History | 65536 | Access to past messages. Needed for context-aware features. |
| Embed Links | 16384 | Sending rich embeds with fields, images, and colors. |
| Attach Files | 32768 | Uploading files and images as message attachments. |
| Add Reactions | 64 | Adding emoji reactions to messages. |
| Manage Messages | 8192 | Deleting or pinning messages. Treat as a privileged permission. |
| Connect | 1048576 | Joining voice channels. Only needed for audio bots. |
Advanced Patterns
Techniques for bots that grow beyond a single file.
Sending embeds
if (cmd === 'info') { await message.channel.send({ embeds: [{ title: 'Bot Info', description: 'Running on Fluxer.', color: 0x4f80f5, fields: [ { name: 'Guilds', value: `${client.guilds.cache.size}`, inline: true }, { name: 'Uptime', value: `${Math.floor(process.uptime())}s`, inline: true } ], timestamp: new Date().toISOString() }] }); }
Splitting commands into separate files
Once you have more than a few commands, a commands/ folder with one file per command keeps things manageable:
my-fluxer-bot/
├── index.js
└── commands/
├── ping.js
├── info.js
└── echo.js
export const name = 'ping'; export async function execute(message) { await message.reply('Pong!'); }
import { Client, Events } from '@fluxerjs/core'; import { readdir } from 'node:fs/promises'; import 'dotenv/config'; const client = new Client({ intents: 0 }); const commands = new Map(); for (const file of await readdir('./commands')) { const mod = await import(`./commands/${file}`); commands.set(mod.name, mod); } client.on(Events.MessageCreate, async (message) => { if (message.author.bot || !message.content.startsWith('!')) return; const [name] = message.content.slice(1).split(' '); const cmd = commands.get(name); if (cmd) await cmd.execute(message); }); client.on(Events.Error, console.error); await client.login(process.env.FLUXER_BOT_TOKEN);
Self-hosted instances
Point your bot at a self-hosted Fluxer server by setting rest.baseUrl:
const client = new Client({ intents: 0, rest: { baseUrl: 'https://your-instance.example.com/api' } });
See the self-hosting docs for running your own Fluxer backend.
Advanced Topics
For when you're ready to learn more!
The sections below (Classes, Events, Permissions, Advanced Patterns) are reference material for when you want to learn more about coding bots. For now, you have everything you need to make a working bot!
Come back to these sections later once you're comfortable with the basics. You can:
Events tell your bot when something happens - like when someone joins the server, sends a message, or reacts to something.
Permissions control what your bot can do - like sending messages, deleting messages, or joining voice channels.
Once your bot grows, you'll want to organize code into multiple files and use more complex features.