From quickstart
Create github repo from template
Go to the quickstart repository and click on the
Use this template button.Setup environment variables
Rename the
.env.example file to .env and set your Discord bot token (Discord Developer Portal):From scratch
Set up a new djs-core project from scratch with complete control over your project structure.Initialize your project
Create a new Bun project:This creates a basic
package.json and initializes your project structure.Add scripts to package.json
Add the following scripts to your
package.json:Runs the bot in development mode with hot reload - automatically restarts when files change
Compiles TypeScript to JavaScript in the
dist/ folder for productionRuns the compiled bot from the
dist/ folder (use after build)Create configuration file
Create a
djs.config.ts file in your project root:Your Discord bot token from the Discord Developer Portal
Array of guild (server) IDs where commands should be registered. Use an empty array
[] for global commands (takes up to 1 hour to propagate).Setup environment variables
Create a Make sure to add
.env file in your project root:.env to your .gitignore:Create your first command
Create the directory structure and your first command at
src/interactions/commands/ping.ts:Next Steps
Now that your bot is set up, here’s what to explore next:Project Structure
Learn about the directory structure and how to organize your bot’s code.
Commands
Create slash commands with options, autocomplete, and more advanced features.
Context Menus
Add right-click commands for users and messages.
Components
Create reusable buttons, modals, and select menus to enhance your interactions.