You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/reference/components-v2.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,11 @@ description = "Be fancier, use components!"
6
6
7
7
## componentBuilder
8
8
9
-
`componentBuilder` is a helper for building Discord’s new Components V2 (sections, buttons, menus, galleries, etc.) in YAGPDB custom commands.
9
+
`componentBuilder` is a helper for building Discord’s new Components V2 (sections, buttons, menus, galleries, etc.)
10
10
11
-
It provides a simple template-based way to assemble complex message layouts without needing to write raw JSON. Instead, you describe components with key–value pairs (sdict, strings, arrays), and `componentBuilder` handles conversion and validation for you.
11
+
It provides a simple template-based way to assemble complex message layouts without needing to write raw JSON.
12
+
13
+
You describe components with key–value pairs and `componentBuilder` handles conversion and validation for you.
12
14
13
15
This makes it easier to:
14
16
@@ -319,15 +321,17 @@ This example combines text, sections, gallery, files, buttons, menus, and contai
319
321
320
322
## Component Builder Helper Functions
321
323
322
-
The `componentBuilder` helper function provides methods to construct, manipulate, and get Discord V2 message components programmatically. These methods allow you to build complex layouts incrementally and retrieve them in a format that Discord understands.
324
+
The helper function provides methods to construct, manipulate, and get Discord V2 message components programmatically.
325
+
326
+
These methods allow you to build complex layouts incrementally and retrieve them in a format that Discord understands.
323
327
324
328
### componentBuilder.Add
325
329
326
330
Adds a single component entry to the builder under the given key.
327
331
328
332
- Parameters:
329
-
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
330
-
-`value` – The component data (string, sdict, Button, SelectMenu, etc.).
333
+
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
334
+
-`value` – The component data (string, sdict, Button, SelectMenu, etc.).
331
335
332
336
- Example:
333
337
@@ -341,12 +345,12 @@ Adds a single component entry to the builder under the given key.
341
345
```
342
346
343
347
### componentBuilder.AddSlice
344
-
A
345
-
dds multiple components under one key.
348
+
349
+
Adds multiple components under one key.
346
350
347
351
- Parameters:
348
-
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
349
-
-`values` – The component data (string, sdict, Button, SelectMenu, etc.).
352
+
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
353
+
-`values` – The component data (string, sdict, Button, SelectMenu, etc.).
350
354
351
355
- Example:
352
356
@@ -368,7 +372,7 @@ dds multiple components under one key.
368
372
Combine another builder into the current one.
369
373
370
374
- Parameters:
371
-
-`other` – The builder to merge.
375
+
-`other` – The builder to merge.
372
376
373
377
- Example:
374
378
@@ -395,7 +399,7 @@ Combine another builder into the current one.
395
399
Retrieve components stored under a key.
396
400
397
401
- Parameters:
398
-
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
402
+
-`key` – The top-level key for the component (e.g., "text", "section", "buttons").
0 commit comments