This is the minimal directory structure for a djs-core Discord bot project:
import { Command } from "@djs-core/runtime";
export default new Command()
.setDescription("Ping the bot")
.run(async (interaction) => {
await interaction.reply("Pong!");
});
src/ directoryThis is where you organize your bot's code using the file-based routing system.
src/interactions/commands/This directory contains your slash commands. Each file automatically becomes a command, and subdirectories create command groups.
/ping/admin kick/shop buysrc/interactions/contexts/This directory contains your context menu commands (user and message context menus).
src/events/This directory contains your Discord event handlers. Common events include:
src/components/This directory contains reusable interaction components:
string/ - Text-based optionsuser/ - User selectionrole/ - Role selectionchannel/ - Channel selectionmentionable/ - User or role selectiondjs.config.tsThis is the configuration file for your bot. It defines essential settings like your Discord bot token and server IDs:
import type { Config } from "@djs-core/dev";
export default {
token: process.env.TOKEN,
servers: ["YOUR_GUILD_ID"],
} satisfies Config;
package.jsonThis file contains all the dependencies and scripts for your bot application:
{
"scripts": {
"dev": "djs-core dev",
"build": "djs-core build",
"start": "djs-core start"
},
"dependencies": {
"@djs-core/runtime": "^6.0.0",
"discord.js": "^14.25.1"
},
"devDependencies": {
"@djs-core/dev": "^6.0.0",
"typescript": "^5"
}
}
tsconfig.jsonTypeScript configuration file for type checking and compilation settings.