Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
10ad4f9
docs: setup new guide structure
notunderctrl Jun 14, 2025
2a9789a
refactor: remove unnecessary script
twlite Jun 14, 2025
4bb30cd
fix: llms plugin url
twlite Jun 14, 2025
a93e247
docs: update versioning
notunderctrl Jun 14, 2025
8518f35
docs: add getting started and advanced setup guides
notunderctrl Jun 14, 2025
aaa1a2c
docs: update styling + add chat input commands docs
notunderctrl Jun 14, 2025
131f781
docs: fix wording
notunderctrl Jun 14, 2025
ba67067
Update apps/website/docs/guide.old/01-getting-started/02-setup-comman…
twlite Jun 15, 2025
f43d487
Update apps/website/docs/guide.old/01-getting-started/02-setup-comman…
twlite Jun 15, 2025
3d05352
update prettier config
notunderctrl Aug 14, 2025
45b1977
Merge branch 'main' into rewrite-docs
notunderctrl Aug 14, 2025
08e293f
prettier format
notunderctrl Aug 14, 2025
4258569
update gh actions node version to 24
notunderctrl Aug 14, 2025
b99d5de
fix tsdown entry
notunderctrl Aug 14, 2025
9376e1e
update workflow + lint script to check-types
notunderctrl Aug 14, 2025
fa300e1
fix tooltips
notunderctrl Aug 14, 2025
4884fbe
add options autocomplete docs
notunderctrl Aug 14, 2025
d338b45
fix autocomplete choices wording
notunderctrl Aug 14, 2025
90d9768
add context menu command docs
notunderctrl Aug 14, 2025
9770553
add message commands docs
notunderctrl Aug 14, 2025
2c4928c
fix message command function name
notunderctrl Aug 15, 2025
7fa4a77
document prefix resolver for message commands
notunderctrl Aug 15, 2025
8bb6057
fix prettier formatting
notunderctrl Aug 15, 2025
91f16e8
update prefix resolver example
notunderctrl Aug 15, 2025
28f8fac
document `after` function
notunderctrl Aug 15, 2025
252c289
document commands category dir
notunderctrl Aug 15, 2025
78aac43
fix: entry build pattern for tsdown
notunderctrl Aug 15, 2025
3fa55d9
fix turbo build output for docs
notunderctrl Aug 15, 2025
879ed6b
fix command-scoped middleware + document middlewares
notunderctrl Aug 15, 2025
a8f7488
document discord.js events
notunderctrl Aug 16, 2025
884cc0f
add class links
notunderctrl Aug 16, 2025
eff1535
document custom events
notunderctrl Aug 16, 2025
b612e03
fix typo
notunderctrl Aug 16, 2025
fe64394
document v0 -> v1 migration
notunderctrl Aug 16, 2025
f2a91e1
document sharding
notunderctrl Aug 16, 2025
bc27565
setup community plugins page structure
notunderctrl Aug 16, 2025
816bbae
document file naming conventions
notunderctrl Aug 16, 2025
f0838d6
custom events doc tweaks
notunderctrl Aug 16, 2025
35f712d
update utilities tone
notunderctrl Aug 16, 2025
d1f7008
document plugins + utilities
notunderctrl Aug 16, 2025
83ed02a
update utilities naming
notunderctrl Aug 16, 2025
acdaab8
document `@commandkit/cache`
notunderctrl Aug 16, 2025
75b5ae2
document `@commandkit/ai`
notunderctrl Aug 16, 2025
15f7a4d
document `stopEvents()` function
notunderctrl Aug 16, 2025
f34b146
document `@commandkit/analytics`
notunderctrl Aug 16, 2025
3c35878
document feature flags
notunderctrl Aug 16, 2025
1713bbd
document `@commandkit/devtools`
notunderctrl Aug 16, 2025
2025fbc
document `@commandkit/i18n`
notunderctrl Aug 16, 2025
dbcf3d7
document `@commandkit/legacy` and `@commandkit/redis`
notunderctrl Aug 16, 2025
0c3972a
document creating a plugin
notunderctrl Aug 16, 2025
5a093db
document jsx components
notunderctrl Aug 17, 2025
c89d7bd
docs: add ai plugin architecture diagram
twlite Aug 17, 2025
af979e9
Update apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx
twlite Aug 17, 2025
c91f62c
Merge pull request #467 from underctrl-io/twlite-patch-1
twlite Aug 17, 2025
85b5d4d
Merge branch 'main' of https://github.com/underctrl-io/commandkit int…
twlite Aug 18, 2025
e10de86
update contributing.md
notunderctrl Aug 18, 2025
1220a05
prettier format
notunderctrl Aug 18, 2025
c90197e
docs: remove oudated callout
notunderctrl Aug 18, 2025
7fc7c54
feat: add EventHandler type
notunderctrl Aug 18, 2025
4474a31
fix broken link + codeblock titles
notunderctrl Aug 18, 2025
8e750ed
docgen + add publish-rc gh action
notunderctrl Aug 18, 2025
a3049bb
update versioning
notunderctrl Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions apps/website/docs/guide.old/01-getting-started/01-introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Introduction
description: A brief intro to CommandKit
---

<div
align="center"
style={{
margin: '2rem 0',
}}
>
<img src="/img/ckit_logo.svg" width="60%" />
<br />
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
gap: '0.5rem',
}}
>
<a href="https://ctrl.lol/discord">
<img
src="https://img.shields.io/discord/1055188344188973066?color=5865F2&logo=discord&logoColor=white"
alt="support discord server"
/>
</a>
<a href="https://www.npmjs.com/package/commandkit">
<img
src="https://img.shields.io/npm/v/commandkit?maxAge=3600"
alt="npm version"
/>
</a>
<a href="https://www.npmjs.com/package/commandkit">
<img
src="https://img.shields.io/npm/dt/commandkit?maxAge=3600"
alt="npm downloads"
/>
</a>
</div>
</div>

CommandKit is a powerful meta-framework for building Discord bots with [discord.js](https://discord.js.org/). It provides a simple and intuitive API for creating commands, handling interactions, and managing events. With CommandKit, you can focus on building your bot's features without worrying about the underlying complexities.

## Key Features

- Beginner friendly 🚀
- Suitable for both beginners and advanced users 👶👨‍💻
- Slash + context menu commands + prefix commands support ✅
- Automatic command registration and updates 🤖
- Command middlewares for easy command management 🛠️
- Localization support through `@commandkit/i18n` plugin 🌍
- Plugin system to extend functionality 🔌
- Built-in command line interface for easy development 🖥️
- Out-of-the-box support for TypeScript and JavaScript 📜
- Built-in customizable cache system for speedy data storage and retrieval 🗄️
- User installable/guild scoped commands 🔧
- Custom events support 🔔
- JSX support for declaring Discord interaction components and modals 🎨
- Easy to use interaction components and modals system (forget about collectors) 🧩
- Less boilerplate code, more productivity 💪
- and much more...

## Documentation

You can start with the [setting up CommandKit](./02-setup-commandkit.mdx) guide to get your bot up and running quickly. The documentation covers everything from installation to advanced features.

## Support and Suggestions

Submit any queries or suggestions in our [Discord community](https://ctrl.lol/discord).
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: Setup CommandKit
description: Setup a new CommandKit project manually, or using the create-commandkit CLI
---

You can quickly setup a new CommandKit project using `create-commandkit` — a command-line utility used for creating new discord.js applications with CommandKit. To get started, run the following command:

```sh npm2yarn
npx create-commandkit@latest
```

This will start the CLI in the current directory which will help you quickly setup a base CommandKit project.

## Project structure

By using the CLI to create a base project, you should get a project structure that looks like this:

```
.
├── src/
│ ├── app/
│ │ ├── commands/
│ │ │ └── ping.ts
│ │ └── events/
│ │ └── ready/
│ │ └── log.ts
│ └── app.ts
├── .env
├── .gitignore
├── commandkit.config.ts
├── package.json
└── tsconfig.json
```

:::info
The `src/app.ts` file is the main entry point for your application. This file default exports the discord.js client which CommandKit loads at runtime. For example, the `src/app.ts` file looks like this:

```ts
import { Client } from 'discord.js';

const client = new Client({
intents: [
/* add stuff */
],
});

// setting up the token manually
client.token = process.env.MY_BOT_TOKEN;

export default client;
```

Notice how we are not calling `client.login()` in this file. This is because CommandKit will automatically call `client.login()` for you when the application starts.

Also, you might have noticed that we are not using anything from CommandKit in this file. This is because CommandKit is designed to reduce boilerplate code and make it easier to build discord bot applications.
:::

:::info
The `src/app` directory is a special directory that CommandKit understands. All the commands and events in this directory will be automatically registered when the application starts.
:::

## Development version

:::warning
The development version is likely to have bugs.
:::

If you'd like to try the latest development builds, you can use the `@dev` tag like so:

```sh npm2yarn
npx create-commandkit@dev
```
31 changes: 14 additions & 17 deletions apps/website/docs/guide/01-getting-started/01-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,41 @@ description: A brief intro to CommandKit
</a>
<a href="https://www.npmjs.com/package/commandkit">
<img
src="https://img.shields.io/npm/v/commandkit?maxAge=3600"
src="https://img.shields.io/npm/v/commandkit?maxAge=3600&logo=npm"
alt="npm version"
/>
</a>
<a href="https://www.npmjs.com/package/commandkit">
<img
src="https://img.shields.io/npm/dt/commandkit?maxAge=3600"
src="https://img.shields.io/npm/dt/commandkit?maxAge=3600&logo=npm"
alt="npm downloads"
/>
</a>
</div>
</div>

CommandKit is a powerful meta-framework for building Discord bots with [discord.js](https://discord.js.org/). It provides a simple and intuitive API for creating commands, handling interactions, and managing events. With CommandKit, you can focus on building your bot's features without worrying about the underlying complexities.
CommandKit is a powerful meta-framework for building Discord applications with [discord.js](https://discord.js.org/). It provides a simple and intuitive API for creating commands, handling interactions, and managing events. With CommandKit, you can focus on building your Discord application without worrying about the underlying complexities.

## Key Features
## Key features

- Beginner friendly 🚀
- Suitable for both beginners and advanced users 👶👨‍💻
- Slash + context menu commands + prefix commands support ✅
- Slash + context menu commands + message commands support ✅
- Automatic command registration and updates 🤖
- Command middlewares for easy command management 🛠️
- Localization support through `@commandkit/i18n` plugin 🌍
- Plugin system to extend functionality 🔌
- Localization support through [`@commandkit/i18n`](../05-official-plugins/05-commandkit-i18n.mdx) plugin 🌍
- Powerful plugin system to extend functionality 🔌
- Built-in command line interface for easy development 🖥️
- Out-of-the-box support for TypeScript and JavaScript 📜
- Built-in customizable cache system for speedy data storage and retrieval 🗄️
- Customizable caching using the [`@commandkit/cache`](../05-official-plugins/03-commandkit-cache.mdx) plugin for speedy data fetching 🗄️
- User installable/guild scoped commands 🔧
- Custom events support 🔔
- JSX support for declaring Discord interaction components and modals 🎨
- Easy to use interaction components and modals system (forget about collectors) 🧩
- JSX support for easily managing Discord components 🎨
- Easy to use interaction components (forget about collectors) 🧩
- Less boilerplate code, more productivity 💪
- and much more...
- ...and much more!

## Documentation
## Support and suggestions

You can start with the [setting up CommandKit](./02-setup-commandkit.mdx) guide to get your bot up and running quickly. The documentation covers everything from installation to advanced features.

## Support and Suggestions

Submit any queries or suggestions in our [Discord community](https://ctrl.lol/discord).
- [GitHub repository](https://github.com/underctrl-io/commandkit)
- [Discord community](https://ctrl.lol/discord)
48 changes: 25 additions & 23 deletions apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
---
title: Setup CommandKit
description: Setup a new CommandKit project manually, or using the create-commandkit CLI
description: Setup a new CommandKit project using the create-commandkit CLI
---

You can quickly setup a new CommandKit project using `create-commandkit` — a command-line utility used for creating new discord.js applications with CommandKit. To get started, run the following command:
:::warning

- CommandKit requires at least [Node.js](https://nodejs.org/) v22
- This documentation assumes that you have a basic understanding of how to use [discord.js](https://discord.js.org/). If you are new to discord.js, we recommend you to read the [discord.js guide](https://discordjs.guide/) first.
:::

The quickest way to setup a new CommandKit project is to use the `create-commandkit` CLI. To get started, run the following command in your terminal:

```sh npm2yarn
npx create-commandkit@latest
npm create commandkit@latest
```

This will start the CLI in the current directory which will help you quickly setup a base CommandKit project.
This will start the CLI in an interactive mode. You can follow the prompts to setup your project.

## Project structure

By using the CLI to create a base project, you should get a project structure that looks like this:
By using the CLI to create a base project, you should get a file tree that looks something like this:

```
.
Expand All @@ -32,41 +38,37 @@ By using the CLI to create a base project, you should get a project structure th
└── tsconfig.json
```

:::info
The `src/app.ts` file is the main entry point for your application. This file default exports the discord.js client which CommandKit loads at runtime. For example, the `src/app.ts` file looks like this:
## Entry point

```ts
The `src/app.ts` file is the main entry point for your application. This file default exports the discord.js client instance which CommandKit loads at runtime.

```ts title="src/app.ts"
import { Client } from 'discord.js';

const client = new Client({
intents: [
/* add stuff */
],
intents: ['Guilds', 'GuildMessages', 'MessageContent'],
});

// setting up the token manually
// Optional: Setting up the token manually
client.token = process.env.MY_BOT_TOKEN;

export default client;
```

Notice how we are not calling `client.login()` in this file. This is because CommandKit will automatically call `client.login()` for you when the application starts.
Notice how there's no `client.login()` in this file. This is because CommandKit will automatically handle the login process for you when the application starts.

Also, you might have noticed that we are not using anything from CommandKit in this file. This is because CommandKit is designed to reduce boilerplate code and make it easier to build discord bot applications.
:::
## Development version

:::info
The `src/app` directory is a special directory that CommandKit understands. All the commands and events in this directory will be automatically registered when the application starts.
:::
If you would like to try the latest development builds, you can use the `@dev` tag like so:

## Development version
```sh npm2yarn
npm create commandkit@dev
```

:::warning
The development version is likely to have bugs.
:::

If you'd like to try the latest development builds, you can use the `@dev` tag like so:
## Manual setup

```sh npm2yarn
npx create-commandkit@dev
```
Alternatively, if you would like to setup a new CommandKit project manually, you can follow [this guide](../08-advanced/01-setup-commandkit-manually.mdx).
48 changes: 48 additions & 0 deletions apps/website/docs/guide/02-commands/01-chat-input-commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Chat input commands
---

CommandKit provides a very simple way to manage your chat input (slash) commands, including registering them to the Discord API, as well as handling their execution.

To create a new chat input command, create a new file in the `src/app/commands` directory with the name of the command. This guide will create a basic ping command which will respond with "Pong!" when executed.

```ts title="src/app/commands/ping.ts"
import type { CommandData, ChatInputCommand } from 'commandkit';

export const command: CommandData = {
name: 'ping',
description: 'Replies with Pong!',
};

export const chatInput: ChatInputCommand = async (ctx) => {
await ctx.interaction.reply('Pong!');
};
```

## Exports explained

### `command`

This is the command data object which defines the shape of your command. This is directly registered to the Discord API everytime your commands are refreshed.

### `chatInput`

This is the main handler function for your chat input command. By exporting this function, CommandKit will know that it's a chat input command and will register and handle it accordingly.

:::tip
Chat input commands are just one of the command types that CommandKit supports. Learn more about [message commands](./04-message-commands.mdx) and [context menu commands](./03-context-menu-commands.mdx).
:::

## Guild-based commands

You can register your chat input command to specific guilds by using the `guilds` property in the `command` object which accepts an array of guild IDs.

```ts title="src/app/commands/ping.ts" {6}
import type { CommandData } from 'commandkit';

export const command: CommandData = {
name: 'ping',
description: 'Replies with Pong!',
guilds: ['1055188344188973066'],
};
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Command options autocomplete
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Context menu commands
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/02-commands/04-message-commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Message commands
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Custom message commands prefix
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/02-commands/06-after-function.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: after function
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/02-commands/07-category-directory.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Category directory
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Global middlewares
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Local middlewares
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Command scoped middlewares
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/03-events/01-discordjs-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Discord.js events
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/03-events/02-custom-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Custom events
---
3 changes: 3 additions & 0 deletions apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Using JSX
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Action row
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Button
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Select menu
---
Loading