Skip to content

bur4ky/bot-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot Template

A TypeScript template for building Discord bots with discord.js and Bun.

Quick Start

  1. Clone the repo and install dependencies:
git clone https://github.com/bur4ky/bot-template.git
cd bot-template
bun install
cp .env.example .env
  1. Fill in .env.

  2. Register slash commands:

bun register
  1. Start the bot:
bun start

Command Handler

Each command supports per-subcommand config overrides:

defineCommand({
  data: new SlashCommandBuilder() /* ... */,
  config: {
    category: "Bot",
    guildOnly: true,
    disabled: {
      "*": false,
      subcommandName: true,
      "subcommandGroupName subcommandName": true,
    },
  },
  run: async ({ client, interaction }) => {
    /* ... */
  }
});

Important

Do not set descriptions in SlashCommandBuilder() when the command is localized.
The command loader already sets the default description using the default language and applies localized names, descriptions etc automatically.

Localization

Translations live in src/localizations. To add a new language:

  1. Add the runtime translation file at src/localizations/<code>.json.
  2. Add the command registration file at src/localizations/commandData/<code>.json.
  3. Add the locale mapping in src/shared/config.ts.

Important

Keep the language codes in supportedLanguages aligned with the filenames in both localization folders.

Interaction Helpers

These helpers are added to every interaction:

  • interaction.success(message | options) sends a success embed.
  • interaction.error(message | options) sends an error embed.
  • interaction.t(key, options) translates a key using the interaction's locale.

About

TypeScript Discord bot template with multi-language support

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors