@@ -3,30 +3,26 @@ title: ButtonKit
33description : No description provided
44---
55
6+
67## ButtonKit extends ButtonBuilder
78
9+
810``` typescript
9- ButtonKit (data );
11+ ButtonKit (data )
1012```
13+ | Parameter | Type | Optional |
14+ | ----------- | ----------- | ----------- |
15+ | data | Partial\< ButtonComponentData> \| Partial\< APIButtonComponent> | ✅ |
1116
12- | Parameter | Type | Optional |
13- | --------- | ------------------------------------------------------------- | -------- |
14- | data | Partial\< ButtonComponentData> \| Partial\< APIButtonComponent> | ✅ |
1517
1618## Properties
17-
1819### public data: any
19-
2020The API data associated with this component.
2121
2222## Methods
23-
2423### public dispose(): ButtonKit
25-
26- - [ Source] ( https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L165 )
27-
24+ - [ Source] ( https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/components/ButtonKit.ts#L165 )
2825### public onClick(handler, data?): this
29-
3026Sets up an inline interaction collector for this button. This collector by default allows as many interactions as possible if it is actively used.
3127If unused, this expires after 24 hours or custom time if specified.
3228
@@ -38,99 +34,89 @@ const button = new ButtonKit()
3834
3935const row = new ActionRowBuilder ().addComponents (button );
4036
41- const message = await channel .send ({
42- content: ' Click the button' ,
43- components: [row ],
44- });
37+ const message = await channel .send ({ content: ' Click the button' , components: [row ] });
4538
46- button .onClick (
47- async (interaction ) => {
48- await interaction .reply (' You clicked me!' );
49- },
50- { message },
51- );
39+ button .onClick (async (interaction ) => {
40+ await interaction .reply (' You clicked me!' );
41+ }, { message });
5242
5343// Remove onClick handler and destroy the interaction collector
5444button .onClick (null );
5545```
5646
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 |
47+ | Parameter | Type | Optional | Description |
48+ | ----------- | ----------- | ----------- | ----------- |
49+ | handler | CommandKitButtonBuilderInteractionCollectorDispatch | ❌ | The handler to run when the button is clicked |
50+ | data | CommandKitButtonBuilderInteractionCollectorDispatchContextData | ✅ | The context data to use for the interaction collector |
6151
62- - [ Source] ( https://github.com/underctrl-io/commandkit/blob/c462cc3d6f765a7ee19e33a651f0f2f4666b111b/packages/commandkit/src/components/ButtonKit.ts#L74 )
6352
53+ - [ Source] ( https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/components/ButtonKit.ts#L74 )
6454### public onEnd(handler): this
55+ | Parameter | Type | Optional |
56+ | ----------- | ----------- | ----------- |
57+ | handler | CommandKitButtonBuilderOnEnd | ❌ |
6558
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 )
7159
60+ - [ Source] ( https://github.com/underctrl-io/commandkit/blob/fe9b9d88f8541b4758cc813e8505d26748e6e5bd/packages/commandkit/src/components/ButtonKit.ts#L98 )
7261### public setCustomId(customId): this
73-
7462Sets the custom id for this button.
7563
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 |
7964
80- ### public setDisabled(disabled?): this
8165
66+ | Parameter | Type | Optional | Description |
67+ | ----------- | ----------- | ----------- | ----------- |
68+ | customId | [ string] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String ) | ❌ | The custom id to use |
69+ ### public setDisabled(disabled?): this
8270Sets whether this button is disabled.
8371
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 |
8772
88- ### public setEmoji(emoji): this
8973
74+ | Parameter | Type | Optional | Description |
75+ | ----------- | ----------- | ----------- | ----------- |
76+ | disabled | [ boolean] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean ) | ✅ | Whether to disable this button |
77+ ### public setEmoji(emoji): this
9078Sets the emoji to display on this button.
9179
92- | Parameter | Type | Optional | Description |
93- | --------- | ------------------------ | -------- | ---------------- |
94- | emoji | ComponentEmojiResolvable | ❌ | The emoji to use |
9580
96- ### public setLabel(label): this
9781
82+ | Parameter | Type | Optional | Description |
83+ | ----------- | ----------- | ----------- | ----------- |
84+ | emoji | ComponentEmojiResolvable | ❌ | The emoji to use |
85+ ### public setLabel(label): this
9886Sets the label for this button.
9987
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 |
10388
104- ### public setSKUId(skuId): this
10589
90+ | Parameter | Type | Optional | Description |
91+ | ----------- | ----------- | ----------- | ----------- |
92+ | label | [ string] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String ) | ❌ | The label to use |
93+ ### public setSKUId(skuId): this
10694Sets the SKU id that represents a purchasable SKU for this button.
10795
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 |
11196
112- ### public setStyle(style): this
11397
98+ | Parameter | Type | Optional | Description |
99+ | ----------- | ----------- | ----------- | ----------- |
100+ | skuId | [ string] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String ) | ❌ | The SKU id to use |
101+ ### public setStyle(style): this
114102Sets the style of this button.
115103
116- | Parameter | Type | Optional | Description |
117- | --------- | ----------- | -------- | ---------------- |
118- | style | ButtonStyle | ❌ | The style to use |
119104
120- ### public setURL(url): this
121105
106+ | Parameter | Type | Optional | Description |
107+ | ----------- | ----------- | ----------- | ----------- |
108+ | style | ButtonStyle | ❌ | The style to use |
109+ ### public setURL(url): this
122110Sets the URL for this button.
123111
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 |
127112
128- ### public toJSON(): APIButtonComponent
129113
114+ | Parameter | Type | Optional | Description |
115+ | ----------- | ----------- | ----------- | ----------- |
116+ | url | [ string] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String ) | ❌ | The URL to use |
117+ ### public toJSON(): APIButtonComponent
130118ComponentBuilder.toJSON
131-
132119### public static from(other): ButtonBuilder
133-
134- | Parameter | Type | Optional |
135- | --------- | ------------------ | ---------------------------------- | --- |
136- | other | APIButtonComponent | JSONEncodable\< APIButtonComponent> | ❌ |
120+ | Parameter | Type | Optional |
121+ | ----------- | ----------- | ----------- |
122+ | other | APIButtonComponent | JSONEncodable\< APIButtonComponent> | ❌ |
0 commit comments