A TypeScript template for creating Discord bots with discord.js and Bun.
- Clone the repo and install dependencies:
git clone https://github.com/bur4ky/bot-template.git
cd bot-template
bun install
cp .env.example .env- Fill in your
.envfile. - Register slash commands:
bun register- Start the bot:
bun startCommands are organized under src/commands. Each command uses defineCommand and supports per-subcommand config overrides:
defineCommand({
data: new SlashCommandBuilder() /* ... */,
config: {
category: "Bot",
guildOnly: true,
disabled: {
"*": false, // default
subcommandName: true, // only for "subcommandName"
"subcommandGroupName subcommandName": true, // only for "subcommandName" in "subcommandGroupName"
},
},
run: async ({ client, interaction }) => {
// command logic
},
});Translations live in src/localizations. To add a new language:
- Create
src/localizations/<code>.json - Create
src/localizations/slashCommands/<code>.jsonfor command name/description localizations - Add the locale to
supportedLanguagesinsrc/config.ts
These are available on any interaction:
interaction.success(message | options)— sends a success embedinteraction.error(message | options)— sends an error embedinteraction.translate(key, options)— translates a key using the interaction's locale
This project is licensed under the MIT License.