Skip to content
/ discord-bot-ts Public template

A simple to use Discord bot template written in TypeScript

License

Notifications You must be signed in to change notification settings

kamiya10/discord-bot-ts

Repository files navigation

TypeScript Discord Bot

Setup

Install dependencies with package manager

# Using npm
npm install

# Using yarn
yarn install

# Using pnpm
pnpm install

# Using bun
bun install

Building a Slash Command

You can build a Slash Command with Command utility class:

export default new Command({
  builder: new SlashCommandBuilder()
    .setName("roll")
    .setDescription("Roll dice"),
  defer: false,
  ephemeral: true,
  async execute(interaction) {
    await interaction.reply({
      content: `🎲 ${Math.round(Math.random() * 6)}`,
    });
  },
});