From 10ad4f9e4f9f1d1ef08202e8c37120c4eff40091 Mon Sep 17 00:00:00 2001 From: Avraj Date: Sat, 14 Jun 2025 19:40:17 +0300 Subject: [PATCH 1/9] docs: setup new guide structure --- .../01-getting-started/01-introduction.mdx | 70 ++++++++++++++++++ .../02-setup-commandkit.mdx | 72 +++++++++++++++++++ .../03-setup-commandkit-manually.mdx | 0 .../04-commandkit-config.mdx | 0 .../05-using-commandkit-cli.mdx | 0 .../06-onApplicationBootstrap-function.mdx | 0 .../99-migrating-from-v0.mdx | 0 .../02-message-components/01-buttonkit.mdx | 0 .../02-message-components/02-modalkit.mdx | 0 .../03-selectmenukit.mdx | 0 .../03-jsx-components/01-using-jsx.mdx | 0 .../components-v1/01-action-row.mdx | 0 .../components-v1/02-button.mdx | 0 .../components-v1/03-select-menu.mdx | 0 .../components-v1/04-modal.mdx | 0 .../components-v2/01-text-display.mdx | 0 .../components-v2/02-container.mdx | 0 .../components-v2/03-media-gallery.mdx | 0 .../components-v2/04-section-separator.mdx | 0 .../components-v2/05-file.mdx | 0 .../04-caching/01-caching-in-commandkit.mdx | 0 .../04-caching/02-cacheTag-function.mdx | 0 .../04-caching/03-cacheLife-function.mdx | 0 .../04-caching/05-revalidateTag-function.mdx | 0 .../04-caching/06-cleanup-function.mdx | 0 .../01-message-commands.mdx | 0 .../02-resolve-message-commands-prefix.mdx | 0 .../06-plugins/01-commandkit-plugins.mdx | 0 .../02-creating-a-compiler-plugin.mdx | 0 .../03-creating-a-runtime-plugin.mdx | 0 .../06-plugins/official-plugins/00-cache.mdx | 0 .../06-plugins/official-plugins/01-redis.mdx | 0 .../06-plugins/official-plugins/02-i18n.mdx | 0 .../06-plugins/official-plugins/03-legacy.mdx | 0 .../official-plugins/04-devtools.mdx | 0 .../official-plugins/05-analytics.mdx | 0 .../06-plugins/official-plugins/06-ai.mdx | 0 .../07-file-system-conventions/01-app.ts.mdx | 0 .../02-+middleware.ts.mdx | 0 .../03-category-directory.mdx | 0 .../04-commands-directory.mdx | 0 .../05-events-directory.mdx | 0 .../06-locales-directory.mdx | 0 .../07-command-file.mdx | 0 .../08-sharding/01-sharding.mdx | 0 .../09-feature-flags/01-feature-flags.mdx | 0 .../09-feature-flags/02-custom-providers.mdx | 0 .../01-analytics-in-commandkit.mdx | 0 .../10-analytics/02-posthog.mdx | 0 .../10-analytics/03-umami.mdx | 0 .../10-analytics/04-custom-providers.mdx | 0 .../11-localization/01-introduction.mdx | 0 .../02-commands-localization.mdx | 0 .../03-events-localization.mdx | 0 .../04-usage-with-legacy-plugin.mdx | 0 .../12-devtools/01-introduction.mdx | 0 .../01-introduction.mdx | 0 .../02-ai-configuration.mdx | 0 .../03-creating-ai-commands.mdx | 0 .../04-ai-context-hooks.mdx | 0 .../05-advanced-configuration.mdx | 0 .../06-custom-tools.mdx | 0 .../07-best-practices.mdx | 0 .../08-troubleshooting.mdx | 0 .../99-helper-functions/01-after.mdx | 0 .../99-helper-functions/02-stopEvents.mdx | 0 .../01-getting-started/01-introduction.mdx | 67 ----------------- .../02-setup-commandkit.mdx | 69 ------------------ .../02-commands/01-chat-input-commands.mdx | 3 + .../02-command-options-autocomplete.mdx | 3 + .../02-commands/03-context-menu-commands.mdx | 3 + .../guide/02-commands/04-message-commands.mdx | 3 + .../05-custom-message-commands-prefix.mdx | 3 + .../guide/02-commands/06-after-function.mdx | 3 + .../02-commands/07-category-directory.mdx | 3 + .../08-middlewares/01-global-middlewares.mdx | 3 + .../08-middlewares/02-local-middlewares.mdx | 3 + .../03-command-scoped-middlewares.mdx | 3 + .../guide/03-events/01-discordjs-events.mdx | 3 + .../docs/guide/03-events/02-custom-events.mdx | 3 + .../guide/04-jsx-components/01-using-jsx.mdx | 3 + .../01-action-row.mdx | 3 + .../02-discord-components-v1/02-button.mdx | 3 + .../03-select-menu.mdx | 3 + .../02-discord-components-v1/04-modal.mdx | 3 + .../01-text-display.mdx | 3 + .../03-discord-components-v2/02-container.mdx | 3 + .../03-media-gallery.mdx | 3 + .../04-section-separator.mdx | 3 + .../03-discord-components-v2/05-file.mdx | 3 + .../05-official-plugins/01-commandkit-ai.mdx | 3 + .../02-commandkit-analytics.mdx | 3 + .../03-commandkit-cache.mdx | 3 + .../04-commandkit-devtools.mdx | 3 + .../05-commandkit-i18n.mdx | 3 + .../06-commandkit-legacy.mdx | 3 + .../07-commandkit-redis.mdx | 3 + .../08-commandkit-tasks.mdx | 3 + .../docs/guide/06-community-plugins.mdx | 3 + .../01-creating-runtime-plugin.mdx | 3 + .../02-creating-compiler-plugin.mdx | 3 + .../01-setup-commandkit-manually.mdx | 3 + .../02-file-naming-conventions.mdx | 3 + .../08-advanced/03-sharding-your-bot.mdx | 3 + .../08-advanced/04-migrating-from-v0.mdx | 3 + 105 files changed, 253 insertions(+), 136 deletions(-) create mode 100644 apps/website/docs/guide.old/01-getting-started/01-introduction.mdx create mode 100644 apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx rename apps/website/docs/{guide => guide.old}/01-getting-started/03-setup-commandkit-manually.mdx (100%) rename apps/website/docs/{guide => guide.old}/01-getting-started/04-commandkit-config.mdx (100%) rename apps/website/docs/{guide => guide.old}/01-getting-started/05-using-commandkit-cli.mdx (100%) rename apps/website/docs/{guide => guide.old}/01-getting-started/06-onApplicationBootstrap-function.mdx (100%) rename apps/website/docs/{guide => guide.old}/01-getting-started/99-migrating-from-v0.mdx (100%) rename apps/website/docs/{guide => guide.old}/02-message-components/01-buttonkit.mdx (100%) rename apps/website/docs/{guide => guide.old}/02-message-components/02-modalkit.mdx (100%) rename apps/website/docs/{guide => guide.old}/02-message-components/03-selectmenukit.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/01-using-jsx.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v1/01-action-row.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v1/02-button.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v1/03-select-menu.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v1/04-modal.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v2/01-text-display.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v2/02-container.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v2/03-media-gallery.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v2/04-section-separator.mdx (100%) rename apps/website/docs/{guide => guide.old}/03-jsx-components/components-v2/05-file.mdx (100%) rename apps/website/docs/{guide => guide.old}/04-caching/01-caching-in-commandkit.mdx (100%) rename apps/website/docs/{guide => guide.old}/04-caching/02-cacheTag-function.mdx (100%) rename apps/website/docs/{guide => guide.old}/04-caching/03-cacheLife-function.mdx (100%) rename apps/website/docs/{guide => guide.old}/04-caching/05-revalidateTag-function.mdx (100%) rename apps/website/docs/{guide => guide.old}/04-caching/06-cleanup-function.mdx (100%) rename apps/website/docs/{guide => guide.old}/05-message-commands/01-message-commands.mdx (100%) rename apps/website/docs/{guide => guide.old}/05-message-commands/02-resolve-message-commands-prefix.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/01-commandkit-plugins.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/02-creating-a-compiler-plugin.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/03-creating-a-runtime-plugin.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/00-cache.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/01-redis.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/02-i18n.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/03-legacy.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/04-devtools.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/05-analytics.mdx (100%) rename apps/website/docs/{guide => guide.old}/06-plugins/official-plugins/06-ai.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/01-app.ts.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/02-+middleware.ts.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/03-category-directory.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/04-commands-directory.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/05-events-directory.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/06-locales-directory.mdx (100%) rename apps/website/docs/{guide => guide.old}/07-file-system-conventions/07-command-file.mdx (100%) rename apps/website/docs/{guide => guide.old}/08-sharding/01-sharding.mdx (100%) rename apps/website/docs/{guide => guide.old}/09-feature-flags/01-feature-flags.mdx (100%) rename apps/website/docs/{guide => guide.old}/09-feature-flags/02-custom-providers.mdx (100%) rename apps/website/docs/{guide => guide.old}/10-analytics/01-analytics-in-commandkit.mdx (100%) rename apps/website/docs/{guide => guide.old}/10-analytics/02-posthog.mdx (100%) rename apps/website/docs/{guide => guide.old}/10-analytics/03-umami.mdx (100%) rename apps/website/docs/{guide => guide.old}/10-analytics/04-custom-providers.mdx (100%) rename apps/website/docs/{guide => guide.old}/11-localization/01-introduction.mdx (100%) rename apps/website/docs/{guide => guide.old}/11-localization/02-commands-localization.mdx (100%) rename apps/website/docs/{guide => guide.old}/11-localization/03-events-localization.mdx (100%) rename apps/website/docs/{guide => guide.old}/11-localization/04-usage-with-legacy-plugin.mdx (100%) rename apps/website/docs/{guide => guide.old}/12-devtools/01-introduction.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/01-introduction.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/02-ai-configuration.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/03-creating-ai-commands.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/04-ai-context-hooks.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/05-advanced-configuration.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/06-custom-tools.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/07-best-practices.mdx (100%) rename apps/website/docs/{guide => guide.old}/13-ai-powered-commands/08-troubleshooting.mdx (100%) rename apps/website/docs/{guide => guide.old}/99-helper-functions/01-after.mdx (100%) rename apps/website/docs/{guide => guide.old}/99-helper-functions/02-stopEvents.mdx (100%) create mode 100644 apps/website/docs/guide/02-commands/01-chat-input-commands.mdx create mode 100644 apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx create mode 100644 apps/website/docs/guide/02-commands/03-context-menu-commands.mdx create mode 100644 apps/website/docs/guide/02-commands/04-message-commands.mdx create mode 100644 apps/website/docs/guide/02-commands/05-custom-message-commands-prefix.mdx create mode 100644 apps/website/docs/guide/02-commands/06-after-function.mdx create mode 100644 apps/website/docs/guide/02-commands/07-category-directory.mdx create mode 100644 apps/website/docs/guide/02-commands/08-middlewares/01-global-middlewares.mdx create mode 100644 apps/website/docs/guide/02-commands/08-middlewares/02-local-middlewares.mdx create mode 100644 apps/website/docs/guide/02-commands/08-middlewares/03-command-scoped-middlewares.mdx create mode 100644 apps/website/docs/guide/03-events/01-discordjs-events.mdx create mode 100644 apps/website/docs/guide/03-events/02-custom-events.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/02-discord-components-v1/03-select-menu.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/02-discord-components-v1/04-modal.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/03-discord-components-v2/01-text-display.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/03-discord-components-v2/02-container.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/03-discord-components-v2/03-media-gallery.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/03-discord-components-v2/04-section-separator.mdx create mode 100644 apps/website/docs/guide/04-jsx-components/03-discord-components-v2/05-file.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/02-commandkit-analytics.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/03-commandkit-cache.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/04-commandkit-devtools.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/05-commandkit-i18n.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/06-commandkit-legacy.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/07-commandkit-redis.mdx create mode 100644 apps/website/docs/guide/05-official-plugins/08-commandkit-tasks.mdx create mode 100644 apps/website/docs/guide/06-community-plugins.mdx create mode 100644 apps/website/docs/guide/07-creating-plugins/01-creating-runtime-plugin.mdx create mode 100644 apps/website/docs/guide/07-creating-plugins/02-creating-compiler-plugin.mdx create mode 100644 apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx create mode 100644 apps/website/docs/guide/08-advanced/02-file-naming-conventions.mdx create mode 100644 apps/website/docs/guide/08-advanced/03-sharding-your-bot.mdx create mode 100644 apps/website/docs/guide/08-advanced/04-migrating-from-v0.mdx diff --git a/apps/website/docs/guide.old/01-getting-started/01-introduction.mdx b/apps/website/docs/guide.old/01-getting-started/01-introduction.mdx new file mode 100644 index 00000000..f6bae71d --- /dev/null +++ b/apps/website/docs/guide.old/01-getting-started/01-introduction.mdx @@ -0,0 +1,70 @@ +--- +title: Introduction +description: A brief intro to CommandKit +--- + +
+ +
+
+ + support discord server + + + npm version + + + npm downloads + +
+
+ +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). diff --git a/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx new file mode 100644 index 00000000..f18564ec --- /dev/null +++ b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx @@ -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 +``` diff --git a/apps/website/docs/guide/01-getting-started/03-setup-commandkit-manually.mdx b/apps/website/docs/guide.old/01-getting-started/03-setup-commandkit-manually.mdx similarity index 100% rename from apps/website/docs/guide/01-getting-started/03-setup-commandkit-manually.mdx rename to apps/website/docs/guide.old/01-getting-started/03-setup-commandkit-manually.mdx diff --git a/apps/website/docs/guide/01-getting-started/04-commandkit-config.mdx b/apps/website/docs/guide.old/01-getting-started/04-commandkit-config.mdx similarity index 100% rename from apps/website/docs/guide/01-getting-started/04-commandkit-config.mdx rename to apps/website/docs/guide.old/01-getting-started/04-commandkit-config.mdx diff --git a/apps/website/docs/guide/01-getting-started/05-using-commandkit-cli.mdx b/apps/website/docs/guide.old/01-getting-started/05-using-commandkit-cli.mdx similarity index 100% rename from apps/website/docs/guide/01-getting-started/05-using-commandkit-cli.mdx rename to apps/website/docs/guide.old/01-getting-started/05-using-commandkit-cli.mdx diff --git a/apps/website/docs/guide/01-getting-started/06-onApplicationBootstrap-function.mdx b/apps/website/docs/guide.old/01-getting-started/06-onApplicationBootstrap-function.mdx similarity index 100% rename from apps/website/docs/guide/01-getting-started/06-onApplicationBootstrap-function.mdx rename to apps/website/docs/guide.old/01-getting-started/06-onApplicationBootstrap-function.mdx diff --git a/apps/website/docs/guide/01-getting-started/99-migrating-from-v0.mdx b/apps/website/docs/guide.old/01-getting-started/99-migrating-from-v0.mdx similarity index 100% rename from apps/website/docs/guide/01-getting-started/99-migrating-from-v0.mdx rename to apps/website/docs/guide.old/01-getting-started/99-migrating-from-v0.mdx diff --git a/apps/website/docs/guide/02-message-components/01-buttonkit.mdx b/apps/website/docs/guide.old/02-message-components/01-buttonkit.mdx similarity index 100% rename from apps/website/docs/guide/02-message-components/01-buttonkit.mdx rename to apps/website/docs/guide.old/02-message-components/01-buttonkit.mdx diff --git a/apps/website/docs/guide/02-message-components/02-modalkit.mdx b/apps/website/docs/guide.old/02-message-components/02-modalkit.mdx similarity index 100% rename from apps/website/docs/guide/02-message-components/02-modalkit.mdx rename to apps/website/docs/guide.old/02-message-components/02-modalkit.mdx diff --git a/apps/website/docs/guide/02-message-components/03-selectmenukit.mdx b/apps/website/docs/guide.old/02-message-components/03-selectmenukit.mdx similarity index 100% rename from apps/website/docs/guide/02-message-components/03-selectmenukit.mdx rename to apps/website/docs/guide.old/02-message-components/03-selectmenukit.mdx diff --git a/apps/website/docs/guide/03-jsx-components/01-using-jsx.mdx b/apps/website/docs/guide.old/03-jsx-components/01-using-jsx.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/01-using-jsx.mdx rename to apps/website/docs/guide.old/03-jsx-components/01-using-jsx.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v1/01-action-row.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v1/01-action-row.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v1/01-action-row.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v1/01-action-row.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v1/02-button.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v1/02-button.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v1/02-button.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v1/02-button.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v1/03-select-menu.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v1/03-select-menu.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v1/03-select-menu.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v1/03-select-menu.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v1/04-modal.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v1/04-modal.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v1/04-modal.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v1/04-modal.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v2/01-text-display.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v2/01-text-display.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v2/01-text-display.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v2/01-text-display.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v2/02-container.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v2/02-container.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v2/02-container.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v2/02-container.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v2/03-media-gallery.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v2/03-media-gallery.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v2/03-media-gallery.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v2/03-media-gallery.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v2/04-section-separator.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v2/04-section-separator.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v2/04-section-separator.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v2/04-section-separator.mdx diff --git a/apps/website/docs/guide/03-jsx-components/components-v2/05-file.mdx b/apps/website/docs/guide.old/03-jsx-components/components-v2/05-file.mdx similarity index 100% rename from apps/website/docs/guide/03-jsx-components/components-v2/05-file.mdx rename to apps/website/docs/guide.old/03-jsx-components/components-v2/05-file.mdx diff --git a/apps/website/docs/guide/04-caching/01-caching-in-commandkit.mdx b/apps/website/docs/guide.old/04-caching/01-caching-in-commandkit.mdx similarity index 100% rename from apps/website/docs/guide/04-caching/01-caching-in-commandkit.mdx rename to apps/website/docs/guide.old/04-caching/01-caching-in-commandkit.mdx diff --git a/apps/website/docs/guide/04-caching/02-cacheTag-function.mdx b/apps/website/docs/guide.old/04-caching/02-cacheTag-function.mdx similarity index 100% rename from apps/website/docs/guide/04-caching/02-cacheTag-function.mdx rename to apps/website/docs/guide.old/04-caching/02-cacheTag-function.mdx diff --git a/apps/website/docs/guide/04-caching/03-cacheLife-function.mdx b/apps/website/docs/guide.old/04-caching/03-cacheLife-function.mdx similarity index 100% rename from apps/website/docs/guide/04-caching/03-cacheLife-function.mdx rename to apps/website/docs/guide.old/04-caching/03-cacheLife-function.mdx diff --git a/apps/website/docs/guide/04-caching/05-revalidateTag-function.mdx b/apps/website/docs/guide.old/04-caching/05-revalidateTag-function.mdx similarity index 100% rename from apps/website/docs/guide/04-caching/05-revalidateTag-function.mdx rename to apps/website/docs/guide.old/04-caching/05-revalidateTag-function.mdx diff --git a/apps/website/docs/guide/04-caching/06-cleanup-function.mdx b/apps/website/docs/guide.old/04-caching/06-cleanup-function.mdx similarity index 100% rename from apps/website/docs/guide/04-caching/06-cleanup-function.mdx rename to apps/website/docs/guide.old/04-caching/06-cleanup-function.mdx diff --git a/apps/website/docs/guide/05-message-commands/01-message-commands.mdx b/apps/website/docs/guide.old/05-message-commands/01-message-commands.mdx similarity index 100% rename from apps/website/docs/guide/05-message-commands/01-message-commands.mdx rename to apps/website/docs/guide.old/05-message-commands/01-message-commands.mdx diff --git a/apps/website/docs/guide/05-message-commands/02-resolve-message-commands-prefix.mdx b/apps/website/docs/guide.old/05-message-commands/02-resolve-message-commands-prefix.mdx similarity index 100% rename from apps/website/docs/guide/05-message-commands/02-resolve-message-commands-prefix.mdx rename to apps/website/docs/guide.old/05-message-commands/02-resolve-message-commands-prefix.mdx diff --git a/apps/website/docs/guide/06-plugins/01-commandkit-plugins.mdx b/apps/website/docs/guide.old/06-plugins/01-commandkit-plugins.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/01-commandkit-plugins.mdx rename to apps/website/docs/guide.old/06-plugins/01-commandkit-plugins.mdx diff --git a/apps/website/docs/guide/06-plugins/02-creating-a-compiler-plugin.mdx b/apps/website/docs/guide.old/06-plugins/02-creating-a-compiler-plugin.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/02-creating-a-compiler-plugin.mdx rename to apps/website/docs/guide.old/06-plugins/02-creating-a-compiler-plugin.mdx diff --git a/apps/website/docs/guide/06-plugins/03-creating-a-runtime-plugin.mdx b/apps/website/docs/guide.old/06-plugins/03-creating-a-runtime-plugin.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/03-creating-a-runtime-plugin.mdx rename to apps/website/docs/guide.old/06-plugins/03-creating-a-runtime-plugin.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/00-cache.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/00-cache.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/00-cache.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/00-cache.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/01-redis.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/01-redis.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/01-redis.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/01-redis.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/02-i18n.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/02-i18n.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/02-i18n.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/02-i18n.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/03-legacy.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/03-legacy.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/03-legacy.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/03-legacy.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/04-devtools.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/04-devtools.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/04-devtools.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/04-devtools.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/05-analytics.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/05-analytics.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/05-analytics.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/05-analytics.mdx diff --git a/apps/website/docs/guide/06-plugins/official-plugins/06-ai.mdx b/apps/website/docs/guide.old/06-plugins/official-plugins/06-ai.mdx similarity index 100% rename from apps/website/docs/guide/06-plugins/official-plugins/06-ai.mdx rename to apps/website/docs/guide.old/06-plugins/official-plugins/06-ai.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/01-app.ts.mdx b/apps/website/docs/guide.old/07-file-system-conventions/01-app.ts.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/01-app.ts.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/01-app.ts.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/02-+middleware.ts.mdx b/apps/website/docs/guide.old/07-file-system-conventions/02-+middleware.ts.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/02-+middleware.ts.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/02-+middleware.ts.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/03-category-directory.mdx b/apps/website/docs/guide.old/07-file-system-conventions/03-category-directory.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/03-category-directory.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/03-category-directory.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/04-commands-directory.mdx b/apps/website/docs/guide.old/07-file-system-conventions/04-commands-directory.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/04-commands-directory.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/04-commands-directory.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/05-events-directory.mdx b/apps/website/docs/guide.old/07-file-system-conventions/05-events-directory.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/05-events-directory.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/05-events-directory.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/06-locales-directory.mdx b/apps/website/docs/guide.old/07-file-system-conventions/06-locales-directory.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/06-locales-directory.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/06-locales-directory.mdx diff --git a/apps/website/docs/guide/07-file-system-conventions/07-command-file.mdx b/apps/website/docs/guide.old/07-file-system-conventions/07-command-file.mdx similarity index 100% rename from apps/website/docs/guide/07-file-system-conventions/07-command-file.mdx rename to apps/website/docs/guide.old/07-file-system-conventions/07-command-file.mdx diff --git a/apps/website/docs/guide/08-sharding/01-sharding.mdx b/apps/website/docs/guide.old/08-sharding/01-sharding.mdx similarity index 100% rename from apps/website/docs/guide/08-sharding/01-sharding.mdx rename to apps/website/docs/guide.old/08-sharding/01-sharding.mdx diff --git a/apps/website/docs/guide/09-feature-flags/01-feature-flags.mdx b/apps/website/docs/guide.old/09-feature-flags/01-feature-flags.mdx similarity index 100% rename from apps/website/docs/guide/09-feature-flags/01-feature-flags.mdx rename to apps/website/docs/guide.old/09-feature-flags/01-feature-flags.mdx diff --git a/apps/website/docs/guide/09-feature-flags/02-custom-providers.mdx b/apps/website/docs/guide.old/09-feature-flags/02-custom-providers.mdx similarity index 100% rename from apps/website/docs/guide/09-feature-flags/02-custom-providers.mdx rename to apps/website/docs/guide.old/09-feature-flags/02-custom-providers.mdx diff --git a/apps/website/docs/guide/10-analytics/01-analytics-in-commandkit.mdx b/apps/website/docs/guide.old/10-analytics/01-analytics-in-commandkit.mdx similarity index 100% rename from apps/website/docs/guide/10-analytics/01-analytics-in-commandkit.mdx rename to apps/website/docs/guide.old/10-analytics/01-analytics-in-commandkit.mdx diff --git a/apps/website/docs/guide/10-analytics/02-posthog.mdx b/apps/website/docs/guide.old/10-analytics/02-posthog.mdx similarity index 100% rename from apps/website/docs/guide/10-analytics/02-posthog.mdx rename to apps/website/docs/guide.old/10-analytics/02-posthog.mdx diff --git a/apps/website/docs/guide/10-analytics/03-umami.mdx b/apps/website/docs/guide.old/10-analytics/03-umami.mdx similarity index 100% rename from apps/website/docs/guide/10-analytics/03-umami.mdx rename to apps/website/docs/guide.old/10-analytics/03-umami.mdx diff --git a/apps/website/docs/guide/10-analytics/04-custom-providers.mdx b/apps/website/docs/guide.old/10-analytics/04-custom-providers.mdx similarity index 100% rename from apps/website/docs/guide/10-analytics/04-custom-providers.mdx rename to apps/website/docs/guide.old/10-analytics/04-custom-providers.mdx diff --git a/apps/website/docs/guide/11-localization/01-introduction.mdx b/apps/website/docs/guide.old/11-localization/01-introduction.mdx similarity index 100% rename from apps/website/docs/guide/11-localization/01-introduction.mdx rename to apps/website/docs/guide.old/11-localization/01-introduction.mdx diff --git a/apps/website/docs/guide/11-localization/02-commands-localization.mdx b/apps/website/docs/guide.old/11-localization/02-commands-localization.mdx similarity index 100% rename from apps/website/docs/guide/11-localization/02-commands-localization.mdx rename to apps/website/docs/guide.old/11-localization/02-commands-localization.mdx diff --git a/apps/website/docs/guide/11-localization/03-events-localization.mdx b/apps/website/docs/guide.old/11-localization/03-events-localization.mdx similarity index 100% rename from apps/website/docs/guide/11-localization/03-events-localization.mdx rename to apps/website/docs/guide.old/11-localization/03-events-localization.mdx diff --git a/apps/website/docs/guide/11-localization/04-usage-with-legacy-plugin.mdx b/apps/website/docs/guide.old/11-localization/04-usage-with-legacy-plugin.mdx similarity index 100% rename from apps/website/docs/guide/11-localization/04-usage-with-legacy-plugin.mdx rename to apps/website/docs/guide.old/11-localization/04-usage-with-legacy-plugin.mdx diff --git a/apps/website/docs/guide/12-devtools/01-introduction.mdx b/apps/website/docs/guide.old/12-devtools/01-introduction.mdx similarity index 100% rename from apps/website/docs/guide/12-devtools/01-introduction.mdx rename to apps/website/docs/guide.old/12-devtools/01-introduction.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/01-introduction.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/01-introduction.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/01-introduction.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/01-introduction.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/02-ai-configuration.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/02-ai-configuration.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/02-ai-configuration.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/02-ai-configuration.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/03-creating-ai-commands.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/03-creating-ai-commands.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/03-creating-ai-commands.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/03-creating-ai-commands.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/04-ai-context-hooks.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/04-ai-context-hooks.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/04-ai-context-hooks.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/04-ai-context-hooks.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/05-advanced-configuration.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/05-advanced-configuration.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/05-advanced-configuration.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/05-advanced-configuration.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/06-custom-tools.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/06-custom-tools.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/06-custom-tools.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/06-custom-tools.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/07-best-practices.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/07-best-practices.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/07-best-practices.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/07-best-practices.mdx diff --git a/apps/website/docs/guide/13-ai-powered-commands/08-troubleshooting.mdx b/apps/website/docs/guide.old/13-ai-powered-commands/08-troubleshooting.mdx similarity index 100% rename from apps/website/docs/guide/13-ai-powered-commands/08-troubleshooting.mdx rename to apps/website/docs/guide.old/13-ai-powered-commands/08-troubleshooting.mdx diff --git a/apps/website/docs/guide/99-helper-functions/01-after.mdx b/apps/website/docs/guide.old/99-helper-functions/01-after.mdx similarity index 100% rename from apps/website/docs/guide/99-helper-functions/01-after.mdx rename to apps/website/docs/guide.old/99-helper-functions/01-after.mdx diff --git a/apps/website/docs/guide/99-helper-functions/02-stopEvents.mdx b/apps/website/docs/guide.old/99-helper-functions/02-stopEvents.mdx similarity index 100% rename from apps/website/docs/guide/99-helper-functions/02-stopEvents.mdx rename to apps/website/docs/guide.old/99-helper-functions/02-stopEvents.mdx diff --git a/apps/website/docs/guide/01-getting-started/01-introduction.mdx b/apps/website/docs/guide/01-getting-started/01-introduction.mdx index f6bae71d..8f14f7a7 100644 --- a/apps/website/docs/guide/01-getting-started/01-introduction.mdx +++ b/apps/website/docs/guide/01-getting-started/01-introduction.mdx @@ -1,70 +1,3 @@ --- title: Introduction -description: A brief intro to CommandKit --- - -
- -
-
- - support discord server - - - npm version - - - npm downloads - -
-
- -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). diff --git a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx index f18564ec..354cd676 100644 --- a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx +++ b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx @@ -1,72 +1,3 @@ --- 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 -``` diff --git a/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx new file mode 100644 index 00000000..c2ed4d81 --- /dev/null +++ b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx @@ -0,0 +1,3 @@ +--- +title: Chat input commands +--- diff --git a/apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx b/apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx new file mode 100644 index 00000000..6ed82aae --- /dev/null +++ b/apps/website/docs/guide/02-commands/02-command-options-autocomplete.mdx @@ -0,0 +1,3 @@ +--- +title: Command options autocomplete +--- diff --git a/apps/website/docs/guide/02-commands/03-context-menu-commands.mdx b/apps/website/docs/guide/02-commands/03-context-menu-commands.mdx new file mode 100644 index 00000000..0a4a5021 --- /dev/null +++ b/apps/website/docs/guide/02-commands/03-context-menu-commands.mdx @@ -0,0 +1,3 @@ +--- +title: Context menu commands +--- diff --git a/apps/website/docs/guide/02-commands/04-message-commands.mdx b/apps/website/docs/guide/02-commands/04-message-commands.mdx new file mode 100644 index 00000000..d3ae16d7 --- /dev/null +++ b/apps/website/docs/guide/02-commands/04-message-commands.mdx @@ -0,0 +1,3 @@ +--- +title: Message commands +--- diff --git a/apps/website/docs/guide/02-commands/05-custom-message-commands-prefix.mdx b/apps/website/docs/guide/02-commands/05-custom-message-commands-prefix.mdx new file mode 100644 index 00000000..935ddbe5 --- /dev/null +++ b/apps/website/docs/guide/02-commands/05-custom-message-commands-prefix.mdx @@ -0,0 +1,3 @@ +--- +title: Custom message commands prefix +--- diff --git a/apps/website/docs/guide/02-commands/06-after-function.mdx b/apps/website/docs/guide/02-commands/06-after-function.mdx new file mode 100644 index 00000000..a515df3e --- /dev/null +++ b/apps/website/docs/guide/02-commands/06-after-function.mdx @@ -0,0 +1,3 @@ +--- +title: after function +--- diff --git a/apps/website/docs/guide/02-commands/07-category-directory.mdx b/apps/website/docs/guide/02-commands/07-category-directory.mdx new file mode 100644 index 00000000..5c0bcf23 --- /dev/null +++ b/apps/website/docs/guide/02-commands/07-category-directory.mdx @@ -0,0 +1,3 @@ +--- +title: Category directory +--- diff --git a/apps/website/docs/guide/02-commands/08-middlewares/01-global-middlewares.mdx b/apps/website/docs/guide/02-commands/08-middlewares/01-global-middlewares.mdx new file mode 100644 index 00000000..1337c854 --- /dev/null +++ b/apps/website/docs/guide/02-commands/08-middlewares/01-global-middlewares.mdx @@ -0,0 +1,3 @@ +--- +title: Global middlewares +--- diff --git a/apps/website/docs/guide/02-commands/08-middlewares/02-local-middlewares.mdx b/apps/website/docs/guide/02-commands/08-middlewares/02-local-middlewares.mdx new file mode 100644 index 00000000..b80de134 --- /dev/null +++ b/apps/website/docs/guide/02-commands/08-middlewares/02-local-middlewares.mdx @@ -0,0 +1,3 @@ +--- +title: Local middlewares +--- diff --git a/apps/website/docs/guide/02-commands/08-middlewares/03-command-scoped-middlewares.mdx b/apps/website/docs/guide/02-commands/08-middlewares/03-command-scoped-middlewares.mdx new file mode 100644 index 00000000..e9a120ba --- /dev/null +++ b/apps/website/docs/guide/02-commands/08-middlewares/03-command-scoped-middlewares.mdx @@ -0,0 +1,3 @@ +--- +title: Command scoped middlewares +--- diff --git a/apps/website/docs/guide/03-events/01-discordjs-events.mdx b/apps/website/docs/guide/03-events/01-discordjs-events.mdx new file mode 100644 index 00000000..54ab2fc7 --- /dev/null +++ b/apps/website/docs/guide/03-events/01-discordjs-events.mdx @@ -0,0 +1,3 @@ +--- +title: Discord.js events +--- diff --git a/apps/website/docs/guide/03-events/02-custom-events.mdx b/apps/website/docs/guide/03-events/02-custom-events.mdx new file mode 100644 index 00000000..207fd5d4 --- /dev/null +++ b/apps/website/docs/guide/03-events/02-custom-events.mdx @@ -0,0 +1,3 @@ +--- +title: Custom events +--- diff --git a/apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx b/apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx new file mode 100644 index 00000000..0cc59c44 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/01-using-jsx.mdx @@ -0,0 +1,3 @@ +--- +title: Using JSX +--- diff --git a/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx new file mode 100644 index 00000000..e7d21e39 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/01-action-row.mdx @@ -0,0 +1,3 @@ +--- +title: Action row +--- diff --git a/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx new file mode 100644 index 00000000..2b380f7e --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/02-button.mdx @@ -0,0 +1,3 @@ +--- +title: Button +--- diff --git a/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/03-select-menu.mdx b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/03-select-menu.mdx new file mode 100644 index 00000000..73b19b33 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/03-select-menu.mdx @@ -0,0 +1,3 @@ +--- +title: Select menu +--- diff --git a/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/04-modal.mdx b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/04-modal.mdx new file mode 100644 index 00000000..f7b109c8 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/02-discord-components-v1/04-modal.mdx @@ -0,0 +1,3 @@ +--- +title: Modal +--- diff --git a/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/01-text-display.mdx b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/01-text-display.mdx new file mode 100644 index 00000000..bd903428 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/01-text-display.mdx @@ -0,0 +1,3 @@ +--- +title: Text display +--- diff --git a/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/02-container.mdx b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/02-container.mdx new file mode 100644 index 00000000..e7380a2b --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/02-container.mdx @@ -0,0 +1,3 @@ +--- +title: Container +--- diff --git a/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/03-media-gallery.mdx b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/03-media-gallery.mdx new file mode 100644 index 00000000..85ef807c --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/03-media-gallery.mdx @@ -0,0 +1,3 @@ +--- +title: Media gallery +--- diff --git a/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/04-section-separator.mdx b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/04-section-separator.mdx new file mode 100644 index 00000000..eb94485e --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/04-section-separator.mdx @@ -0,0 +1,3 @@ +--- +title: Section separator +--- diff --git a/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/05-file.mdx b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/05-file.mdx new file mode 100644 index 00000000..2c692652 --- /dev/null +++ b/apps/website/docs/guide/04-jsx-components/03-discord-components-v2/05-file.mdx @@ -0,0 +1,3 @@ +--- +title: File +--- diff --git a/apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx b/apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx new file mode 100644 index 00000000..b8a3de64 --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/01-commandkit-ai.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/ai' +--- diff --git a/apps/website/docs/guide/05-official-plugins/02-commandkit-analytics.mdx b/apps/website/docs/guide/05-official-plugins/02-commandkit-analytics.mdx new file mode 100644 index 00000000..7b906771 --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/02-commandkit-analytics.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/analytics' +--- diff --git a/apps/website/docs/guide/05-official-plugins/03-commandkit-cache.mdx b/apps/website/docs/guide/05-official-plugins/03-commandkit-cache.mdx new file mode 100644 index 00000000..62b3700a --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/03-commandkit-cache.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/cache' +--- diff --git a/apps/website/docs/guide/05-official-plugins/04-commandkit-devtools.mdx b/apps/website/docs/guide/05-official-plugins/04-commandkit-devtools.mdx new file mode 100644 index 00000000..90995b26 --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/04-commandkit-devtools.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/devtools' +--- diff --git a/apps/website/docs/guide/05-official-plugins/05-commandkit-i18n.mdx b/apps/website/docs/guide/05-official-plugins/05-commandkit-i18n.mdx new file mode 100644 index 00000000..6f9d74cf --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/05-commandkit-i18n.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/i18n' +--- diff --git a/apps/website/docs/guide/05-official-plugins/06-commandkit-legacy.mdx b/apps/website/docs/guide/05-official-plugins/06-commandkit-legacy.mdx new file mode 100644 index 00000000..6c75acae --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/06-commandkit-legacy.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/legacy' +--- diff --git a/apps/website/docs/guide/05-official-plugins/07-commandkit-redis.mdx b/apps/website/docs/guide/05-official-plugins/07-commandkit-redis.mdx new file mode 100644 index 00000000..c316f9a8 --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/07-commandkit-redis.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/redis' +--- diff --git a/apps/website/docs/guide/05-official-plugins/08-commandkit-tasks.mdx b/apps/website/docs/guide/05-official-plugins/08-commandkit-tasks.mdx new file mode 100644 index 00000000..3c847339 --- /dev/null +++ b/apps/website/docs/guide/05-official-plugins/08-commandkit-tasks.mdx @@ -0,0 +1,3 @@ +--- +title: '@commandkit/tasks' +--- diff --git a/apps/website/docs/guide/06-community-plugins.mdx b/apps/website/docs/guide/06-community-plugins.mdx new file mode 100644 index 00000000..04d63253 --- /dev/null +++ b/apps/website/docs/guide/06-community-plugins.mdx @@ -0,0 +1,3 @@ +--- +title: Community plugins +--- diff --git a/apps/website/docs/guide/07-creating-plugins/01-creating-runtime-plugin.mdx b/apps/website/docs/guide/07-creating-plugins/01-creating-runtime-plugin.mdx new file mode 100644 index 00000000..81dc3050 --- /dev/null +++ b/apps/website/docs/guide/07-creating-plugins/01-creating-runtime-plugin.mdx @@ -0,0 +1,3 @@ +--- +title: Creating a runtime plugin +--- diff --git a/apps/website/docs/guide/07-creating-plugins/02-creating-compiler-plugin.mdx b/apps/website/docs/guide/07-creating-plugins/02-creating-compiler-plugin.mdx new file mode 100644 index 00000000..f6e55475 --- /dev/null +++ b/apps/website/docs/guide/07-creating-plugins/02-creating-compiler-plugin.mdx @@ -0,0 +1,3 @@ +--- +title: Creating a compiler plugin +--- diff --git a/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx b/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx new file mode 100644 index 00000000..0b149ab7 --- /dev/null +++ b/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx @@ -0,0 +1,3 @@ +--- +title: Setup CommandKit manually +--- diff --git a/apps/website/docs/guide/08-advanced/02-file-naming-conventions.mdx b/apps/website/docs/guide/08-advanced/02-file-naming-conventions.mdx new file mode 100644 index 00000000..c0f6a50e --- /dev/null +++ b/apps/website/docs/guide/08-advanced/02-file-naming-conventions.mdx @@ -0,0 +1,3 @@ +--- +title: File naming conventions +--- diff --git a/apps/website/docs/guide/08-advanced/03-sharding-your-bot.mdx b/apps/website/docs/guide/08-advanced/03-sharding-your-bot.mdx new file mode 100644 index 00000000..06288b4b --- /dev/null +++ b/apps/website/docs/guide/08-advanced/03-sharding-your-bot.mdx @@ -0,0 +1,3 @@ +--- +title: Sharding your bot +--- diff --git a/apps/website/docs/guide/08-advanced/04-migrating-from-v0.mdx b/apps/website/docs/guide/08-advanced/04-migrating-from-v0.mdx new file mode 100644 index 00000000..87155f29 --- /dev/null +++ b/apps/website/docs/guide/08-advanced/04-migrating-from-v0.mdx @@ -0,0 +1,3 @@ +--- +title: Migrating from v0 +--- From 2a9789af2fb89d3f15cb2eee7e99e462b8f613e6 Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sat, 14 Jun 2025 23:12:59 +0545 Subject: [PATCH 2/9] refactor: remove unnecessary script --- apps/website/package.json | 5 +-- apps/website/scripts/docgen.ts | 21 --------- apps/website/scripts/links.ts | 82 ---------------------------------- 3 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 apps/website/scripts/docgen.ts delete mode 100644 apps/website/scripts/links.ts diff --git a/apps/website/package.json b/apps/website/package.json index be87de4c..245555e6 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -12,8 +12,7 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc", - "docgen": "tsx ./scripts/docgen.ts" + "typecheck": "tsc" }, "dependencies": { "@docusaurus/core": "3.8.1", @@ -55,4 +54,4 @@ "engines": { "node": ">=18.0" } -} +} \ No newline at end of file diff --git a/apps/website/scripts/docgen.ts b/apps/website/scripts/docgen.ts deleted file mode 100644 index e58cbbe4..00000000 --- a/apps/website/scripts/docgen.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createDocumentation, DefaultLinksFactory } from 'micro-docgen'; -import { DiscordLinks } from './links'; - -async function main() { - const docs = await createDocumentation({ - tsconfigPath: '../../packages/commandkit/tsconfig.json', - input: ['../../packages/commandkit/src'], - markdown: true, - clean: true, - typeLinkerBasePath: '/docs/api-reference', - extension: 'mdx', - includeMarkdownHeaders: true, - omitTypeLinkerExtension: true, - output: './docs/api-reference', - links: { ...DefaultLinksFactory, ...DiscordLinks }, - }); - - console.log(`Generated docs in ${docs.metadata.generationMs}`); -} - -main(); diff --git a/apps/website/scripts/links.ts b/apps/website/scripts/links.ts deleted file mode 100644 index 6ab6ff3a..00000000 --- a/apps/website/scripts/links.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { MicroDocgenLink } from 'micro-docgen'; - -const links = [ - { - link: 'https://discord.js.org/docs/packages/discord.js/main/Client:Class', - patterns: ['Client', 'Client'], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/AutocompleteInteraction:Class', - patterns: ['AutocompleteInteraction', 'AutocompleteInteraction'], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/ContextMenuCommandInteraction:Class', - patterns: [ - 'ContextMenuCommandInteraction', - 'ContextMenuCommandInteraction', - ], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/AutocompleteInteraction:Class', - patterns: ['AutocompleteInteraction', 'AutocompleteInteraction'], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/ChatInputCommandInteraction:Class', - patterns: [ - 'ChatInputCommandInteraction', - 'ChatInputCommandInteraction', - ], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/MessageContextMenuCommandInteraction:Class', - patterns: [ - 'MessageContextMenuCommandInteraction', - 'MessageContextMenuCommandInteraction', - ], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/UserContextMenuCommandInteraction:Class', - patterns: [ - 'UserContextMenuCommandInteraction', - 'UserContextMenuCommandInteraction', - ], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/Interaction:Class', - patterns: ['Interaction', 'Interaction'], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/ButtonComponentData:TypeAlias', - patterns: ['ButtonComponentData'], - }, - { - link: 'https://discord.js.org/docs/packages/discord.js/main/ComponentEmojiResolvable:TypeAlias', - patterns: ['ComponentEmojiResolvable'], - }, - { - link: 'https://discord-api-types.dev/api/discord-api-types-v10#RESTPostAPIApplicationCommandsJSONBody', - patterns: ['RESTPostAPIApplicationCommandsJSONBody'], - }, - { - link: 'https://discord-api-types.dev/api/discord-api-types-v10#RESTPutAPIApplicationCommandsJSONBody', - patterns: ['RESTPutAPIApplicationCommandsJSONBody'], - }, - { - link: 'https://discord-api-types.dev/api/discord-api-types-v10#APIButtonComponent', - patterns: ['APIButtonComponent'], - }, - { - link: 'https://discord-api-types.dev/api/discord-api-types-v10/enum/ButtonStyle', - patterns: ['ButtonStyle'], - }, -]; - -const DiscordLinks: MicroDocgenLink = {}; - -for (const { link, patterns } of links) { - for (const pattern of patterns) { - DiscordLinks[pattern] = link; - } -} - -export { DiscordLinks }; From 4bb30cd83218dbf0d509f2fcd7f2d72f5dfe4a94 Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sat, 14 Jun 2025 23:15:39 +0545 Subject: [PATCH 3/9] fix: llms plugin url --- apps/website/src/plugins/llms-txt.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/website/src/plugins/llms-txt.js b/apps/website/src/plugins/llms-txt.js index 1dd337ce..18669848 100644 --- a/apps/website/src/plugins/llms-txt.js +++ b/apps/website/src/plugins/llms-txt.js @@ -2,7 +2,7 @@ const path = require('path'); const fs = require('fs'); const matter = require('gray-matter'); -const DOCS_URL = 'https://commandkit.dev/docs/next/guide'; +const DOCS_URL = 'https://commandkit.dev/docs/guide'; const removeNumericPrefix = (path) => { // 01-getting-started/01-introduction -> getting-started/introduction @@ -24,7 +24,8 @@ module.exports = function (context) { if (!fs.existsSync(dir)) return; // skip versioned docs - if (dir.includes(versionedDocsDir)) return; + // TODO: remove guide.old + if (dir.includes(versionedDocsDir) || dir.includes('guide.old')) return; const entries = await fs.promises.readdir(dir, { withFileTypes: true }); From a93e247262e0b9abdac7f7c87ad5b0a774279ea3 Mon Sep 17 00:00:00 2001 From: Avraj Date: Sat, 14 Jun 2025 22:27:06 +0300 Subject: [PATCH 4/9] docs: update versioning --- apps/website/docusaurus.config.ts | 17 ++++++++++++++++- apps/website/src/pages/index.tsx | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/website/docusaurus.config.ts b/apps/website/docusaurus.config.ts index 3a8ccb7f..082a51ba 100644 --- a/apps/website/docusaurus.config.ts +++ b/apps/website/docusaurus.config.ts @@ -19,7 +19,7 @@ const maybeUpperCase = (str: string) => { const config: Config = { title: 'CommandKit', - tagline: 'A Discord.js handler', + tagline: 'The discord.js meta-framework', favicon: 'img/favicon.ico', url: 'https://commandkit.dev', baseUrl: '/', @@ -34,6 +34,17 @@ const config: Config = { 'classic', { docs: { + lastVersion: 'current', + versions: { + current: { + label: '1.2', + path: 'v1', + }, + '0.1.10': { + label: '0.1.10', + path: 'v0', + }, + }, sidebarPath: './sidebars.ts', showLastUpdateAuthor: true, showLastUpdateTime: true, @@ -127,6 +138,10 @@ const config: Config = { { type: 'docsVersionDropdown', position: 'right', + versions: { + current: { label: 'v1' }, + '0.1.10': { label: 'v0' }, + }, }, { href: 'https://github.com/underctrl-io/commandkit', diff --git a/apps/website/src/pages/index.tsx b/apps/website/src/pages/index.tsx index fe230872..e604b5c1 100644 --- a/apps/website/src/pages/index.tsx +++ b/apps/website/src/pages/index.tsx @@ -167,13 +167,13 @@ export default function Home(): React.JSX.Element {
Guide API Reference From 8518f354bffd81ab6899e99f623d2975637fad4b Mon Sep 17 00:00:00 2001 From: Avraj Date: Sat, 14 Jun 2025 23:22:58 +0300 Subject: [PATCH 5/9] docs: add getting started and advanced setup guides --- .../01-getting-started/01-introduction.mdx | 64 +++++++++ .../02-setup-commandkit.mdx | 71 ++++++++++ .../01-setup-commandkit-manually.mdx | 126 ++++++++++++++++++ .../08-advanced/05-event-handler-flow.mdx | 3 + .../08-advanced/06-command-handler-flow.mdx | 3 + 5 files changed, 267 insertions(+) create mode 100644 apps/website/docs/guide/08-advanced/05-event-handler-flow.mdx create mode 100644 apps/website/docs/guide/08-advanced/06-command-handler-flow.mdx diff --git a/apps/website/docs/guide/01-getting-started/01-introduction.mdx b/apps/website/docs/guide/01-getting-started/01-introduction.mdx index 8f14f7a7..d92fe82c 100644 --- a/apps/website/docs/guide/01-getting-started/01-introduction.mdx +++ b/apps/website/docs/guide/01-getting-started/01-introduction.mdx @@ -1,3 +1,67 @@ --- title: Introduction +description: A brief intro to CommandKit --- + +
+ +
+ +
+ +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 + +- Beginner friendly πŸš€ +- Suitable for both beginners and advanced users πŸ‘ΆπŸ‘¨β€πŸ’» +- Slash + context menu commands + message commands support βœ… +- Automatic command registration and updates πŸ€– +- Command middlewares for easy command management πŸ› οΈ +- 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 πŸ“œ +- 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 easily managing Discord components 🎨 +- Easy to use interaction components (forget about collectors) 🧩 +- Less boilerplate code, more productivity πŸ’ͺ +- ...and much more! + +## Support and suggestions + +- [GitHub repository](https://github.com/underctrl-io/commandkit) +- [Discord community](https://ctrl.lol/discord) diff --git a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx index 354cd676..5919f00c 100644 --- a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx +++ b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx @@ -1,3 +1,74 @@ --- title: Setup CommandKit +description: Setup a new CommandKit project using the create-commandkit CLI --- + +:::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 +npm create commandkit@latest +``` + +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 file tree that looks something like this: + +``` +. +β”œβ”€β”€ src/ +β”‚ β”œβ”€β”€ app/ +β”‚ β”‚ β”œβ”€β”€ commands/ +β”‚ β”‚ β”‚ └── ping.ts +β”‚ β”‚ └── events/ +β”‚ β”‚ └── ready/ +β”‚ β”‚ └── log.ts +β”‚ └── app.ts +β”œβ”€β”€ .env +β”œβ”€β”€ .gitignore +β”œβ”€β”€ commandkit.config.ts +β”œβ”€β”€ package.json +└── tsconfig.json +``` + +## Entry point + +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: ['Guilds', 'GuildMessages', 'MessageContent'], +}); + +// Optional: Setting up the token manually +client.token = process.env.MY_BOT_TOKEN; + +export default client; +``` + +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. + +## Development version + +If you would like to try the latest development builds, you can use the `@dev` tag like so: + +```sh npm2yarn +npx create-commandkit@dev +``` + +:::warning +The development version is likely to have bugs. +::: + +## Manual setup + +Alternatively, if you would like to setup a new CommandKit project manually, you can follow [this guide](../08-advanced/01-setup-commandkit-manually.mdx). diff --git a/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx b/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx index 0b149ab7..f8f5ba0d 100644 --- a/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx +++ b/apps/website/docs/guide/08-advanced/01-setup-commandkit-manually.mdx @@ -1,3 +1,129 @@ --- title: Setup CommandKit manually +description: Learn how to manually setup CommandKit --- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +If you don't want to use the [CLI](../01-getting-started/02-setup-commandkit.mdx) to automatically generate a base CommandKit project, you can integrate CommandKit manually into your application. + +:::info +While this guide primarily uses TypeScript, you can use JavaScript files without any problems to follow along if that's what you're comfortable with (e.g. `commandkit.config.js`, `app.js`, etc) +::: + +## Configuration file + +To get started, create a file called `commandkit.config.ts` at the root of your project. This file is used to configure CommandKit and optionally its plugins. + +```ts title="commandkit.config.ts" +import { defineConfig } from 'commandkit'; + +export default defineConfig({}); +``` + +## Entrypoint file + +Then, create a folder called `src`, followed by a file called `app.ts` inside it. The file should look like this: + +```ts title="src/app.ts" +import { Client } from 'discord.js'; + +const client = new Client({ + intents: ['Guilds'], +}); + +client.token = '...'; // Optional: Manually set a bot token + +export default client; +``` + +With the current entrypoint file created, it's important to understand that: + +1. The `app.ts` file is the entrypoint for this application. This file **must** export your discord.js client instance. +2. You don't have to call `client.login()` as CommandKit will handle that for you. +3. You should store your bot token as an environment variable with either `DISCORD_TOKEN` or `TOKEN` as the name. +4. If you prefer to have a custom environment variable for your bot token, you can manually assign it to the `client.token` property. + +## Adding commands + +To add a command, create a folder inside the `src/app` directory called `commands` and create your command file (e.g. `ping.ts`). This example will use a simple ping/pong command which will register as a chat input (slash) and message command. + +```ts title="src/app/commands/ping.ts" +import type { ChatInputCommand, CommandData, MessageCommand } from 'commandkit'; + +export const command: CommandData = { + name: 'ping', + description: 'Pong!', +}; + +export const chatInput: ChatInputCommand = async ({ interaction }) => { + await interaction.reply('Pong!'); +}; + +export const message: MessageCommand = async ({ message }) => { + await message.reply('Pong!'); +}; +``` + +This command will reply with "Pong!" when the user runs the `/ping` slash command, or sends `!ping` in the chat. + +:::tip +The prefix for message commands can be changed globally or per-guild. Learn more [here](../02-commands/05-custom-message-commands-prefix.mdx). +::: + +## Adding events + +To register and handle events emitted by your discord.js client, create a folder inside the `src/app` directory called `events` and create a folder with the name of the discord.js event you'd like to handle (e.g. ready, messageCreate, etc). This example will use the `ready` event. + +In the `src/app/events/ready` directory, you can create files which will export default functions that will be called when the respective event is emitted by discord.js. Following the `ready` event example mentioned above, you may want to log when your bot comes online. The function for that will look like so: + +```ts title="src/app/events/log.ts" +import type { Client } from 'discord.js'; + +export default function (client: Client) { + console.log(`Logged in as ${client.user.username}!`); +} +``` + +:::tip +You can find a full list of events under the [discord.js Client class](https://discord.js.org/docs/packages/discord.js/main/Client:Class). +::: + +## Running the app in development + +To run your application in development mode, you can use the `commandkit dev` command in your terminal. This will allow you to quickly reload specific parts of your application using Hot Module Replacement (HMR) when you make changes to your code, without having to restart the entire application. + +```sh npm2yarn +npx commandkit dev +``` + +:::warning +When running in development mode, CommandKit will generate a `.commandkit` folder in the root of your project. This folder contains the compiled files used in development mode. You should not commit this folder to your version control system by making sure you add it to your `.gitignore` file. +::: + +## Building for production + +When you are ready to deploy your bot, you can use `commandkit build` to create a production build of your bot. This will create a `dist` folder in your project directory containing the compiled files. + +```sh +npx commandkit build +``` + +:::warning +After running your build script, CommandKit will generate a `dist` folder in the root of your project. This folder contains the compiled files used for production. You should not commit this folder to your version control system by making sure you add it to your `.gitignore` file. +::: + +## Running the app in production + +You can use `commandkit start` to start the bot in production mode. This will load the environment variables from the `.env` file in the root of your project directory. + +```sh +npx commandkit start +``` + +Alternatively, you can manually start the bot in production mode using a runtime environment of your choice: + +```sh +node dist/index.js +``` diff --git a/apps/website/docs/guide/08-advanced/05-event-handler-flow.mdx b/apps/website/docs/guide/08-advanced/05-event-handler-flow.mdx new file mode 100644 index 00000000..ea0bca7e --- /dev/null +++ b/apps/website/docs/guide/08-advanced/05-event-handler-flow.mdx @@ -0,0 +1,3 @@ +--- +title: Event handler flow +--- diff --git a/apps/website/docs/guide/08-advanced/06-command-handler-flow.mdx b/apps/website/docs/guide/08-advanced/06-command-handler-flow.mdx new file mode 100644 index 00000000..1b122fe2 --- /dev/null +++ b/apps/website/docs/guide/08-advanced/06-command-handler-flow.mdx @@ -0,0 +1,3 @@ +--- +title: Command handler flow +--- From aaa1a2c2db4078571a53c12b95026b88b8ebf535 Mon Sep 17 00:00:00 2001 From: Avraj Date: Sun, 15 Jun 2025 00:03:58 +0300 Subject: [PATCH 6/9] docs: update styling + add chat input commands docs --- .../02-setup-commandkit.mdx | 2 +- .../02-commands/01-chat-input-commands.mdx | 45 +++++++++++++++++++ apps/website/docusaurus.config.ts | 2 +- apps/website/src/css/custom.css | 11 +++-- apps/website/src/pages/index.tsx | 4 +- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx index 5919f00c..4923917e 100644 --- a/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx +++ b/apps/website/docs/guide/01-getting-started/02-setup-commandkit.mdx @@ -62,7 +62,7 @@ Notice how there's no `client.login()` in this file. This is because CommandKit If you would like to try the latest development builds, you can use the `@dev` tag like so: ```sh npm2yarn -npx create-commandkit@dev +npm create commandkit@dev ``` :::warning diff --git a/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx index c2ed4d81..e9bf26f0 100644 --- a/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx +++ b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx @@ -1,3 +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 type of commands 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'], +}; +``` diff --git a/apps/website/docusaurus.config.ts b/apps/website/docusaurus.config.ts index 082a51ba..7e1cd523 100644 --- a/apps/website/docusaurus.config.ts +++ b/apps/website/docusaurus.config.ts @@ -38,7 +38,7 @@ const config: Config = { versions: { current: { label: '1.2', - path: 'v1', + // path: 'v1', }, '0.1.10': { label: '0.1.10', diff --git a/apps/website/src/css/custom.css b/apps/website/src/css/custom.css index 32e76f00..9bf96042 100644 --- a/apps/website/src/css/custom.css +++ b/apps/website/src/css/custom.css @@ -1,7 +1,6 @@ /* some of these styles were borrowed from https://github.com/vendure-ecommerce/vendure/blob/cfc0dd7c34fd070a15455508f32d37e94589e656/docs/src/css/custom.css */ -@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap'); -@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap'); @tailwind base; @tailwind components; @@ -38,7 +37,7 @@ --ifm-heading-font-family: 'Geist', var(--ifm-font-family-base); --ifm-heading-font-weight: 700; --ifm-font-family-monospace: - 'JetBrains Mono', 'SF Mono', Monaco, 'Inconsolata', 'Roboto Mono', + 'Geist Mono', 'SF Mono', Monaco, 'Inconsolata', 'Roboto Mono', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace; } @@ -89,15 +88,15 @@ h6 { /* Responsive typography scaling */ h1 { - @apply text-4xl md:text-5xl lg:text-6xl; + @apply text-2xl md:text-3xl lg:text-4xl; } h2 { - @apply text-3xl md:text-4xl lg:text-5xl; + @apply text-xl md:text-2xl lg:text-3xl; } h3 { - @apply text-2xl md:text-3xl lg:text-4xl; + @apply text-lg md:text-xl lg:text-2xl; } .markdown h2:not(:first-of-type) { diff --git a/apps/website/src/pages/index.tsx b/apps/website/src/pages/index.tsx index e604b5c1..62b5601c 100644 --- a/apps/website/src/pages/index.tsx +++ b/apps/website/src/pages/index.tsx @@ -167,13 +167,13 @@ export default function Home(): React.JSX.Element {
Guide API Reference From 131f781dfc2da85b1ac6827866de4b9224e70a73 Mon Sep 17 00:00:00 2001 From: Avraj Date: Sun, 15 Jun 2025 00:06:28 +0300 Subject: [PATCH 7/9] docs: fix wording --- apps/website/docs/guide/02-commands/01-chat-input-commands.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx index e9bf26f0..4d4422fd 100644 --- a/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx +++ b/apps/website/docs/guide/02-commands/01-chat-input-commands.mdx @@ -30,7 +30,7 @@ This is the command data object which defines the shape of your command. This is 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 type of commands that CommandKit supports. Learn more about [message commands](./04-message-commands.mdx) and [context menu commands](./03-context-menu-commands.mdx). +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 From ba670672499cab76dfbb69c7ed7de8c550168590 Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Sun, 15 Jun 2025 11:29:01 +0545 Subject: [PATCH 8/9] Update apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx --- .../docs/guide.old/01-getting-started/02-setup-commandkit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx index f18564ec..368f754a 100644 --- a/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx +++ b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx @@ -68,5 +68,5 @@ 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 +npm create commandkit@dev ``` From f43d487aedc6078b5ec13d84cfb0d52917badfa3 Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Sun, 15 Jun 2025 11:29:05 +0545 Subject: [PATCH 9/9] Update apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx --- .../docs/guide.old/01-getting-started/02-setup-commandkit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx index 368f754a..00a7529a 100644 --- a/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx +++ b/apps/website/docs/guide.old/01-getting-started/02-setup-commandkit.mdx @@ -6,7 +6,7 @@ description: Setup a new CommandKit project manually, or using the create-comman 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 +npm create commandkit@latest ``` This will start the CLI in the current directory which will help you quickly setup a base CommandKit project.