-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,093 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
--- | ||
title: ButtonKit | ||
description: No description provided | ||
--- | ||
|
||
## ButtonKit extends ButtonBuilder | ||
|
||
```typescript | ||
ButtonKit(data); | ||
``` | ||
|
||
| Parameter | Type | Optional | | ||
| --------- | ------------------------------------------------------------- | -------- | | ||
| data | Partial\<ButtonComponentData> \| Partial\<APIButtonComponent> | ✅ | | ||
|
||
## Properties | ||
|
||
### public data: any | ||
|
||
The API data associated with this component. | ||
|
||
## Methods | ||
|
||
### public dispose(): ButtonKit | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L165) | ||
|
||
### public onClick(handler, data?): this | ||
|
||
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. | ||
|
||
```ts | ||
const button = new ButtonKit() | ||
.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], | ||
}); | ||
|
||
button.onClick( | ||
async (interaction) => { | ||
await interaction.reply('You clicked me!'); | ||
}, | ||
{ message }, | ||
); | ||
|
||
// Remove onClick handler and destroy the interaction collector | ||
button.onClick(null); | ||
``` | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | -------------------------------------------------------------- | -------- | ----------------------------------------------------- | | ||
| handler | CommandKitButtonBuilderInteractionCollectorDispatch | ❌ | The handler to run when the button is clicked | | ||
| data | CommandKitButtonBuilderInteractionCollectorDispatchContextData | ✅ | The context data to use for the interaction collector | | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L74) | ||
|
||
### public onEnd(handler): this | ||
|
||
| Parameter | Type | Optional | | ||
| --------- | ---------------------------- | -------- | | ||
| handler | CommandKitButtonBuilderOnEnd | ❌ | | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L98) | ||
|
||
### public setCustomId(customId): this | ||
|
||
Sets the custom id for this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ------------------------------------------------------------------------------------------------- | -------- | -------------------- | | ||
| customId | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ❌ | The custom id to use | | ||
|
||
### public setDisabled(disabled?): this | ||
|
||
Sets whether this button is disabled. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | --------------------------------------------------------------------------------------------------- | -------- | ------------------------------ | | ||
| disabled | [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | ✅ | Whether to disable this button | | ||
|
||
### public setEmoji(emoji): this | ||
|
||
Sets the emoji to display on this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ------------------------ | -------- | ---------------- | | ||
| emoji | ComponentEmojiResolvable | ❌ | The emoji to use | | ||
|
||
### public setLabel(label): this | ||
|
||
Sets the label for this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ---------------- | | ||
| label | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ❌ | The label to use | | ||
|
||
### public setSKUId(skuId): this | ||
|
||
Sets the SKU id that represents a purchasable SKU for this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ----------------- | | ||
| skuId | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ❌ | The SKU id to use | | ||
|
||
### public setStyle(style): this | ||
|
||
Sets the style of this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ----------- | -------- | ---------------- | | ||
| style | ButtonStyle | ❌ | The style to use | | ||
|
||
### public setURL(url): this | ||
|
||
Sets the URL for this button. | ||
|
||
| Parameter | Type | Optional | Description | | ||
| --------- | ------------------------------------------------------------------------------------------------- | -------- | -------------- | | ||
| url | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ❌ | The URL to use | | ||
|
||
### public toJSON(): APIButtonComponent | ||
|
||
ComponentBuilder.toJSON | ||
|
||
### public static from(other): ButtonBuilder | ||
|
||
| Parameter | Type | Optional | | ||
| --------- | ------------------ | ---------------------------------- | --- | | ||
| other | APIButtonComponent | JSONEncodable\<APIButtonComponent> | ❌ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,84 @@ | ||
--- | ||
title: CommandKit | ||
description: CommandKit is a command handler for Discord.js that makes it easy to create and manage commands, events, and validations. | ||
description: No description provided | ||
--- | ||
|
||
# CommandKit | ||
## CommandKit | ||
|
||
### `commands` | ||
```typescript | ||
CommandKit(options); | ||
``` | ||
|
||
- Type: [`CommandObject[]`](/docs/typedef/CommandObject) | ||
| Parameter | Type | Optional | Description | | ||
| --------- | ----------------- | -------- | ------------------------------------- | | ||
| options | CommandKitOptions | ❌ | The default CommandKit configuration. | | ||
|
||
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. | ||
## Properties | ||
|
||
### `commandsPath` | ||
### public static \_instance: any | ||
|
||
- Type: `string` | `undefined` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L8) | ||
|
||
The path to the commands directory which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
### public client: any | ||
|
||
### `eventsPath` | ||
Get the client attached to this CommandKit instance. | ||
|
||
- Type: `string` | `undefined` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L38) | ||
|
||
The path to the events directory which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
### public commandHandler: any | ||
|
||
### `validationsPath` | ||
Get command handler instance. | ||
|
||
- Type: `string` | `undefined` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L45) | ||
|
||
The path to the validations directory which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
### public commands: any | ||
|
||
### `devUserIds` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L125) | ||
|
||
- Type: `string[]` | ||
### public commandsPath: any | ||
|
||
The array of developer user IDs which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L141) | ||
|
||
### `devGuildIds` | ||
### public devGuildIds: any | ||
|
||
- Type: `string[]` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L169) | ||
|
||
The array of development server IDs which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
### public devRoleIds: any | ||
|
||
### `devRoleIds` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L176) | ||
|
||
- Type: `string[]` | ||
### public devUserIds: any | ||
|
||
The array of developer role IDs which was set when [instantiating CommandKit](/guide/commandkit-setup). | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L162) | ||
|
||
### `reloadCommands` | ||
### public eventsPath: any | ||
|
||
- Props type: `'dev'` | `'global'` | [`ReloadType`](/docs/enums/ReloadType) (optional) | ||
- Return type: `Promise<void>` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L148) | ||
|
||
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`](/guide/commandkit-setup#bulkregister-optional). | ||
### public validationsPath: any | ||
|
||
### `reloadEvents` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L155) | ||
|
||
- Return type: `Promise<void>` | ||
## Methods | ||
|
||
Resets and reloads application events. | ||
### public reloadCommands(type?): [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)> | ||
|
||
### `reloadValidations` | ||
Updates application commands with the latest from "commandsPath". | ||
|
||
- Return type: `Promise<void>` | ||
| Parameter | Type | Optional | | ||
| --------- | ------------- | -------- | | ||
| type | ReloadOptions | ✅ | | ||
|
||
Reloads application commands validations. | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L101) | ||
|
||
### public reloadEvents(): [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)> | ||
|
||
Updates application events with the latest from "eventsPath". | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L109) | ||
|
||
### public reloadValidations(): [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[void](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)> | ||
|
||
Updates application command validations with the latest from "validationsPath". | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L117) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Classes | ||
description: Classes provided by CommandKit | ||
--- | ||
|
||
# Classes | ||
|
||
<Cards><Card title="ButtonKit" description="No description available." href="/docs/classes/ButtonKit" /> | ||
|
||
<Card title="CommandKit" description="No description available." href="/docs/classes/CommandKit" /></Cards> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
--- | ||
title: ReloadType | ||
description: The type of reload to perform when reloading commands or events. | ||
description: No description provided | ||
--- | ||
|
||
# ReloadType | ||
## ReloadType | ||
|
||
### Developer | ||
| Property | Type | Value | Description | | ||
| --------- | -------- | ----- | -------------------------------- | | ||
| Developer | 'dev' | N/A | Reload developer/guild commands. | | ||
| Global | 'global' | N/A | Reload global commands. | | ||
|
||
- Value: `dev` | ||
|
||
### Global | ||
|
||
- Value: `global` | ||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/types.ts#L284) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Enums | ||
description: Enums provided by CommandKit | ||
--- | ||
|
||
# Enums | ||
|
||
<Cards> | ||
<Card | ||
title="ReloadType" | ||
description="No description available." | ||
href="/docs/enums/ReloadType" | ||
/> | ||
</Cards> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: defineConfig | ||
description: No description provided | ||
--- | ||
|
||
### defineConfig(config): Partial\<[CommandKitConfig](/docs/types/CommandKitConfig.mdx)> | ||
|
||
| Parameter | Type | Optional | | ||
| --------- | -------------------------------------------------------------------- | -------- | | ||
| config | PartialConfig\<[CommandKitConfig](/docs/types/CommandKitConfig.mdx)> | ❌ | | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/config.ts#L71) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: getConfig | ||
description: No description provided | ||
--- | ||
|
||
### getConfig(): [CommandKitConfig](/docs/types/CommandKitConfig.mdx) | ||
|
||
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/config.ts#L60) |
Oops, something went wrong.