Skip to main content

๐Ÿ“‚ File Structure

Discord bots built with Robo.js follow the following file structure:

  • /src/commands: Slash commands. Can be nested for subcommands or subcommand groups.
  • /src/context: Context commands for either /user or /message.
  • /src/events: Discord events. Can be nested for grouped events.

Basic Exampleโ€‹

/src
โ”œโ”€โ”€ /commands
โ”‚ โ””โ”€โ”€ ping.js
โ””โ”€โ”€ /events
โ””โ”€โ”€ messageCreate.js

The above is used to create:

  • /ping command.
  • messageCreate event.

Advanced Exampleโ€‹

/src
โ”œโ”€โ”€ /commands
โ”‚ โ”œโ”€โ”€ ping.js
โ”‚ โ”œโ”€โ”€ /ban
โ”‚ โ”‚ โ””โ”€โ”€ user.js
โ”‚ โ””โ”€โ”€ /settings
โ”‚ โ””โ”€โ”€ /update
โ”‚ โ””โ”€โ”€ something.js
โ”œโ”€โ”€ /context
โ”‚ โ”œโ”€โ”€ /user
โ”‚ โ”‚ โ””โ”€โ”€ Audit.js
โ”‚ โ””โ”€โ”€ /message
โ”‚ โ””โ”€โ”€ Report.js
โ””โ”€โ”€ /events
โ”œโ”€โ”€ ready.js
โ””โ”€โ”€ /messageCreate
โ”œโ”€โ”€ dm.js
โ””โ”€โ”€ hello.js

The above is used to create:

  • /ping command.
  • /ban user subcommand.
  • /settings update something subcommand group.
  • Audit user context command.
  • Report message context command.
  • ready event.
  • dm and hello grouped messageCreate events.
Robo.js Logo

MIT ยฉ 2024 Robo.js By WavePlay