-
-
Notifications
You must be signed in to change notification settings - Fork 12
Rewrite docs guide #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rewrite docs guide #253
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 2a9789a
refactor: remove unnecessary script
twlite 4bb30cd
fix: llms plugin url
twlite a93e247
docs: update versioning
notunderctrl 8518f35
docs: add getting started and advanced setup guides
notunderctrl aaa1a2c
docs: update styling + add chat input commands docs
notunderctrl 131f781
docs: fix wording
notunderctrl ba67067
Update apps/website/docs/guide.old/01-getting-started/02-setup-comman…
twlite f43d487
Update apps/website/docs/guide.old/01-getting-started/02-setup-comman…
twlite 3d05352
update prettier config
notunderctrl 45b1977
Merge branch 'main' into rewrite-docs
notunderctrl 08e293f
prettier format
notunderctrl 4258569
update gh actions node version to 24
notunderctrl b99d5de
fix tsdown entry
notunderctrl 9376e1e
update workflow + lint script to check-types
notunderctrl fa300e1
fix tooltips
notunderctrl 4884fbe
add options autocomplete docs
notunderctrl d338b45
fix autocomplete choices wording
notunderctrl 90d9768
add context menu command docs
notunderctrl 9770553
add message commands docs
notunderctrl 2c4928c
fix message command function name
notunderctrl 7fa4a77
document prefix resolver for message commands
notunderctrl 8bb6057
fix prettier formatting
notunderctrl 91f16e8
update prefix resolver example
notunderctrl 28f8fac
document `after` function
notunderctrl 252c289
document commands category dir
notunderctrl 78aac43
fix: entry build pattern for tsdown
notunderctrl 3fa55d9
fix turbo build output for docs
notunderctrl 879ed6b
fix command-scoped middleware + document middlewares
notunderctrl a8f7488
document discord.js events
notunderctrl 884cc0f
add class links
notunderctrl eff1535
document custom events
notunderctrl b612e03
fix typo
notunderctrl fe64394
document v0 -> v1 migration
notunderctrl f2a91e1
document sharding
notunderctrl bc27565
setup community plugins page structure
notunderctrl 816bbae
document file naming conventions
notunderctrl f0838d6
custom events doc tweaks
notunderctrl 35f712d
update utilities tone
notunderctrl d1f7008
document plugins + utilities
notunderctrl 83ed02a
update utilities naming
notunderctrl acdaab8
document `@commandkit/cache`
notunderctrl 75b5ae2
document `@commandkit/ai`
notunderctrl 15f7a4d
document `stopEvents()` function
notunderctrl f34b146
document `@commandkit/analytics`
notunderctrl 3c35878
document feature flags
notunderctrl 1713bbd
document `@commandkit/devtools`
notunderctrl 2025fbc
document `@commandkit/i18n`
notunderctrl dbcf3d7
document `@commandkit/legacy` and `@commandkit/redis`
notunderctrl 0c3972a
document creating a plugin
notunderctrl 5a093db
document jsx components
notunderctrl c89d7bd
docs: add ai plugin architecture diagram
twlite af979e9
Update apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx
twlite c91f62c
Merge pull request #467 from underctrl-io/twlite-patch-1
twlite 85b5d4d
Merge branch 'main' of https://github.com/underctrl-io/commandkit int…
twlite e10de86
update contributing.md
notunderctrl 1220a05
prettier format
notunderctrl c90197e
docs: remove oudated callout
notunderctrl 7fc7c54
feat: add EventHandler type
notunderctrl 4474a31
fix broken link + codeblock titles
notunderctrl 8e750ed
docgen + add publish-rc gh action
notunderctrl a3049bb
update versioning
notunderctrl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
apps/website/docs/guide.old/01-getting-started/01-introduction.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
72 changes: 72 additions & 0 deletions
72
apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
twlite marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
apps/website/docs/guide/02-commands/01-chat-input-commands.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
}; | ||
``` |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Command options autocomplete | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/03-context-menu-commands.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Context menu commands | ||
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Message commands | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/05-custom-message-commands-prefix.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Custom message commands prefix | ||
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: after function | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/07-category-directory.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Category directory | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/08-middlewares/01-global-middlewares.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Global middlewares | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/02-commands/08-middlewares/02-local-middlewares.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Local middlewares | ||
--- |
3 changes: 3 additions & 0 deletions
3
...website/docs/guide/02-commands/08-middlewares/03-command-scoped-middlewares.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Command scoped middlewares | ||
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Discord.js events | ||
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Custom events | ||
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Using JSX | ||
--- |
3 changes: 3 additions & 0 deletions
3
...website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Action row | ||
--- |
3 changes: 3 additions & 0 deletions
3
apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Button | ||
--- |
3 changes: 3 additions & 0 deletions
3
...ebsite/docs/guide/04-jsx-components/02-discord-components-v1/03-select-menu.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Select menu | ||
--- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.