Skip to content

Commit fe9b9d8

Browse files
committed
feat: add automatic docgen
1 parent c462cc3 commit fe9b9d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1093
-281
lines changed

apps/docs/app/(home)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default function HomePage() {
8080
Guide
8181
</Link>
8282
<Link
83-
href="/docs/typedef/AutocompleteProps"
83+
href="/docs"
8484
className="font-semibold bg-blue-500 py-2 px-4 rounded-full"
8585
>
8686
Docs

apps/docs/app/layout.config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const baseOptions: BaseLayoutProps = {
1919
},
2020
{
2121
text: 'Documentation',
22-
url: '/docs/typedef/AutocompleteProps',
22+
url: '/docs',
2323
active: 'nested-url',
2424
},
2525
{
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
title: ButtonKit
3+
description: No description provided
4+
---
5+
6+
## ButtonKit extends ButtonBuilder
7+
8+
```typescript
9+
ButtonKit(data);
10+
```
11+
12+
| Parameter | Type | Optional |
13+
| --------- | ------------------------------------------------------------- | -------- |
14+
| data | Partial\<ButtonComponentData> \| Partial\<APIButtonComponent> ||
15+
16+
## Properties
17+
18+
### public data: any
19+
20+
The API data associated with this component.
21+
22+
## Methods
23+
24+
### public dispose(): ButtonKit
25+
26+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L165)
27+
28+
### public onClick(handler, data?): this
29+
30+
Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used.
31+
If unused, this expires after 24 hours or custom time if specified.
32+
33+
```ts
34+
const button = new ButtonKit()
35+
.setLabel('Click me')
36+
.setStyle(ButtonStyle.Primary)
37+
.setCustomId('click_me');
38+
39+
const row = new ActionRowBuilder().addComponents(button);
40+
41+
const message = await channel.send({
42+
content: 'Click the button',
43+
components: [row],
44+
});
45+
46+
button.onClick(
47+
async (interaction) => {
48+
await interaction.reply('You clicked me!');
49+
},
50+
{ message },
51+
);
52+
53+
// Remove onClick handler and destroy the interaction collector
54+
button.onClick(null);
55+
```
56+
57+
| Parameter | Type | Optional | Description |
58+
| --------- | -------------------------------------------------------------- | -------- | ----------------------------------------------------- |
59+
| handler | CommandKitButtonBuilderInteractionCollectorDispatch || The handler to run when the button is clicked |
60+
| data | CommandKitButtonBuilderInteractionCollectorDispatchContextData || The context data to use for the interaction collector |
61+
62+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L74)
63+
64+
### public onEnd(handler): this
65+
66+
| Parameter | Type | Optional |
67+
| --------- | ---------------------------- | -------- |
68+
| handler | CommandKitButtonBuilderOnEnd ||
69+
70+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L98)
71+
72+
### public setCustomId(customId): this
73+
74+
Sets the custom id for this button.
75+
76+
| Parameter | Type | Optional | Description |
77+
| --------- | ------------------------------------------------------------------------------------------------- | -------- | -------------------- |
78+
| customId | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) || The custom id to use |
79+
80+
### public setDisabled(disabled?): this
81+
82+
Sets whether this button is disabled.
83+
84+
| Parameter | Type | Optional | Description |
85+
| --------- | --------------------------------------------------------------------------------------------------- | -------- | ------------------------------ |
86+
| disabled | [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) || Whether to disable this button |
87+
88+
### public setEmoji(emoji): this
89+
90+
Sets the emoji to display on this button.
91+
92+
| Parameter | Type | Optional | Description |
93+
| --------- | ------------------------ | -------- | ---------------- |
94+
| emoji | ComponentEmojiResolvable || The emoji to use |
95+
96+
### public setLabel(label): this
97+
98+
Sets the label for this button.
99+
100+
| Parameter | Type | Optional | Description |
101+
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ---------------- |
102+
| label | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) || The label to use |
103+
104+
### public setSKUId(skuId): this
105+
106+
Sets the SKU id that represents a purchasable SKU for this button.
107+
108+
| Parameter | Type | Optional | Description |
109+
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ----------------- |
110+
| skuId | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) || The SKU id to use |
111+
112+
### public setStyle(style): this
113+
114+
Sets the style of this button.
115+
116+
| Parameter | Type | Optional | Description |
117+
| --------- | ----------- | -------- | ---------------- |
118+
| style | ButtonStyle || The style to use |
119+
120+
### public setURL(url): this
121+
122+
Sets the URL for this button.
123+
124+
| Parameter | Type | Optional | Description |
125+
| --------- | ------------------------------------------------------------------------------------------------- | -------- | -------------- |
126+
| url | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) || The URL to use |
127+
128+
### public toJSON(): APIButtonComponent
129+
130+
ComponentBuilder.toJSON
131+
132+
### public static from(other): ButtonBuilder
133+
134+
| Parameter | Type | Optional |
135+
| --------- | ------------------ | ---------------------------------- | --- |
136+
| other | APIButtonComponent | JSONEncodable\<APIButtonComponent> ||
Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,84 @@
11
---
22
title: CommandKit
3-
description: CommandKit is a command handler for Discord.js that makes it easy to create and manage commands, events, and validations.
3+
description: No description provided
44
---
55

6-
# CommandKit
6+
## CommandKit
77

8-
### `commands`
8+
```typescript
9+
CommandKit(options);
10+
```
911

10-
- Type: [`CommandObject[]`](/docs/typedef/CommandObject)
12+
| Parameter | Type | Optional | Description |
13+
| --------- | ----------------- | -------- | ------------------------------------- |
14+
| options | CommandKitOptions || The default CommandKit configuration. |
1115

12-
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.
16+
## Properties
1317

14-
### `commandsPath`
18+
### public static \_instance: any
1519

16-
- Type: `string` | `undefined`
20+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L8)
1721

18-
The path to the commands directory which was set when [instantiating CommandKit](/guide/commandkit-setup).
22+
### public client: any
1923

20-
### `eventsPath`
24+
Get the client attached to this CommandKit instance.
2125

22-
- Type: `string` | `undefined`
26+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L38)
2327

24-
The path to the events directory which was set when [instantiating CommandKit](/guide/commandkit-setup).
28+
### public commandHandler: any
2529

26-
### `validationsPath`
30+
Get command handler instance.
2731

28-
- Type: `string` | `undefined`
32+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L45)
2933

30-
The path to the validations directory which was set when [instantiating CommandKit](/guide/commandkit-setup).
34+
### public commands: any
3135

32-
### `devUserIds`
36+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L125)
3337

34-
- Type: `string[]`
38+
### public commandsPath: any
3539

36-
The array of developer user IDs which was set when [instantiating CommandKit](/guide/commandkit-setup).
40+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L141)
3741

38-
### `devGuildIds`
42+
### public devGuildIds: any
3943

40-
- Type: `string[]`
44+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L169)
4145

42-
The array of development server IDs which was set when [instantiating CommandKit](/guide/commandkit-setup).
46+
### public devRoleIds: any
4347

44-
### `devRoleIds`
48+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L176)
4549

46-
- Type: `string[]`
50+
### public devUserIds: any
4751

48-
The array of developer role IDs which was set when [instantiating CommandKit](/guide/commandkit-setup).
52+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L162)
4953

50-
### `reloadCommands`
54+
### public eventsPath: any
5155

52-
- Props type: `'dev'` | `'global'` | [`ReloadType`](/docs/enums/ReloadType) (optional)
53-
- Return type: `Promise<void>`
56+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L148)
5457

55-
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).
58+
### public validationsPath: any
5659

57-
### `reloadEvents`
60+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L155)
5861

59-
- Return type: `Promise<void>`
62+
## Methods
6063

61-
Resets and reloads application events.
64+
### 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)>
6265

63-
### `reloadValidations`
66+
Updates application commands with the latest from "commandsPath".
6467

65-
- Return type: `Promise<void>`
68+
| Parameter | Type | Optional |
69+
| --------- | ------------- | -------- |
70+
| type | ReloadOptions ||
6671

67-
Reloads application commands validations.
72+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L101)
73+
74+
### 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)>
75+
76+
Updates application events with the latest from "eventsPath".
77+
78+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L109)
79+
80+
### 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)>
81+
82+
Updates application command validations with the latest from "validationsPath".
83+
84+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/CommandKit.ts#L117)

apps/docs/content/docs/classes/components/ButtonKit.mdx

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Classes
3+
description: Classes provided by CommandKit
4+
---
5+
6+
# Classes
7+
8+
<Cards><Card title="ButtonKit" description="No description available." href="/docs/classes/ButtonKit" />
9+
10+
<Card title="CommandKit" description="No description available." href="/docs/classes/CommandKit" /></Cards>
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: ReloadType
3-
description: The type of reload to perform when reloading commands or events.
3+
description: No description provided
44
---
55

6-
# ReloadType
6+
## ReloadType
77

8-
### Developer
8+
| Property | Type | Value | Description |
9+
| --------- | -------- | ----- | -------------------------------- |
10+
| Developer | 'dev' | N/A | Reload developer/guild commands. |
11+
| Global | 'global' | N/A | Reload global commands. |
912

10-
- Value: `dev`
11-
12-
### Global
13-
14-
- Value: `global`
13+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/types.ts#L284)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Enums
3+
description: Enums provided by CommandKit
4+
---
5+
6+
# Enums
7+
8+
<Cards>
9+
<Card
10+
title="ReloadType"
11+
description="No description available."
12+
href="/docs/enums/ReloadType"
13+
/>
14+
</Cards>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: defineConfig
3+
description: No description provided
4+
---
5+
6+
### defineConfig(config): Partial\<[CommandKitConfig](/docs/types/CommandKitConfig.mdx)>
7+
8+
| Parameter | Type | Optional |
9+
| --------- | -------------------------------------------------------------------- | -------- |
10+
| config | PartialConfig\<[CommandKitConfig](/docs/types/CommandKitConfig.mdx)> ||
11+
12+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/config.ts#L71)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: getConfig
3+
description: No description provided
4+
---
5+
6+
### getConfig(): [CommandKitConfig](/docs/types/CommandKitConfig.mdx)
7+
8+
- [Source](https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/config.ts#L60)

0 commit comments

Comments
 (0)