diff --git a/.github/workflows/deploy-dev-build.yaml b/.github/workflows/deploy-dev-build.yaml
deleted file mode 100644
index d648e82..0000000
--- a/.github/workflows/deploy-dev-build.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: Publish Dev Build
-
-on:
- push:
- branches:
- - master
- paths:
- - 'packages/commandkit/**'
-
-jobs:
- release:
- name: 🚀 Publish Dev Build
- runs-on: ubuntu-latest
- steps:
- - uses: pnpm/action-setup@v2
- with:
- version: 8
-
- - name: 📚 Checkout
- uses: actions/checkout@v3
-
- - name: 🟢 Node
- uses: actions/setup-node@v2
- with:
- node-version: 18
- registry-url: https://registry.npmjs.org
-
- - name: 🍳 Prepare
- run: pnpm install
-
- - name: 🔢 Update Version
- run: |
- cd packages/commandkit
- node -e "const pkg = require('./package.json'); \
- const newVersion = pkg.version + '-dev.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
- pkg.version = newVersion; \
- require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
- env:
- DEBIAN_FRONTEND: noninteractive
-
- - name: 🚚 Publish
- run: pnpm run deploy:package-dev
- env:
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
-
- - name: 🚫 Deprecate Previous Dev Version
- run: |
- PACKAGE_NAME=$(node -e "console.log(require('./packages/commandkit/package.json').name);")
- ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
- VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
- const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
- const devVersions = versions.filter(v => v.includes('-dev.'));
- const versionToDeprecate = devVersions[devVersions.length - 2];
- console.log(versionToDeprecate);
- ")
- echo Deprecating version $VERSION_TO_DEPRECATE
- npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
-
- env:
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.github/workflows/dev-commandkit.yaml b/.github/workflows/dev-commandkit.yaml
new file mode 100644
index 0000000..31d0e75
--- /dev/null
+++ b/.github/workflows/dev-commandkit.yaml
@@ -0,0 +1,65 @@
+name: (CommandKit) Publish Dev Build
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - 'packages/commandkit/**'
+
+jobs:
+ release:
+ name: 🚀 Publish Dev Build
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
+
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 18
+ registry-url: https://registry.npmjs.org
+
+ - name: 🍳 Prepare
+ run: pnpm install
+
+ - name: 🔢 Update Version
+ run: |
+ cd packages/commandkit
+ node -e "const pkg = require('./package.json'); \
+ const newVersion = pkg.version + '-dev.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
+ pkg.version = newVersion; \
+ require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
+ env:
+ DEBIAN_FRONTEND: noninteractive
+
+ - name: 🧱 Build
+ run: pnpm --filter './packages/commandkit' run build
+
+ - name: 🚚 Publish
+ run: |
+ cd packages/commandkit
+ npm publish --access public --tag dev
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
+
+ - name: 🚫 Deprecate Previous Dev Version
+ run: |
+ PACKAGE_NAME=$(node -e "console.log(require('./packages/commandkit/package.json').name);")
+ ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
+ VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
+ const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
+ const devVersions = versions.filter(v => v.includes('-dev.'));
+ const versionToDeprecate = devVersions[devVersions.length - 2];
+ console.log(versionToDeprecate);
+ ")
+ echo Deprecating version $VERSION_TO_DEPRECATE
+ npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
+
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.github/workflows/dev-create-commandkit.yaml b/.github/workflows/dev-create-commandkit.yaml
new file mode 100644
index 0000000..bc156ab
--- /dev/null
+++ b/.github/workflows/dev-create-commandkit.yaml
@@ -0,0 +1,65 @@
+name: (Create CommandKit) Publish Dev Build
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - 'packages/create-commandkit/**'
+
+jobs:
+ release:
+ name: 🚀 Publish Dev Build
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
+
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 18
+ registry-url: https://registry.npmjs.org
+
+ - name: 🍳 Prepare
+ run: pnpm install
+
+ - name: 🔢 Update Version
+ run: |
+ cd packages/create-commandkit
+ node -e "const pkg = require('./package.json'); \
+ const newVersion = pkg.version + '-dev.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
+ pkg.version = newVersion; \
+ require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
+ env:
+ DEBIAN_FRONTEND: noninteractive
+
+ - name: 🧱 Build
+ run: pnpm --filter './packages/create-commandkit' run build
+
+ - name: 🚚 Publish
+ run: |
+ cd packages/create-commandkit
+ npm publish --access public --tag dev
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
+
+ - name: 🚫 Deprecate Previous Dev Version
+ run: |
+ PACKAGE_NAME=$(node -e "console.log(require('./packages/create-commandkit/package.json').name);")
+ ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
+ VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
+ const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
+ const devVersions = versions.filter(v => v.includes('-dev.'));
+ const versionToDeprecate = devVersions[devVersions.length - 2];
+ console.log(versionToDeprecate);
+ ")
+ echo Deprecating version $VERSION_TO_DEPRECATE
+ npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
+
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 5e47f6c..02a9f58 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -1,30 +1,30 @@
name: Lint
on:
- push:
- branches:
- - '**'
+ push:
+ branches:
+ - '**'
jobs:
- build:
- name: 🔍 Lint
- runs-on: ubuntu-latest
- steps:
- - uses: pnpm/action-setup@v2
- with:
- version: 8
+ build:
+ name: 🔍 Lint
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
- - name: 📚 Checkout
- uses: actions/checkout@v3
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
- - name: 🟢 Node
- uses: actions/setup-node@v2
- with:
- node-version: 16
- registry-url: https://registry.npmjs.org
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 16
+ registry-url: https://registry.npmjs.org
- - name: 🍳 Prepare
- run: pnpm install
+ - name: 🍳 Prepare
+ run: pnpm install
- - name: ✨ Lint
- run: pnpm lint
+ - name: ✨ Lint
+ run: pnpm lint
diff --git a/.github/workflows/next-commandkit.yaml b/.github/workflows/next-commandkit.yaml
new file mode 100644
index 0000000..d0ebac1
--- /dev/null
+++ b/.github/workflows/next-commandkit.yaml
@@ -0,0 +1,65 @@
+name: (CommandKit) Publish Next Beta Build
+
+on:
+ push:
+ branches:
+ - next
+ paths:
+ - 'packages/commandkit/**'
+
+jobs:
+ release:
+ name: 🚀 Publish Next Beta Build
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
+
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 18
+ registry-url: https://registry.npmjs.org
+
+ - name: 🍳 Prepare
+ run: pnpm install
+
+ - name: 🔢 Update Version
+ run: |
+ cd packages/commandkit
+ node -e "const pkg = require('./package.json'); \
+ const newVersion = pkg.version + '-next-beta.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
+ pkg.version = newVersion; \
+ require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
+ env:
+ DEBIAN_FRONTEND: noninteractive
+
+ - name: 🧱 Build
+ run: pnpm --filter './packages/commandkit' run build
+
+ - name: 🚚 Publish
+ run: |
+ cd packages/commandkit
+ npm publish --access public --tag next
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
+
+ - name: 🚫 Deprecate Previous Beta Version
+ run: |
+ PACKAGE_NAME=$(node -e "console.log(require('./packages/commandkit/package.json').name);")
+ ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
+ VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
+ const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
+ const devVersions = versions.filter(v => v.includes('-next-beta.'));
+ const versionToDeprecate = devVersions[devVersions.length - 2];
+ console.log(versionToDeprecate);
+ ")
+ echo Deprecating version $VERSION_TO_DEPRECATE
+ npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated beta version."
+
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.github/workflows/next-create-commandkit.yaml b/.github/workflows/next-create-commandkit.yaml
new file mode 100644
index 0000000..10bf463
--- /dev/null
+++ b/.github/workflows/next-create-commandkit.yaml
@@ -0,0 +1,65 @@
+name: (Create CommandKit) Publish Next Beta Build
+
+on:
+ push:
+ branches:
+ - next
+ paths:
+ - 'packages/create-commandkit/**'
+
+jobs:
+ release:
+ name: 🚀 Publish Next Beta Build
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
+
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 18
+ registry-url: https://registry.npmjs.org
+
+ - name: 🍳 Prepare
+ run: pnpm install
+
+ - name: 🔢 Update Version
+ run: |
+ cd packages/create-commandkit
+ node -e "const pkg = require('./package.json'); \
+ const newVersion = pkg.version + '-next-beta.' + new Date().toISOString().replace(/[:\-T]/g, '').substr(0,14); \
+ pkg.version = newVersion; \
+ require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
+ env:
+ DEBIAN_FRONTEND: noninteractive
+
+ - name: 🧱 Build
+ run: pnpm --filter './packages/create-commandkit' run build
+
+ - name: 🚚 Publish
+ run: |
+ cd packages/create-commandkit
+ npm publish --access public --tag next
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
+
+ - name: 🚫 Deprecate Previous Beta Version
+ run: |
+ PACKAGE_NAME=$(node -e "console.log(require('./packages/create-commandkit/package.json').name);")
+ ALL_VERSIONS=$(npm info $PACKAGE_NAME versions -json)
+ VERSION_TO_DEPRECATE=$(echo $ALL_VERSIONS | node -e "
+ const versions = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8'));
+ const devVersions = versions.filter(v => v.includes('-next-beta.'));
+ const versionToDeprecate = devVersions[devVersions.length - 2];
+ console.log(versionToDeprecate);
+ ")
+ echo Deprecating version $VERSION_TO_DEPRECATE
+ npm deprecate $PACKAGE_NAME@$VERSION_TO_DEPRECATE "Deprecated dev version."
+
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 8adfe7c..0747782 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -1,31 +1,34 @@
name: Publish to NPM
on:
- release:
- types: [created]
+ release:
+ types: [created]
jobs:
- release:
- name: 🚀 Publish
- runs-on: ubuntu-latest
- steps:
- - uses: pnpm/action-setup@v2
- with:
- version: 8
+ release:
+ name: 🚀 Publish
+ runs-on: ubuntu-latest
+ steps:
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
- - name: 📚 Checkout
- uses: actions/checkout@v3
+ - name: 📚 Checkout
+ uses: actions/checkout@v3
- - name: 🟢 Node
- uses: actions/setup-node@v2
- with:
- node-version: 16
- registry-url: https://registry.npmjs.org
+ - name: 🟢 Node
+ uses: actions/setup-node@v2
+ with:
+ node-version: 16
+ registry-url: https://registry.npmjs.org
- - name: 🍳 Prepare
- run: pnpm install
+ - name: 🍳 Prepare
+ run: pnpm install
- - name: 🚚 Publish
- run: pnpm run deploy:package
- env:
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
+ - name: 🧱 Build
+ run: pnpm --filter './packages/*' run build
+
+ - name: 🚚 Publish
+ run: pnpm run deploy:package
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
diff --git a/.prettierignore b/.prettierignore
index 68a7ad2..d91fa10 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -18,3 +18,9 @@ pnpm-debug.log*
.env
.env.production
+.env.*
+
+.gitignore
+.npmignore
+
+turbo-lint.log
\ No newline at end of file
diff --git a/.prettierrc.json b/.prettierrc.json
index 029b0d4..ee7a020 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -1,6 +1,6 @@
{
- "printWidth": 100,
- "tabWidth": 4,
- "singleQuote": true,
- "arrowParens": "always"
+ "printWidth": 80,
+ "tabWidth": 2,
+ "singleQuote": true,
+ "arrowParens": "always"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4694bb..8054f1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,45 +6,45 @@ All notable changes to this project will be documented in this file.
### Fixed
-- CommonJS projects crash when using commandkit cli with watch mode.
+- CommonJS projects crash when using commandkit cli with watch mode.
### Added
-- add `onEnd` to ButtonKit
+- add `onEnd` to ButtonKit
## [0.1.9] - 2023-12-12
### Changes (breaking)
-- Update `ValidationFunctionProps` type name to `ValidationProps`.
-- Update `autocompleteRun` command function name to `autocomplete`.
-- Update `AutocompleteCommandProps` type name to `AutocompleteProps`.
+- Update `ValidationFunctionProps` type name to `ValidationProps`.
+- Update `autocompleteRun` command function name to `autocomplete`.
+- Update `AutocompleteCommandProps` type name to `AutocompleteProps`.
### Deprecated
-- `guildOnly` in command options. CommandKit no longer handles the `guildOnly` condition. Use `dm_permission` in your command `data` object instead.
+- `guildOnly` in command options. CommandKit no longer handles the `guildOnly` condition. Use `dm_permission` in your command `data` object instead.
### Fixed
-- Broken docs links.
+- Broken docs links.
### Added
-- `ValidationProps` type definition.
+- `ValidationProps` type definition.
## [0.1.10 - dev] - 2023-12-29
### Fixed
-- Typos during command load/reload in specific guild (REST).
+- Typos during command load/reload in specific guild (REST).
### Changed
-- Use `process.emitWarning()` for warnings instead of regular console logs.
-- Throw an error if a global command registration/deletion fails instead of just logging (for legacy command registation).
+- Use `process.emitWarning()` for warnings instead of regular console logs.
+- Throw an error if a global command registration/deletion fails instead of just logging (for legacy command registation).
### Removed
-- `guildOnly` from docs examples. Closes [#42](https://github.com/underctrl-io/commandkit/issues/42)
-- `guildOnly` deprecation warning.
-- Emojis from logs, warnings, and errors.
+- `guildOnly` from docs examples. Closes [#42](https://github.com/underctrl-io/commandkit/issues/42)
+- `guildOnly` deprecation warning.
+- Emojis from logs, warnings, and errors.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 40ac0a8..db480ca 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,8 +7,8 @@ Firstly, thank you for considering contributing to CommandKit! Whether you're lo
### Prerequisites
1. Ensure you have `Node.js` and `pnpm` installed.
- - Node.js: [Download here](https://nodejs.org/)
- - pnpm: Install via `npm install -g pnpm` if you haven't.
+ - Node.js: [Download here](https://nodejs.org/)
+ - pnpm: Install via `npm install -g pnpm` if you haven't.
### Fork & Clone
@@ -40,8 +40,8 @@ git checkout -b your-feature-or-bugfix
3. Ensure that your changes don't break any existing functionality. You can test the functionality of your code depending on where you've made changes:
- 1. If you've made changes to the CommandKit package, you can use the "tests" folder in the "packages/commandkit" directory to test your own bot. Just make sure to create a new `.env` file with the template from the `.env.example` file provided. You can run the application using `pnpm test`.
- 2. If you've made changes to the docs, you can run `pnpm dev` inside "apps/docs" to spin up a local development server.
+ 1. If you've made changes to the CommandKit package, you can use the "tests" folder in the "packages/commandkit" directory to test your own bot. Just make sure to create a new `.env` file with the template from the `.env.example` file provided. You can run the application using `pnpm test`.
+ 2. If you've made changes to the docs, you can run `pnpm dev` inside "apps/docs" to spin up a local development server.
4. Run `pnpm lint` from the root directory to ensure all lint scripts and formatting is valid.
diff --git a/apps/docs/next.config.js b/apps/docs/next.config.js
index 6a33f84..f6ab2b8 100644
--- a/apps/docs/next.config.js
+++ b/apps/docs/next.config.js
@@ -1,6 +1,6 @@
const withNextra = require('nextra')({
- theme: 'nextra-theme-docs',
- themeConfig: './theme.config.tsx',
+ theme: 'nextra-theme-docs',
+ themeConfig: './theme.config.tsx',
});
module.exports = withNextra();
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 9e8db91..1d48ff1 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -1,24 +1,24 @@
{
- "name": "commandkit-docs",
- "version": "0.0.0",
- "private": true,
- "scripts": {
- "dev": "next dev",
- "build": "next build",
- "start": "next start"
- },
- "dependencies": {
- "@types/node": "^20.11.6",
- "@types/react": "^18.2.48",
- "@types/react-dom": "^18.2.18",
- "autoprefixer": "^10.4.17",
- "next": "^14.1.0",
- "nextra": "^2.13.2",
- "nextra-theme-docs": "^2.13.2",
- "postcss": "^8.4.33",
- "react": "18.2.0",
- "react-dom": "18.2.0",
- "tailwindcss": "^3.4.1",
- "typescript": "^5.3.3"
- }
+ "name": "commandkit-docs",
+ "version": "0.0.0",
+ "private": true,
+ "scripts": {
+ "dev": "next dev",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@types/node": "^20.11.6",
+ "@types/react": "^18.2.48",
+ "@types/react-dom": "^18.2.18",
+ "autoprefixer": "^10.4.17",
+ "next": "^14.1.0",
+ "nextra": "^2.13.2",
+ "nextra-theme-docs": "^2.13.2",
+ "postcss": "^8.4.33",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
+ "tailwindcss": "^3.4.1",
+ "typescript": "^5.3.3"
+ }
}
diff --git a/apps/docs/pages/_app.mdx b/apps/docs/pages/_app.mdx
index 10f86a8..64a3e7a 100644
--- a/apps/docs/pages/_app.mdx
+++ b/apps/docs/pages/_app.mdx
@@ -2,12 +2,12 @@ import '../styles/globals.css';
import Head from 'next/head';
export default function Nextra({ Component, pageProps }) {
- return (
- <>
-
-
-
-
- >
- );
+ return (
+ <>
+
+
+
+
+ >
+ );
}
diff --git a/apps/docs/pages/_meta.json b/apps/docs/pages/_meta.json
index 78a8086..0e2b2c4 100644
--- a/apps/docs/pages/_meta.json
+++ b/apps/docs/pages/_meta.json
@@ -1,14 +1,14 @@
{
- "index": {
- "title": "Home",
- "type": "page"
- },
- "guide": {
- "title": "Guide",
- "type": "page"
- },
- "docs": {
- "title": "Documentation",
- "type": "page"
- }
+ "index": {
+ "title": "Home",
+ "type": "page"
+ },
+ "guide": {
+ "title": "Guide",
+ "type": "page"
+ },
+ "docs": {
+ "title": "Documentation",
+ "type": "page"
+ }
}
diff --git a/apps/docs/pages/docs/_meta.json b/apps/docs/pages/docs/_meta.json
index 744435e..abe4125 100644
--- a/apps/docs/pages/docs/_meta.json
+++ b/apps/docs/pages/docs/_meta.json
@@ -1,5 +1,5 @@
{
- "classes": "Classes",
- "enums": "Enums",
- "typedef": "Types"
+ "classes": "Classes",
+ "enums": "Enums",
+ "typedef": "Types"
}
diff --git a/apps/docs/pages/docs/classes/CommandKit.mdx b/apps/docs/pages/docs/classes/CommandKit.mdx
index 19e607d..b7e094b 100644
--- a/apps/docs/pages/docs/classes/CommandKit.mdx
+++ b/apps/docs/pages/docs/classes/CommandKit.mdx
@@ -2,61 +2,61 @@
### `commands`
-- Type: [`CommandObject[]`](/typedef/CommandObject)
+- Type: [`CommandObject[]`](/typedef/CommandObject)
An array of all the command objects that CommandKit is handling. This includes all the properties and methods that are also set outside of CommandKit's configuration. It does however not include the `run` method since CommandKit handles that internally.
### `commandsPath`
-- Type: `string` | `undefined`
+- Type: `string` | `undefined`
The path to the commands directory which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `eventsPath`
-- Type: `string` | `undefined`
+- Type: `string` | `undefined`
The path to the events directory which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `validationsPath`
-- Type: `string` | `undefined`
+- Type: `string` | `undefined`
The path to the validations directory which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `devUserIds`
-- Type: `string[]`
+- Type: `string[]`
The array of developer user IDs which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `devGuildIds`
-- Type: `string[]`
+- Type: `string[]`
The array of development server IDs which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `devRoleIds`
-- Type: `string[]`
+- Type: `string[]`
The array of developer role IDs which was set when [instantiating CommandKit](/docs/commandkit-setup).
### `reloadCommands`
-- Props type: `'dev'` | `'global'` | [`ReloadType`](/enums/ReloadType) (optional)
-- Return type: `Promise`
+- Props type: `'dev'` | `'global'` | [`ReloadType`](/enums/ReloadType) (optional)
+- Return type: `Promise`
Reloads application commands. Using "dev" will only reload commands marked with `devOnly`, and using "global" will do the opposite. Not passing in a property will reload both dev and global commands. The reload behaviour depends on [`bulkRegister`](/docs/commandkit-setup#bulkregister-optional).
### `reloadEvents`
-- Return type: `Promise`
+- Return type: `Promise`
Resets and reloads application events.
### `reloadValidations`
-- Return type: `Promise`
+- Return type: `Promise`
Reloads application commands validations.
diff --git a/apps/docs/pages/docs/classes/_meta.json b/apps/docs/pages/docs/classes/_meta.json
index c4d2f81..75ef68f 100644
--- a/apps/docs/pages/docs/classes/_meta.json
+++ b/apps/docs/pages/docs/classes/_meta.json
@@ -1,4 +1,4 @@
{
- "CommandKit": "CommandKit",
- "components": "Components"
+ "CommandKit": "CommandKit",
+ "components": "Components"
}
diff --git a/apps/docs/pages/docs/classes/components/ButtonKit.mdx b/apps/docs/pages/docs/classes/components/ButtonKit.mdx
index 3149e01..d0a7951 100644
--- a/apps/docs/pages/docs/classes/components/ButtonKit.mdx
+++ b/apps/docs/pages/docs/classes/components/ButtonKit.mdx
@@ -3,17 +3,17 @@ import { Callout } from 'nextra/components';
# ButtonKit
- ButtonKit extends the
- [ButtonBuilder](https://discord.js.org/docs/packages/discord.js/main/ButtonBuilder:Class) class,
- provided by discord.js.
+ ButtonKit extends the
+ [ButtonBuilder](https://discord.js.org/docs/packages/discord.js/main/ButtonBuilder:Class)
+ class, provided by discord.js.
### `onClick`
-- Return type: `ButtonKit`
-- Arguments:
- - handler: [`CommandKitButtonBuilderInteractionCollectorDispatch`](/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch)
- - data?: [`CommandKitButtonBuilderInteractionCollectorDispatchContextData`](/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch) | `undefined`
+- Return type: `ButtonKit`
+- Arguments:
+ - handler: [`CommandKitButtonBuilderInteractionCollectorDispatch`](/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch)
+ - data?: [`CommandKitButtonBuilderInteractionCollectorDispatchContextData`](/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch) | `undefined`
Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used. If unused, this expires after 24 hours or custom time if specified.
@@ -21,22 +21,22 @@ Sets up an inline interaction collector for this button. This collector by defau
```ts
const button = new ButtonKit()
- .setLabel('Click me')
- .setStyle(ButtonStyle.Primary)
- .setCustomId('click_me');
+ .setLabel('Click me')
+ .setStyle(ButtonStyle.Primary)
+ .setCustomId('click_me');
const row = new ActionRowBuilder().addComponents(button);
const message = await channel.send({
- content: 'Click the button',
- components: [row],
+ content: 'Click the button',
+ components: [row],
});
button.onClick(
- async (interaction) => {
- await interaction.reply('You clicked me!');
- },
- { message },
+ async (interaction) => {
+ await interaction.reply('You clicked me!');
+ },
+ { message },
);
// Remove onClick handler and destroy the interaction collector
@@ -45,5 +45,5 @@ button.onClick(null);
### onEnd
-- Return type: `ButtonKit`
-- Props type: [`CommandKitButtonBuilderOnEnd`](/docs/typedef/CommandKitButtonBuilderOnEnd)
+- Return type: `ButtonKit`
+- Props type: [`CommandKitButtonBuilderOnEnd`](/docs/typedef/CommandKitButtonBuilderOnEnd)
diff --git a/apps/docs/pages/docs/classes/components/_meta.json b/apps/docs/pages/docs/classes/components/_meta.json
index 3f4fa5b..4a1f962 100644
--- a/apps/docs/pages/docs/classes/components/_meta.json
+++ b/apps/docs/pages/docs/classes/components/_meta.json
@@ -1,3 +1,3 @@
{
- "ButtonKit": "ButtonKit"
+ "ButtonKit": "ButtonKit"
}
diff --git a/apps/docs/pages/docs/enums/ReloadType.mdx b/apps/docs/pages/docs/enums/ReloadType.mdx
index 2e58178..d9fd80f 100644
--- a/apps/docs/pages/docs/enums/ReloadType.mdx
+++ b/apps/docs/pages/docs/enums/ReloadType.mdx
@@ -2,8 +2,8 @@
### Developer
-- Value: `dev`
+- Value: `dev`
### Global
-- Value: `global`
+- Value: `global`
diff --git a/apps/docs/pages/docs/enums/_meta.json b/apps/docs/pages/docs/enums/_meta.json
index 5397412..5d1204d 100644
--- a/apps/docs/pages/docs/enums/_meta.json
+++ b/apps/docs/pages/docs/enums/_meta.json
@@ -1,3 +1,3 @@
{
- "ReloadType": "ReloadType"
+ "ReloadType": "ReloadType"
}
diff --git a/apps/docs/pages/docs/typedef/AutocompleteProps.mdx b/apps/docs/pages/docs/typedef/AutocompleteProps.mdx
index 0e964d9..b41648d 100644
--- a/apps/docs/pages/docs/typedef/AutocompleteProps.mdx
+++ b/apps/docs/pages/docs/typedef/AutocompleteProps.mdx
@@ -2,12 +2,12 @@
### `client`
-- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
+- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
### `handler`
-- Type: [`CommandKit`](/docs/typedef/CommandKit)
+- Type: [`CommandKit`](/docs/typedef/CommandKit)
### `interaction`
-- Type [`AutocompleteInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/AutocompleteInteraction)
+- Type [`AutocompleteInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/AutocompleteInteraction)
diff --git a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch.mdx b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch.mdx
index 2bb39e5..8957fda 100644
--- a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch.mdx
+++ b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatch.mdx
@@ -1,7 +1,7 @@
# CommandKitButtonBuilderInteractionCollectorDispatch
-- Type: `(interaction: ButtonInteraction) => Awaitable;`
+- Type: `(interaction: ButtonInteraction) => Awaitable;`
## References
-- [`ButtonInteraction`](https://discord.js.org/docs/packages/discord.js/main/ButtonInteraction:Class)
+- [`ButtonInteraction`](https://discord.js.org/docs/packages/discord.js/main/ButtonInteraction:Class)
diff --git a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatchContextData.mdx b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatchContextData.mdx
index bc7a4f9..1cd46c4 100644
--- a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatchContextData.mdx
+++ b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderInteractionCollectorDispatchContextData.mdx
@@ -6,16 +6,16 @@ Extends `Omit, 'filter' | 'compon
The message to listen for button interactions on.
-- Type: [Message](https://discord.js.org/docs/packages/discord.js/main/Message:Class)
+- Type: [Message](https://discord.js.org/docs/packages/discord.js/main/Message:Class)
### `time`
The duration (in ms) that the collector should run for.
-- Type: `number` | `undefined`
+- Type: `number` | `undefined`
### `autoReset`
If the collector should automatically reset the timer when a button is clicked.
-- Type: `boolean` | `undefined`
+- Type: `boolean` | `undefined`
diff --git a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderOnEnd.mdx b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderOnEnd.mdx
index d32eecf..84bee00 100644
--- a/apps/docs/pages/docs/typedef/CommandKitButtonBuilderOnEnd.mdx
+++ b/apps/docs/pages/docs/typedef/CommandKitButtonBuilderOnEnd.mdx
@@ -1,3 +1,3 @@
# CommandKitButtonBuilderOnEnd
-- Type: `() => Awaitable`
+- Type: `() => Awaitable`
diff --git a/apps/docs/pages/docs/typedef/CommandObject.mdx b/apps/docs/pages/docs/typedef/CommandObject.mdx
index b59118c..320ba5d 100644
--- a/apps/docs/pages/docs/typedef/CommandObject.mdx
+++ b/apps/docs/pages/docs/typedef/CommandObject.mdx
@@ -2,16 +2,16 @@
### `data`
-- Type: [`CommandData`](/docs/typedef/CommandData)
+- Type: [`CommandData`](/docs/typedef/CommandData)
### `options` (optional)
-- Type: [`CommandOptions`](/docs/typedef/CommandOptions)
+- Type: [`CommandOptions`](/docs/typedef/CommandOptions)
### `filePath`
-- Type: `string`
+- Type: `string`
### `category`
-- Type: `string` | `null`
+- Type: `string` | `null`
diff --git a/apps/docs/pages/docs/typedef/CommandOptions.mdx b/apps/docs/pages/docs/typedef/CommandOptions.mdx
index ba2d76d..9d83bbc 100644
--- a/apps/docs/pages/docs/typedef/CommandOptions.mdx
+++ b/apps/docs/pages/docs/typedef/CommandOptions.mdx
@@ -2,24 +2,24 @@
### `devOnly` (optional)
-- Type: `boolean`
+- Type: `boolean`
This determines whether the command should only be registered in development guilds and be executed by the bot developers.
### `userPermissions` (optional)
-- Type: [`PermissionsString[]`](https://discord.js.org/docs/packages/discord.js/main/PermissionsString:TypeAlias)
+- Type: [`PermissionsString[]`](https://discord.js.org/docs/packages/discord.js/main/PermissionsString:TypeAlias)
This determines whether the user has the required permissions to execute the command. This is checked against the user's permissions in the guild where the command was executed (if any).
### `botPermissions` (optional)
-- Type: [`PermissionsString[]`](https://discord.js.org/docs/packages/discord.js/main/PermissionsString:TypeAlias)
+- Type: [`PermissionsString[]`](https://discord.js.org/docs/packages/discord.js/main/PermissionsString:TypeAlias)
This determines whether the bot has the required permissions to execute the command. This is checked against the bot's permissions in the guild where the command was executed (if any).
### `deleted` (optional)
-- Type: `boolean`
+- Type: `boolean`
This determines whether the command should be deleted on the next reload.
diff --git a/apps/docs/pages/docs/typedef/ContextMenuCommandProps.mdx b/apps/docs/pages/docs/typedef/ContextMenuCommandProps.mdx
index 5f7d01c..06fbfaa 100644
--- a/apps/docs/pages/docs/typedef/ContextMenuCommandProps.mdx
+++ b/apps/docs/pages/docs/typedef/ContextMenuCommandProps.mdx
@@ -2,12 +2,12 @@
### `client`
-- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
+- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
### `handler`
-- Type: [`CommandKit`](/docs/typedef/CommandKit)
+- Type: [`CommandKit`](/docs/typedef/CommandKit)
### `interaction`
-- Type [`ContextMenuCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ContextMenuCommandInteraction)
+- Type [`ContextMenuCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ContextMenuCommandInteraction)
diff --git a/apps/docs/pages/docs/typedef/SlashCommandProps.mdx b/apps/docs/pages/docs/typedef/SlashCommandProps.mdx
index d39e99d..80565c0 100644
--- a/apps/docs/pages/docs/typedef/SlashCommandProps.mdx
+++ b/apps/docs/pages/docs/typedef/SlashCommandProps.mdx
@@ -2,12 +2,12 @@
### `client`
-- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
+- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
### `handler`
-- Type: [`CommandKit`](/typedef/CommandKit)
+- Type: [`CommandKit`](/typedef/CommandKit)
### `interaction`
-- Type [`ChatInputCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction)
+- Type [`ChatInputCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction)
diff --git a/apps/docs/pages/docs/typedef/ValidationProps.mdx b/apps/docs/pages/docs/typedef/ValidationProps.mdx
index 53d8820..8840393 100644
--- a/apps/docs/pages/docs/typedef/ValidationProps.mdx
+++ b/apps/docs/pages/docs/typedef/ValidationProps.mdx
@@ -2,16 +2,16 @@
### `client`
-- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
+- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
### `commandObj`
-- Type: [`CommandObject`](/docs/typedef/CommandObject)
+- Type: [`CommandObject`](/docs/typedef/CommandObject)
### `handler`
-- Type: [`CommandKit`](/docs/typedef/CommandKit)
+- Type: [`CommandKit`](/docs/typedef/CommandKit)
### `interaction`
-- Type: [`ChatInputCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) | [`ContextMenuCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ContextMenuCommandInteraction) | [`AutocompleteInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/AutocompleteInteraction)
+- Type: [`ChatInputCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ChatInputCommandInteraction) | [`ContextMenuCommandInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/ContextMenuCommandInteraction) | [`AutocompleteInteraction`](https://old.discordjs.dev/#/docs/discord.js/main/class/AutocompleteInteraction)
diff --git a/apps/docs/pages/docs/typedef/_meta.json b/apps/docs/pages/docs/typedef/_meta.json
index 8e2f4cf..e5e4f6a 100644
--- a/apps/docs/pages/docs/typedef/_meta.json
+++ b/apps/docs/pages/docs/typedef/_meta.json
@@ -1,12 +1,12 @@
{
- "AutocompleteProps": "AutocompleteProps",
- "CommandData": "CommandData",
- "CommandKitButtonBuilderInteractionCollectorDispatch": "CommandKitButtonBuilderInteractionCollectorDispatch",
- "CommandKitButtonBuilderInteractionCollectorDispatchContextData": "CommandKitButtonBuilderInteractionCollectorDispatchContextData",
- "CommandKitButtonBuilderOnEnd": "CommandKitButtonBuilderOnEnd",
- "CommandObject": "CommandObject",
- "CommandOptions": "CommandOptions",
- "ContextMenuCommandProps": "ContextMenuCommandProps",
- "SlashCommandProps": "SlashCommandProps",
- "ValidationProps": "ValidationProps"
+ "AutocompleteProps": "AutocompleteProps",
+ "CommandData": "CommandData",
+ "CommandKitButtonBuilderInteractionCollectorDispatch": "CommandKitButtonBuilderInteractionCollectorDispatch",
+ "CommandKitButtonBuilderInteractionCollectorDispatchContextData": "CommandKitButtonBuilderInteractionCollectorDispatchContextData",
+ "CommandKitButtonBuilderOnEnd": "CommandKitButtonBuilderOnEnd",
+ "CommandObject": "CommandObject",
+ "CommandOptions": "CommandOptions",
+ "ContextMenuCommandProps": "ContextMenuCommandProps",
+ "SlashCommandProps": "SlashCommandProps",
+ "ValidationProps": "ValidationProps"
}
diff --git a/apps/docs/pages/guide/_meta.json b/apps/docs/pages/guide/_meta.json
index af36bdb..84a4701 100644
--- a/apps/docs/pages/guide/_meta.json
+++ b/apps/docs/pages/guide/_meta.json
@@ -1,13 +1,13 @@
{
- "installation": "Installation",
- "create-commandkit": "create-commandkit",
- "commandkit-setup": "CommandKit Setup",
- "command-file-setup": "Commands Setup",
- "event-file-setup": "Events Setup",
- "validation-file-setup": "Validations Setup",
- "buttonkit": "Using ButtonKit",
- "using-cli": "Using CommandKit CLI",
- "commandkit-config": "CommandKit Config",
- "using-signals": "Using Signals",
- "migrating-from-djs-commander": "Migrating from DJS-Commander"
+ "installation": "Installation",
+ "create-commandkit": "create-commandkit",
+ "commandkit-setup": "CommandKit Setup",
+ "command-file-setup": "Commands Setup",
+ "event-file-setup": "Events Setup",
+ "validation-file-setup": "Validations Setup",
+ "buttonkit": "Using ButtonKit",
+ "using-cli": "Using CommandKit CLI",
+ "commandkit-config": "CommandKit Config",
+ "using-signals": "Using Signals",
+ "migrating-from-djs-commander": "Migrating from DJS-Commander"
}
diff --git a/apps/docs/pages/guide/buttonkit.mdx b/apps/docs/pages/guide/buttonkit.mdx
index 94655a7..e54217b 100644
--- a/apps/docs/pages/guide/buttonkit.mdx
+++ b/apps/docs/pages/guide/buttonkit.mdx
@@ -90,8 +90,9 @@ It is not recommended to use this to listen for button clicks forever since it c
In the above example, you may notice how similar `ButtonKit` is to the native Discord.js `ButtonBuilder` class. That's because it's built on top of it. It introduces a new method called `onClick` which will allow you to quickly handle button interactions without having to create collectors. CommandKit does that for you!
- ButtonKit doesn't work without a custom ID, so ensure you provide one whenever instantiating a
- button. This is required to keep track of what button was clicked.
+ ButtonKit doesn't work without a custom ID, so ensure you provide one whenever
+ instantiating a button. This is required to keep track of what button was
+ clicked.
### Arguments Explained
@@ -100,9 +101,9 @@ Here's an empty `onClick` method without any arguments:
```js copy
const myButton = new ButtonKit()
- .setCustomId('custom_button')
- .setLabel('Click me!')
- .setStyle(ButtonStyle.Primary);
+ .setCustomId('custom_button')
+ .setLabel('Click me!')
+ .setStyle(ButtonStyle.Primary);
myButton.onClick();
```
@@ -111,7 +112,7 @@ The first argument required by this function is your handler function which will
```js copy
myButton.onClick((buttonInteraction) => {
- buttonInteraction.reply('You clicked a button!');
+ buttonInteraction.reply('You clicked a button!');
});
```
@@ -122,10 +123,10 @@ const row = new ActionRowBuilder().addComponents(myButton);
const message = await channel.send({ components: [row] });
myButton.onClick(
- (buttonInteraction) => {
- buttonInteraction.reply('You clicked a button!');
- },
- { message },
+ (buttonInteraction) => {
+ buttonInteraction.reply('You clicked a button!');
+ },
+ { message },
);
```
@@ -133,13 +134,16 @@ This also works with interaction replies. Just ensure you pass `fetchReply` alon
```js copy
const row = new ActionRowBuilder().addComponents(myButton);
-const message = await interaction.reply({ components: [row], fetchReply: true });
+const message = await interaction.reply({
+ components: [row],
+ fetchReply: true,
+});
myButton.onClick(
- (buttonInteraction) => {
- buttonInteraction.reply('You clicked a button!');
- },
- { message },
+ (buttonInteraction) => {
+ buttonInteraction.reply('You clicked a button!');
+ },
+ { message },
);
```
@@ -147,26 +151,26 @@ myButton.onClick(
### `message`
-- Type: [`Message`](https://old.discordjs.dev/#/docs/discord.js/main/class/Message)
+- Type: [`Message`](https://old.discordjs.dev/#/docs/discord.js/main/class/Message)
The message object that ButtonKit uses to listen for button clicks (interactions).
### `time` (optional)
-- Type: `number`
-- Default: `86400000`
+- Type: `number`
+- Default: `86400000`
The duration (in ms) the collector should run for and listen for button clicks.
### `autoReset` (optional)
-- Type: `boolean`
+- Type: `boolean`
Whether or not the collector should automatically reset the timer when a button is clicked.
### Additional optional options
-- Type: [`InteractionCollectorOptions`](https://old.discordjs.dev/#/docs/discord.js/main/typedef/InteractionCollectorOptions)
+- Type: [`InteractionCollectorOptions`](https://old.discordjs.dev/#/docs/discord.js/main/typedef/InteractionCollectorOptions)
## Handle collector end
@@ -174,51 +178,54 @@ When setting up an `onClick()` method using ButtonKit, you may also want to run
```js copy {16-21}
const myButton = new ButtonKit()
- .setCustomId('custom_button')
- .setLabel('Click me!')
- .setStyle(ButtonStyle.Primary);
+ .setCustomId('custom_button')
+ .setLabel('Click me!')
+ .setStyle(ButtonStyle.Primary);
const row = new ActionRowBuilder().addComponents(myButton);
-const message = await interaction.reply({ components: [row], fetchReply: true });
+const message = await interaction.reply({
+ components: [row],
+ fetchReply: true,
+});
myButton
- .onClick(
- (buttonInteraction) => {
- buttonInteraction.reply('You clicked a button!');
- },
- { message },
- )
- .onEnd(() => {
- console.log('Button collector ended.');
-
- myButton.setDisabled(true);
- message.edit({ components: [row] });
- });
+ .onClick(
+ (buttonInteraction) => {
+ buttonInteraction.reply('You clicked a button!');
+ },
+ { message },
+ )
+ .onEnd(() => {
+ console.log('Button collector ended.');
+
+ myButton.setDisabled(true);
+ message.edit({ components: [row] });
+ });
```
## Dispose button collector
- This feature is currently only available in the [development
- version](/guide/installation#development-version).
+ This feature is currently only available in the [development
+ version](/guide/installation#development-version).
To dispose the button collector, you can make use of the `dispose` method. By disposing the collector like this, your `onEnd` handler (if any) will be called automatically.
```js copy {15}
myButton
- .onClick(
- (buttonInteraction) => {
- buttonInteraction.reply('You clicked a button!');
- },
- { message },
- )
- .onEnd(() => {
- console.log('Button collector ended.');
-
- myButton.setDisabled(true);
- message.edit({ components: [row] });
- });
+ .onClick(
+ (buttonInteraction) => {
+ buttonInteraction.reply('You clicked a button!');
+ },
+ { message },
+ )
+ .onEnd(() => {
+ console.log('Button collector ended.');
+
+ myButton.setDisabled(true);
+ message.edit({ components: [row] });
+ });
myButton.dispose();
```
diff --git a/apps/docs/pages/guide/command-file-setup.mdx b/apps/docs/pages/guide/command-file-setup.mdx
index dc881ee..ce1fe79 100644
--- a/apps/docs/pages/guide/command-file-setup.mdx
+++ b/apps/docs/pages/guide/command-file-setup.mdx
@@ -278,27 +278,27 @@ Here's an example of how to use the `autocomplete` function:
### `data`
-- Type: [`CommandData`](/docs/typedef/CommandData) | [`SlashCommandBuilder`](https://discord.js.org/docs/packages/builders/main/SlashCommandBuilder:Class) | [`ContextMenuCommandBuilder`](https://discord.js.org/docs/packages/builders/main/ContextMenuCommandBuilder:Class)
+- Type: [`CommandData`](/docs/typedef/CommandData) | [`SlashCommandBuilder`](https://discord.js.org/docs/packages/builders/main/SlashCommandBuilder:Class) | [`ContextMenuCommandBuilder`](https://discord.js.org/docs/packages/builders/main/ContextMenuCommandBuilder:Class)
This property contains the command's structural information, and is required to register and handle commands.
### `run`
-- Type: `void`
+- Type: `void`
-- Props Type: [`SlashCommandProps`](/docs/typedef/SlashCommandProps) | [`ContextMenuCommandProps`](/docs/typedef/ContextMenuCommandProps)
+- Props Type: [`SlashCommandProps`](/docs/typedef/SlashCommandProps) | [`ContextMenuCommandProps`](/docs/typedef/ContextMenuCommandProps)
This function will be called when the command is executed.
### `autocomplete`
-- Type: `void`
-- Props Type: [`AutocompleteProps`](/docs/typedef/AutocompleteProps)
+- Type: `void`
+- Props Type: [`AutocompleteProps`](/docs/typedef/AutocompleteProps)
This function will be called when an autocomplete interaction event is triggered for any option set as autocomplete in this command's `data` object.
### `options` (optional)
-- Type: [`CommandOptions`](/docs/typedef/CommandOptions)
+- Type: [`CommandOptions`](/docs/typedef/CommandOptions)
This property contains the command's registration/handling behaviour.
diff --git a/apps/docs/pages/guide/commandkit-config.mdx b/apps/docs/pages/guide/commandkit-config.mdx
index 005c86f..6af0b7b 100644
--- a/apps/docs/pages/guide/commandkit-config.mdx
+++ b/apps/docs/pages/guide/commandkit-config.mdx
@@ -4,14 +4,14 @@ import { Callout } from 'nextra/components';
CommandKit CLI can be configured using `commandkit.config` file in the root of your project directory (for example, by `package.json`). You can use either of the following files:
-- `commandkit.js`
-- `commandkit.config.js`
-- `commandkit.mjs`
-- `commandkit.config.mjs`
-- `commandkit.cjs`
-- `commandkit.config.cjs`
-- `commandkit.json`
-- `commandkit.config.json`
+- `commandkit.js`
+- `commandkit.config.js`
+- `commandkit.mjs`
+- `commandkit.config.mjs`
+- `commandkit.cjs`
+- `commandkit.config.cjs`
+- `commandkit.json`
+- `commandkit.config.json`
Throughout this guide, we'll be using `commandkit.config.mjs` as an example.
@@ -21,96 +21,98 @@ The following is the sample configuration required to run your bot:
import { defineConfig } from 'commandkit';
export default defineConfig({
- src: 'src', // The source directory of your project.
- main: 'index.mjs', // The JavaScript entry point of your project.
+ src: 'src', // The source directory of your project.
+ main: 'index.mjs', // The JavaScript entry point of your project.
});
```
- For CommandKit CLI on version `0.1.7` it's recommended to use an ESM project instead of CommonJS
- due to the behavior of `require()`. If you're using CommonJS you'll have to use dynamic
- `import()`. However, this is not an issue for TypeScript CommonJS projects.
+ For CommandKit CLI on version `0.1.7` it's recommended to use an ESM project
+ instead of CommonJS due to the behavior of `require()`. If you're using
+ CommonJS you'll have to use dynamic `import()`. However, this is not an issue
+ for TypeScript CommonJS projects.
## Options
### `src`
-- Type: `string`
+- Type: `string`
The source directory of the project where your source code lives.
### `main`
-- Type: `string`
+- Type: `string`
The entry point to your project.
Example: If your source is structured as `src/index.ts`, this option must be set to `index.mjs`. This is because CommandKit always compiles your source code to esm format.
- The "src" part in this option isn't required because it's already defined in the `src` option.
+ The "src" part in this option isn't required because it's already defined in
+ the `src` option.
### `watch` (optional)
-- Type: `boolean`
-- Default: `true`
+- Type: `boolean`
+- Default: `true`
Whether to watch for file changes or not.
### `outDir` (optional)
-- Type: `string`
-- Default: `"dist"`
+- Type: `string`
+- Default: `"dist"`
The output directory to emit the production build to.
### `envExtra` (optional)
-- Type: `boolean`
-- Default: `true`
+- Type: `boolean`
+- Default: `true`
Extra env utilities to load. This allows you to load environment variables in different formats, like `Date`, `JSON`, `Boolean`, etc.
### `nodeOptions` (optional)
-- Type: `string[]`
-- Default: `[]`
+- Type: `string[]`
+- Default: `[]`
Options to pass to Node.js.
### `clearRestartLogs` (optional)
-- Type: `boolean`
-- Default: `true`
+- Type: `boolean`
+- Default: `true`
Whether or not to clear default restart logs.
### `minify` (optional)
-- Type: `boolean`
-- Default: `false`
+- Type: `boolean`
+- Default: `false`
Whether or not to minify the production build.
### `sourcemap` (optional)
-- Type: `boolean` | `"inline"`
-- Default: `false`
+- Type: `boolean` | `"inline"`
+- Default: `false`
Whether or not to include sourcemaps in the production build.
### `antiCrash` (optional)
-- Type: `boolean`
-- Default: `true`
+- Type: `boolean`
+- Default: `true`
Whether or not to inject anti-crash script in the production build.
### `requirePolyfill` (optional)
-- Type: `boolean`
-- Default: `true`
+- Type: `boolean`
+- Default: `true`
Whether or not to polyfill `require` function.
diff --git a/apps/docs/pages/guide/commandkit-setup.mdx b/apps/docs/pages/guide/commandkit-setup.mdx
index f83b80c..453e25f 100644
--- a/apps/docs/pages/guide/commandkit-setup.mdx
+++ b/apps/docs/pages/guide/commandkit-setup.mdx
@@ -100,38 +100,38 @@ This is a simple overview of how to set up CommandKit with all the available opt
- Some Discord.js properties are only accessible using the correct intents.
+ Some Discord.js properties are only accessible using the correct intents.
## CommandKit options
### `client`
-- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
+- Type: [`Client`](https://old.discordjs.dev/#/docs/discord.js/main/class/Client)
This is your Discord.js client object. This is required to register and handle application commands and events.
### `commandsPath` (optional)
-- Type: `string`
+- Type: `string`
This is the path to your commands directory. It's used to fetch, register, and listen for application commands.
### `eventsPath` (optional)
-- Type: `string`
+- Type: `string`
This is the path to your events directory. It's used to fetch and set event listeners based on the folder names inside of it.
### `validationsPath` (optional)
-- Type: `string`
+- Type: `string`
This is the path to your validations directory. It's used to fetch and call validation functions before running application commands.
### `devGuildIds` (optional)
-- Type: `string[]`
+- Type: `string[]`
This is a list of development server IDs. It's used to restrict commands marked with `devOnly` to specific servers.
@@ -139,7 +139,7 @@ If there is at least 1 guild ID provided, CommandKit will register any commands
### `devUserIds` (optional)
-- Type: `string[]`
+- Type: `string[]`
This is a list of developer user IDs. It's used to restrict commands marked with `devOnly` to specific users.
@@ -147,7 +147,7 @@ Trying to execute a command when this is set to at-least 1 user ID will call a b
### `devRoleIds` (optional)
-- Type: `string[]`
+- Type: `string[]`
This is a list of developer role IDs. It's used to restrict commands marked with `devOnly` to specific roles.
@@ -155,14 +155,14 @@ Trying to execute a command when this is set to at-least 1 role ID will call a b
### `skipBuiltInValidations` (optional)
-- Type: `boolean`
-- Default: `false`
+- Type: `boolean`
+- Default: `false`
This is used to disable CommandKit's built-in validation functions. Setting this to `true` will ignore the default behaviour of validating who is running commands marked with `devOnly`.
### `bulkRegister` (optional)
-- Type: `boolean`
-- Default: `false`
+- Type: `boolean`
+- Default: `false`
This is used to change the behaviour of how CommandKit loads application commands. By default it's one-by-one while comparing changes. Setting this option to `true` will load application commands all at once on every restart, and when [`reloadCommands()`](/docs/typedef/CommandKit#reloadcommands) is called.
diff --git a/apps/docs/pages/guide/create-commandkit.mdx b/apps/docs/pages/guide/create-commandkit.mdx
index c53a550..cb1ca82 100644
--- a/apps/docs/pages/guide/create-commandkit.mdx
+++ b/apps/docs/pages/guide/create-commandkit.mdx
@@ -16,12 +16,12 @@ This will start the CLI in the current directory.
When running create-commandkit, you should be asked the following questions:
-- **Project Directory:** Defines where your project will be located. It defaults to the current working directory.
+- **Project Directory:** Defines where your project will be located. It defaults to the current working directory.
-- **Package Manager:** Lets you choose which package manager to use — npm, pnpm, or Yarn.
+- **Package Manager:** Lets you choose which package manager to use — npm, pnpm, or Yarn.
-- **Module Type:** Allows you to pick between CommonJS (using require and module.exports), and ESM (using import and export).
+- **Module Type:** Allows you to pick between CommonJS (using require and module.exports), and ESM (using import and export).
-- **Bot Token:** Asks you for your bot token, and writes it into the `.env` file where it will be stored.
+- **Bot Token:** Asks you for your bot token, and writes it into the `.env` file where it will be stored.
After these questions are answered, your project solution should appear in the selected folder.
diff --git a/apps/docs/pages/guide/installation.mdx b/apps/docs/pages/guide/installation.mdx
index 739205a..4e3ee31 100644
--- a/apps/docs/pages/guide/installation.mdx
+++ b/apps/docs/pages/guide/installation.mdx
@@ -3,22 +3,28 @@ import { Callout } from 'nextra/components';
# Installation
To install CommandKit, run one of the following commands based on your preferred package manager:
@@ -35,4 +41,6 @@ To install the development version of CommandKit, run one of the following comma
npm install commandkit@dev
```
-The development version is likely to have bugs.
+
+ The development version is likely to have bugs.
+
diff --git a/apps/docs/pages/guide/migrating-from-djs-commander.mdx b/apps/docs/pages/guide/migrating-from-djs-commander.mdx
index 5b97649..4d8a461 100644
--- a/apps/docs/pages/guide/migrating-from-djs-commander.mdx
+++ b/apps/docs/pages/guide/migrating-from-djs-commander.mdx
@@ -5,8 +5,9 @@ import { Callout } from 'nextra/components';
If you're trying to use CommandKit as a drop-in replacement for DJS-Commander, you'll need to make a few changes to your code.
- This guide is **not** introducing the features this library offers over DJS-Commander. It's just
- going over the changes you'll need to make to your code to get it working with this library.
+ This guide is **not** introducing the features this library offers over
+ DJS-Commander. It's just going over the changes you'll need to make to your
+ code to get it working with this library.
## Setting up the command handler
@@ -17,9 +18,9 @@ In DJS-Commander, you'd import and instantiate the `CommandHandler` class. The o
const { CommandKit } = require('commandkit');
new CommandKit({
- client,
- commandsPath,
- eventsPath,
+ client,
+ commandsPath,
+ eventsPath,
});
```
@@ -29,10 +30,10 @@ In DJS-Commander only a single development server was supported, and it was setu
```js
new CommandHandler({
- client,
- commandsPath,
- eventsPath,
- testServer: '123456789012345678', // ❌
+ client,
+ commandsPath,
+ eventsPath,
+ testServer: '123456789012345678', // ❌
});
```
@@ -40,10 +41,10 @@ In CommandKit, you can setup multiple development servers under the property nam
```js
new CommandKit({
- client,
- commandsPath,
- eventsPath,
- devGuildIds: ['123456789012345678', '876543210987654321'], // ✅
+ client,
+ commandsPath,
+ eventsPath,
+ devGuildIds: ['123456789012345678', '876543210987654321'], // ✅
});
```
@@ -51,18 +52,18 @@ However, this does not automatically register all the commands in those specific
```js
module.exports = {
- data: {
- name: 'ping',
- description: 'Pong!',
- },
-
- run: ({ interaction }) => {
- interaction.reply('Pong!');
- },
-
- options: {
- devOnly: true, // ✅
- },
+ data: {
+ name: 'ping',
+ description: 'Pong!',
+ },
+
+ run: ({ interaction }) => {
+ interaction.reply('Pong!');
+ },
+
+ options: {
+ devOnly: true, // ✅
+ },
};
```
@@ -70,11 +71,11 @@ This command will now be registered in your development server, however you won'
```js
new CommandKit({
- client,
- commandsPath,
- eventsPath,
- devGuildIds: ['123456789012345678', '876543210987654321'],
- devUserIds: ['123456789012345678', '876543210987654321'], // ✅
+ client,
+ commandsPath,
+ eventsPath,
+ devGuildIds: ['123456789012345678', '876543210987654321'],
+ devUserIds: ['123456789012345678', '876543210987654321'], // ✅
});
```
@@ -84,20 +85,20 @@ Deleting commands with CommandKit is a bit different from DJS-Commander's. In DJ
```js
module.exports = {
- data: {
- name: 'ping',
- description: 'Pong!',
- },
+ data: {
+ name: 'ping',
+ description: 'Pong!',
+ },
- run: ({ interaction }) => {
- interaction.reply('Pong!');
- },
+ run: ({ interaction }) => {
+ interaction.reply('Pong!');
+ },
- deleted: true, // ❌
+ deleted: true, // ❌
- options: {
- deleted: true, // ✅
- },
+ options: {
+ deleted: true, // ✅
+ },
};
```
diff --git a/apps/docs/pages/guide/using-cli.mdx b/apps/docs/pages/guide/using-cli.mdx
index 9c0e840..1e01de3 100644
--- a/apps/docs/pages/guide/using-cli.mdx
+++ b/apps/docs/pages/guide/using-cli.mdx
@@ -5,9 +5,10 @@ import { Callout } from 'nextra/components';
CommandKit CLI allows you to start, build, and manage your bot application. It also includes features such as anti-crash so you can be rest assured your bot won't crash and go offline during production.
- For CommandKit CLI on version `0.1.7` it's recommended to use an ESM project instead of CommonJS
- due to the behavior of `require()`. If you're using CommonJS you'll have to use dynamic
- `import()`. However, this is not an issue for TypeScript CommonJS projects.
+ For CommandKit CLI on version `0.1.7` it's recommended to use an ESM project
+ instead of CommonJS due to the behavior of `require()`. If you're using
+ CommonJS you'll have to use dynamic `import()`. However, this is not an issue
+ for TypeScript CommonJS projects.
To get a list of the available CLI commands, run the following command inside your project directory:
@@ -32,8 +33,8 @@ Commands:
```
- CommandKit does not perform type checking on your code. You need to do that yourself using `tsc
- --noEmit` command or any other tool of your choice.
+ CommandKit does not perform type checking on your code. You need to do that
+ yourself using `tsc --noEmit` command or any other tool of your choice.
## Available commands
diff --git a/apps/docs/pages/guide/validation-file-setup.mdx b/apps/docs/pages/guide/validation-file-setup.mdx
index cb358f7..f9add11 100644
--- a/apps/docs/pages/guide/validation-file-setup.mdx
+++ b/apps/docs/pages/guide/validation-file-setup.mdx
@@ -7,8 +7,9 @@ Validations are functions that are called before the `run` function from a comma
Validation functions are called on every command trigger, so it's important to keep them as lightweight as possible.
- Custom validation functions are called before the built-in validations provided by CommandKit.
- This provides you with more control over the flow of commands.
+ Custom validation functions are called before the built-in validations
+ provided by CommandKit. This provides you with more control over the flow of
+ commands.
@@ -79,7 +80,8 @@ The `handler` object is the current CommandKit instance.
You may notice that the code above is returning `true`. This is important as it tells the command handler to not run any other validations and to not run the command. If you do not return `true` (or any truthy value), the command will run as normal.
- Interactions (commands in this case) must be handled within 3 seconds, so make sure your
- validations are not using up much of that time. If you're using a database or an external API,
- it's recommended to implement caching to keep things quick.
+ Interactions (commands in this case) must be handled within 3 seconds, so make
+ sure your validations are not using up much of that time. If you're using a
+ database or an external API, it's recommended to implement caching to keep
+ things quick.
diff --git a/apps/docs/postcss.config.js b/apps/docs/postcss.config.js
index 67cdf1a..12a703d 100644
--- a/apps/docs/postcss.config.js
+++ b/apps/docs/postcss.config.js
@@ -1,6 +1,6 @@
module.exports = {
- plugins: {
- tailwindcss: {},
- autoprefixer: {},
- },
+ plugins: {
+ tailwindcss: {},
+ autoprefixer: {},
+ },
};
diff --git a/apps/docs/tailwind.config.ts b/apps/docs/tailwind.config.ts
index a030166..58d2ff4 100644
--- a/apps/docs/tailwind.config.ts
+++ b/apps/docs/tailwind.config.ts
@@ -1,15 +1,15 @@
import type { Config } from 'tailwindcss';
const config: Config = {
- content: [
- './pages/**/*.{js,ts,jsx,tsx,md,mdx}',
- './components/**/*.{js,ts,jsx,tsx,md,mdx}',
- './app/**/*.{js,ts,jsx,tsx,md,mdx}',
- './theme.config.tsx',
- ],
- theme: {
- extend: {},
- },
- plugins: [],
+ content: [
+ './pages/**/*.{js,ts,jsx,tsx,md,mdx}',
+ './components/**/*.{js,ts,jsx,tsx,md,mdx}',
+ './app/**/*.{js,ts,jsx,tsx,md,mdx}',
+ './theme.config.tsx',
+ ],
+ theme: {
+ extend: {},
+ },
+ plugins: [],
};
export default config;
diff --git a/apps/docs/theme.config.tsx b/apps/docs/theme.config.tsx
index 48394e9..97b7027 100644
--- a/apps/docs/theme.config.tsx
+++ b/apps/docs/theme.config.tsx
@@ -4,77 +4,83 @@ import { useRouter } from 'next/router';
import Image from 'next/image';
const config: DocsThemeConfig = {
- logo: (
-