Introduction
syntx.js is a lightweight layer on top of discord.js that takes care of the repetitive parts of building a bot; wiring up the client, registering commands, dispatching events, and routing buttons, select menus, and modals; so you can focus on what your bot actually does.
Note
syntx.js doesn't replace discord.js, it builds on top of it. Every discord.js export (Client, EmbedBuilder, GatewayIntentBits, ...) is re-exported from syntx.js itself, and the real discord.js client is always available at client.bot.
Why syntx.js?
- One client, every command type. Define prefix-based text commands with
client.command()and/slash commands withclient.slash()on the sameERXClientinstance. - Built-in UI helpers.
Embed,Poll,Buttons,SelectMenus, andModalwrap the more verbose discord.js builders in small, declarative classes. - Auto-loading. Point
client.handler()at yourcommands/,slash/,events/,interactions/, andmodals/folders and every file inside gets registered for you. - Errors that actually help. Misusing the API throws a
SyntxErrornaming the exact argument that's wrong, with a hint on how to fix it; instead of a vague discord.js stack trace three layers deep. - Nothing is hidden.
client.botis the real discord.jsClient. Anything syntx.js doesn't wrap, discord.js still does, with no workarounds needed.
A quick look
const { ERXClient, Intents } = require("syntx.js");
const client = new ERXClient({
token: process.env.TOKEN,
intents: Intents.Fast,
prefix: "!",
});
client.ready(() => {
console.log(`Logged in as ${client.bot.user.tag}`);
});
client.command({
name: "ping",
content: (message) => message.reply("Pong!"),
});
client.registerCommands();
client.start();That's a complete, working bot; no manual interactionCreate/messageCreate listeners to wire up yourself.
Note
syntx.js is a lightweight wrapper built on top of discord.js that simplifies common bot development tasks but does not aim to replace or fully cover it, so you can always access the original discord.js client directly via client.bot for any missing or advanced features.
Next steps
- Starting from scratch? Head over to Installation.
- Ready to build? Follow the Your first bot guide.
- Want the full picture first? See the Client reference for everything
ERXClientoffers.