Skip to content

Commit 0584954

Browse files
committed
docs: add missing, fix existing
1 parent abc5d99 commit 0584954

Some content is hidden

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

51 files changed

+309
-51
lines changed

packages/builders/src/components/ActionRow.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ export interface ActionRowBuilderData
4343

4444
/**
4545
* A builder that creates API-compatible JSON data for action rows.
46-
*
47-
* @typeParam ComponentType - The types of components this action row holds
4846
*/
4947
export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIComponentInActionRow>> {
48+
/**
49+
* @internal
50+
*/
5051
protected readonly data: ActionRowBuilderData;
5152

5253
/**
@@ -94,8 +95,8 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
9495
super();
9596
this.data = {
9697
...structuredClone(data),
97-
type: ComponentType.ActionRow,
9898
components: components.map((component) => createComponentBuilder(component)),
99+
type: ComponentType.ActionRow,
99100
};
100101
}
101102

packages/builders/src/components/Component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface ComponentBuilderBaseData {
1313
export abstract class ComponentBuilder<Component extends APIBaseComponent<ComponentType>>
1414
implements JSONEncodable<Component>
1515
{
16+
/**
17+
* @internal
18+
*/
1619
protected abstract readonly data: ComponentBuilderBaseData;
1720

1821
/**

packages/builders/src/components/button/Button.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { ComponentBuilder } from '../Component.js';
77
* A builder that creates API-compatible JSON data for buttons.
88
*/
99
export abstract class BaseButtonBuilder<ButtonData extends APIButtonComponent> extends ComponentBuilder<ButtonData> {
10+
/**
11+
* @internal
12+
*/
1013
declare protected readonly data: Partial<ButtonData>;
1114

1215
/**

packages/builders/src/components/button/CustomIdButton.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export type CustomIdButtonStyle = APIButtonComponentWithCustomId['style'];
77

88
/**
99
* A builder that creates API-compatible JSON data for buttons with custom IDs.
10+
*
11+
* @mixes BaseButtonBuilder<APIButtonComponentWithCustomId>
12+
* @mixes EmojiOrLabelButtonMixin
1013
*/
1114
export abstract class CustomIdButtonBuilder extends Mixin(
1215
BaseButtonBuilder<APIButtonComponentWithCustomId>,

packages/builders/src/components/button/LinkButton.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { EmojiOrLabelButtonMixin } from './mixins/EmojiOrLabelButtonMixin.js';
1010

1111
/**
1212
* A builder that creates API-compatible JSON data for buttons with links.
13+
*
14+
* @mixes BaseButtonBuilder<APIButtonComponentWithURL>
15+
* @mixes EmojiOrLabelButtonMixin
1316
*/
1417
export class LinkButtonBuilder extends Mixin(BaseButtonBuilder<APIButtonComponentWithURL>, EmojiOrLabelButtonMixin) {
1518
protected override readonly data: Partial<APIButtonComponentWithURL>;

packages/builders/src/components/button/mixins/EmojiOrLabelButtonMixin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import type { APIButtonComponent, APIButtonComponentWithSKUId, APIMessageCompone
33
export interface EmojiOrLabelButtonData
44
extends Pick<Exclude<APIButtonComponent, APIButtonComponentWithSKUId>, 'emoji' | 'label'> {}
55

6+
/**
7+
* A mixin that adds emoji and label symbols to a button builder.
8+
*/
69
export class EmojiOrLabelButtonMixin {
10+
/**
11+
* @internal
12+
*/
713
declare protected readonly data: EmojiOrLabelButtonData;
814

915
/**

packages/builders/src/components/selectMenu/BaseSelectMenu.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import { ComponentBuilder } from '../Component.js';
55
/**
66
* The base select menu builder that contains common symbols for select menu builders.
77
*
8-
* @typeParam SelectMenuType - The type of select menu this would be instantiated for.
8+
* @typeParam Data - The type of API data that is stored within the builder
99
*/
1010
export abstract class BaseSelectMenuBuilder<Data extends APISelectMenuComponent>
1111
extends ComponentBuilder<Data>
1212
implements JSONEncodable<APISelectMenuComponent>
1313
{
14+
/**
15+
* @internal
16+
*/
1417
protected abstract override readonly data: Partial<
1518
Pick<Data, 'custom_id' | 'disabled' | 'id' | 'max_values' | 'min_values' | 'placeholder'>
1619
>;

packages/builders/src/components/textInput/TextInput.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { textInputPredicate } from './Assertions.js';
77
* A builder that creates API-compatible JSON data for text inputs.
88
*/
99
export class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
10+
/**
11+
* @internal
12+
*/
1013
protected readonly data: Partial<APITextInputComponent>;
1114

1215
/**

packages/builders/src/components/v2/Container.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable jsdoc/check-param-names */
2+
13
import type {
24
APIActionRowComponent,
35
APIFileComponent,
@@ -34,13 +36,31 @@ export interface ContainerBuilderData extends Partial<Omit<APIContainerComponent
3436
components: ContainerComponentBuilders[];
3537
}
3638

39+
/**
40+
* A builder that creates API-compatible JSON data for containers.
41+
*/
3742
export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
43+
/**
44+
* @internal
45+
*/
3846
protected readonly data: ContainerBuilderData;
3947

40-
public constructor({ components = [], ...rest }: Partial<APIContainerComponent> = {}) {
48+
/**
49+
* Gets the components within this container.
50+
*/
51+
public get components(): readonly ContainerComponentBuilders[] {
52+
return this.data.components;
53+
}
54+
55+
/**
56+
* Creates a new container builder.
57+
*
58+
* @param data - The API data to create the container with
59+
*/
60+
public constructor({ components = [], ...data }: Partial<APIContainerComponent> = {}) {
4161
super();
4262
this.data = {
43-
...structuredClone(rest),
63+
...structuredClone(data),
4464
components: components.map((component) => createComponentBuilder(component)),
4565
type: ComponentType.Container,
4666
};

packages/builders/src/components/v2/File.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
/* eslint-disable jsdoc/check-param-names */
2+
13
import { ComponentType, type APIFileComponent } from 'discord-api-types/v10';
24
import { validate } from '../../util/validation.js';
35
import { ComponentBuilder } from '../Component.js';
46
import { filePredicate } from './Assertions.js';
57

8+
/**
9+
* A builder that creates API-compatible JSON data for files.
10+
*/
611
export class FileBuilder extends ComponentBuilder<APIFileComponent> {
12+
/**
13+
* @internal
14+
*/
715
protected readonly data: Partial<APIFileComponent>;
816

917
/**
@@ -31,11 +39,11 @@ export class FileBuilder extends ComponentBuilder<APIFileComponent> {
3139
* .setSpoiler(false);
3240
* ```
3341
*/
34-
public constructor(data: Partial<APIFileComponent> = {}) {
42+
public constructor({ file, ...rest }: Partial<APIFileComponent> = {}) {
3543
super();
3644
this.data = {
37-
...structuredClone(data),
38-
file: data.file ? { url: data.file.url } : undefined,
45+
...structuredClone(rest),
46+
file: file && { url: file.url },
3947
type: ComponentType.File,
4048
};
4149
}

0 commit comments

Comments
 (0)