Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Dec 14, 2024
1 parent 0722bd1 commit 6ce87cb
Show file tree
Hide file tree
Showing 32 changed files with 465 additions and 298 deletions.
112 changes: 63 additions & 49 deletions apps/docs/content/docs/classes/ButtonKit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@ title: ButtonKit
description: No description provided
---


## ButtonKit extends ButtonBuilder


```typescript
ButtonKit(data)
ButtonKit(data);
```
| Parameter | Type | Optional |
| ----------- | ----------- | ----------- |
| data | Partial\<ButtonComponentData> \| Partial\<APIButtonComponent> ||

| 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/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/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.

Expand All @@ -34,89 +38,99 @@ const button = new ButtonKit()

const row = new ActionRowBuilder().addComponents(button);

const message = await channel.send({ content: 'Click the button', components: [row] });
const message = await channel.send({
content: 'Click the button',
components: [row],
});

button.onClick(async (interaction) => {
await interaction.reply('You clicked me!');
}, { message });
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 |

| 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/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/components/ButtonKit.ts#L74)

### public onEnd(handler): this
| Parameter | Type | Optional |
| ----------- | ----------- | ----------- |
| handler | CommandKitButtonBuilderOnEnd ||

| Parameter | Type | Optional |
| --------- | ---------------------------- | -------- |
| handler | CommandKitButtonBuilderOnEnd ||

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/components/ButtonKit.ts#L98)

### public setCustomId(customId): this
Sets the custom id for this button.

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 |

| 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.

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 |

| 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.

Sets the emoji to display on this button.

| Parameter | Type | Optional | Description |
| --------- | ------------------------ | -------- | ---------------- |
| emoji | ComponentEmojiResolvable || The emoji to use |

| Parameter | Type | Optional | Description |
| ----------- | ----------- | ----------- | ----------- |
| emoji | ComponentEmojiResolvable || The emoji to use |
### public setLabel(label): this
Sets the label for this button.

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 |

| 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.

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 |

| 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.

Sets the style of this button.

| Parameter | Type | Optional | Description |
| --------- | ----------- | -------- | ---------------- |
| style | ButtonStyle || The style to use |

| Parameter | Type | Optional | Description |
| ----------- | ----------- | ----------- | ----------- |
| style | ButtonStyle || The style to use |
### public setURL(url): this
Sets the URL for this button.

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 |

| 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> ||

| Parameter | Type | Optional |
| --------- | ------------------ | ---------------------------------- | --- |
| other | APIButtonComponent | JSONEncodable\<APIButtonComponent> ||
53 changes: 35 additions & 18 deletions apps/docs/content/docs/classes/CommandKit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,82 @@ title: CommandKit
description: No description provided
---


## CommandKit


```typescript
CommandKit(options)
CommandKit(options);
```
| Parameter | Type | Optional | Description |
| ----------- | ----------- | ----------- | ----------- |
| options | CommandKitOptions || The default CommandKit configuration. |

| Parameter | Type | Optional | Description |
| --------- | ----------------- | -------- | ------------------------------------- |
| options | CommandKitOptions || The default CommandKit configuration. |

## Properties
### public static _instance: any

### public static \_instance: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L8)

### public client: any

Get the client attached to this CommandKit instance.

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L38)

### public commandHandler: any

Get command handler instance.

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L45)

### public commands: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L125)

### public commandsPath: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L141)

### public devGuildIds: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L169)

### public devRoleIds: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L176)

### public devUserIds: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L162)

### public eventsPath: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L148)

### public validationsPath: any

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L155)

## Methods
### 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)>
Updates application commands with the latest from "commandsPath".


### 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)>

| Parameter | Type | Optional |
| ----------- | ----------- | ----------- |
| type | ReloadOptions ||
Updates application commands with the latest from "commandsPath".

| Parameter | Type | Optional |
| --------- | ------------- | -------- |
| type | ReloadOptions ||

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/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".

### 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/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/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".

### 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/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L117)
- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/CommandKit.ts#L117)
2 changes: 1 addition & 1 deletion apps/docs/content/docs/classes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ description: Classes provided by CommandKit

<Cards><Card title="ButtonKit" description="No description available." href="/docs/classes/ButtonKit" />

<Card title="CommandKit" description="No description available." href="/docs/classes/CommandKit" /></Cards>
<Card title="CommandKit" description="No description available." href="/docs/classes/CommandKit" /></Cards>
11 changes: 5 additions & 6 deletions apps/docs/content/docs/enums/ReloadType.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ description: No description provided

## ReloadType

| Property | Type | Value | Description |
| ----------- | ----------- | ----------- | ----------- |
| Developer | 'dev' | N/A | Reload developer/guild commands. |
| Global | 'global' | N/A | Reload global commands. |
| Property | Type | Value | Description |
| --------- | -------- | ----- | -------------------------------- |
| Developer | 'dev' | N/A | Reload developer/guild commands. |
| Global | 'global' | N/A | Reload global commands. |


- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/types.ts#L284)
- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/types.ts#L284)
8 changes: 7 additions & 1 deletion apps/docs/content/docs/enums/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ description: Enums provided by CommandKit

# Enums

<Cards><Card title="ReloadType" description="No description available." href="/docs/enums/ReloadType" /></Cards>
<Cards>
<Card
title="ReloadType"
description="No description available."
href="/docs/enums/ReloadType"
/>
</Cards>
10 changes: 4 additions & 6 deletions apps/docs/content/docs/functions/defineConfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ title: defineConfig
description: No description provided
---


### defineConfig(config): Partial\<[CommandKitConfig](/docs/types/CommandKitConfig)>

| Parameter | Type | Optional |
| ----------- | ----------- | ----------- |
| config | PartialConfig\<[CommandKitConfig](/docs/types/CommandKitConfig)> ||

| Parameter | Type | Optional |
| --------- | ---------------------------------------------------------------- | -------- |
| config | PartialConfig\<[CommandKitConfig](/docs/types/CommandKitConfig)> ||

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/config.ts#L71)
- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/config.ts#L71)
3 changes: 1 addition & 2 deletions apps/docs/content/docs/functions/getConfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: getConfig
description: No description provided
---


### getConfig(): [CommandKitConfig](/docs/types/CommandKitConfig)

- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/config.ts#L60)
- [Source](https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/config.ts#L60)
2 changes: 1 addition & 1 deletion apps/docs/content/docs/functions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ description: Functions provided by CommandKit

<Cards><Card title="defineConfig" description="No description available." href="/docs/functions/defineConfig" />

<Card title="getConfig" description="No description available." href="/docs/functions/getConfig" /></Cards>
<Card title="getConfig" description="No description available." href="/docs/functions/getConfig" /></Cards>
Loading

0 comments on commit 6ce87cb

Please sign in to comment.