dfx 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/DiscordREST/types.js +6 -0
  2. package/DiscordREST/types.js.map +1 -0
  3. package/DiscordWS/index.js +2 -0
  4. package/DiscordWS/index.js.map +1 -0
  5. package/README.md +3 -0
  6. package/WS/index.js +71 -0
  7. package/WS/index.js.map +1 -0
  8. package/discord-api-docs/index.js +1 -0
  9. package/mod.js.map +1 -0
  10. package/package.json +6 -1
  11. package/types.js +1563 -0
  12. package/types.js.map +1 -0
  13. package/websocket.js +11 -0
  14. package/websocket.js.map +1 -0
  15. package/.gitmodules +0 -3
  16. package/.prettierrc.json +0 -4
  17. package/discord-api-docs/.eslintrc.json +0 -10
  18. package/discord-api-docs/.gitattributes +0 -11
  19. package/discord-api-docs/.github/ISSUE_TEMPLATE/api-bug-report.yml +0 -49
  20. package/discord-api-docs/.github/ISSUE_TEMPLATE/config.yml +0 -20
  21. package/discord-api-docs/.github/ISSUE_TEMPLATE/developer-site-bug-report.yml +0 -49
  22. package/discord-api-docs/.github/ISSUE_TEMPLATE/message-components-bug-report.yml +0 -49
  23. package/discord-api-docs/.github/ISSUE_TEMPLATE/slash-command-bug-report.yml +0 -49
  24. package/discord-api-docs/.github/workflows/test.yaml +0 -45
  25. package/discord-api-docs/.prettierignore +0 -1
  26. package/discord-api-docs/.prettierrc.json +0 -15
  27. package/discord-api-docs/CODE_OF_CONDUCT.md +0 -75
  28. package/discord-api-docs/CONTRIBUTING.md +0 -16
  29. package/discord-api-docs/README.md +0 -35
  30. package/discord-api-docs/docs/Change_Log.md +0 -474
  31. package/discord-api-docs/docs/Intro.md +0 -48
  32. package/discord-api-docs/docs/Legal.md +0 -154
  33. package/discord-api-docs/docs/Policy.md +0 -81
  34. package/discord-api-docs/docs/Reference.md +0 -476
  35. package/discord-api-docs/docs/Store_Distribution_Agreement.md +0 -179
  36. package/discord-api-docs/docs/dispatch/Branches_and_Builds.md +0 -654
  37. package/discord-api-docs/docs/dispatch/Dispatch_and_You.md +0 -17
  38. package/discord-api-docs/docs/dispatch/Error_Codes.md +0 -26
  39. package/discord-api-docs/docs/dispatch/Field_Values.md +0 -48
  40. package/discord-api-docs/docs/dispatch/List_of_Commands.md +0 -315
  41. package/discord-api-docs/docs/game_and_server_management/Alpha_and_Beta_Testing.md +0 -52
  42. package/discord-api-docs/docs/game_and_server_management/How_to_Get_Your_Game_on_Discord.md +0 -110
  43. package/discord-api-docs/docs/game_and_server_management/Special_Channels.md +0 -38
  44. package/discord-api-docs/docs/game_sdk/Achievements.md +0 -405
  45. package/discord-api-docs/docs/game_sdk/Activities.md +0 -561
  46. package/discord-api-docs/docs/game_sdk/Applications.md +0 -237
  47. package/discord-api-docs/docs/game_sdk/Discord.md +0 -443
  48. package/discord-api-docs/docs/game_sdk/Discord_Voice.md +0 -289
  49. package/discord-api-docs/docs/game_sdk/Images.md +0 -196
  50. package/discord-api-docs/docs/game_sdk/Lobbies.md +0 -1639
  51. package/discord-api-docs/docs/game_sdk/Networking.md +0 -377
  52. package/discord-api-docs/docs/game_sdk/Overlay.md +0 -195
  53. package/discord-api-docs/docs/game_sdk/Relationships.md +0 -234
  54. package/discord-api-docs/docs/game_sdk/SDK_Starter_Guide.md +0 -310
  55. package/discord-api-docs/docs/game_sdk/Storage.md +0 -312
  56. package/discord-api-docs/docs/game_sdk/Store.md +0 -555
  57. package/discord-api-docs/docs/game_sdk/Users.md +0 -178
  58. package/discord-api-docs/docs/interactions/Application_Commands.md +0 -1069
  59. package/discord-api-docs/docs/interactions/Message_Components.md +0 -454
  60. package/discord-api-docs/docs/interactions/Receiving_and_Responding.md +0 -372
  61. package/discord-api-docs/docs/interactions/Slash_Commands.md +0 -3
  62. package/discord-api-docs/docs/resources/Application.md +0 -82
  63. package/discord-api-docs/docs/resources/Audit_Log.md +0 -223
  64. package/discord-api-docs/docs/resources/Channel.md +0 -1267
  65. package/discord-api-docs/docs/resources/Emoji.md +0 -122
  66. package/discord-api-docs/docs/resources/Guild.md +0 -1157
  67. package/discord-api-docs/docs/resources/Guild_Scheduled_Event.md +0 -273
  68. package/discord-api-docs/docs/resources/Guild_Template.md +0 -148
  69. package/discord-api-docs/docs/resources/Invite.md +0 -150
  70. package/discord-api-docs/docs/resources/Stage_Instance.md +0 -106
  71. package/discord-api-docs/docs/resources/Sticker.md +0 -164
  72. package/discord-api-docs/docs/resources/User.md +0 -205
  73. package/discord-api-docs/docs/resources/Voice.md +0 -55
  74. package/discord-api-docs/docs/resources/Webhook.md +0 -281
  75. package/discord-api-docs/docs/rich_presence/Best_Practices.md +0 -88
  76. package/discord-api-docs/docs/rich_presence/FAQ.md +0 -45
  77. package/discord-api-docs/docs/rich_presence/How_To.md +0 -302
  78. package/discord-api-docs/docs/rich_presence/Launch_Checklist.md +0 -46
  79. package/discord-api-docs/docs/topics/Certified_Devices.md +0 -200
  80. package/discord-api-docs/docs/topics/Community_Resources.md +0 -98
  81. package/discord-api-docs/docs/topics/Gateway.md +0 -1600
  82. package/discord-api-docs/docs/topics/OAuth2.md +0 -427
  83. package/discord-api-docs/docs/topics/Opcodes_and_Status_Codes.md +0 -306
  84. package/discord-api-docs/docs/topics/Permissions.md +0 -229
  85. package/discord-api-docs/docs/topics/RPC.md +0 -1597
  86. package/discord-api-docs/docs/topics/Rate_Limits.md +0 -126
  87. package/discord-api-docs/docs/topics/Teams.md +0 -80
  88. package/discord-api-docs/docs/topics/Threads.md +0 -163
  89. package/discord-api-docs/docs/topics/Voice_Connections.md +0 -282
  90. package/discord-api-docs/images/API_center.gif +0 -0
  91. package/discord-api-docs/images/ask-to-join.gif +0 -0
  92. package/discord-api-docs/images/available-published.png +0 -0
  93. package/discord-api-docs/images/button-styles.png +0 -0
  94. package/discord-api-docs/images/certified-device.png +0 -0
  95. package/discord-api-docs/images/command-with-groups-subcommands-parameters.png +0 -0
  96. package/discord-api-docs/images/command-with-groups-subcommands.png +0 -0
  97. package/discord-api-docs/images/command.png +0 -0
  98. package/discord-api-docs/images/cpp-files-sdk.png +0 -0
  99. package/discord-api-docs/images/create-store-channel.png +0 -0
  100. package/discord-api-docs/images/deferred-example.png +0 -0
  101. package/discord-api-docs/images/desktop-select.png +0 -0
  102. package/discord-api-docs/images/game-overlay-sdk-invite.gif +0 -0
  103. package/discord-api-docs/images/game-overlay-sdk-voice-settings.png +0 -0
  104. package/discord-api-docs/images/game-overlay-sdk-voice-widget.png +0 -0
  105. package/discord-api-docs/images/gift-code-creation.png +0 -0
  106. package/discord-api-docs/images/lib-linked-sdk.png +0 -0
  107. package/discord-api-docs/images/message-command.png +0 -0
  108. package/discord-api-docs/images/mobile-select.png +0 -0
  109. package/discord-api-docs/images/previous-new-server-background.png +0 -0
  110. package/discord-api-docs/images/rp-actionable.png +0 -0
  111. package/discord-api-docs/images/rp-all-fields.png +0 -0
  112. package/discord-api-docs/images/rp-bad-art.png +0 -0
  113. package/discord-api-docs/images/rp-good-art.png +0 -0
  114. package/discord-api-docs/images/rp-legend.png +0 -0
  115. package/discord-api-docs/images/rp-long-strings.png +0 -0
  116. package/discord-api-docs/images/rp-non-actionable.png +0 -0
  117. package/discord-api-docs/images/rp-not-all-fields.png +0 -0
  118. package/discord-api-docs/images/rp-profile-example-1.png +0 -0
  119. package/discord-api-docs/images/rp-profile-example-2.png +0 -0
  120. package/discord-api-docs/images/rp-short-strings.png +0 -0
  121. package/discord-api-docs/images/server-banner-example.png +0 -0
  122. package/discord-api-docs/images/server-banner-margin-top.png +0 -0
  123. package/discord-api-docs/images/sku-management.png +0 -0
  124. package/discord-api-docs/images/snowflake.png +0 -0
  125. package/discord-api-docs/images/snowflake_original_size.png +0 -0
  126. package/discord-api-docs/images/spectate.gif +0 -0
  127. package/discord-api-docs/images/team-2fa.png +0 -0
  128. package/discord-api-docs/images/team-make-app.png +0 -0
  129. package/discord-api-docs/images/team-page.png +0 -0
  130. package/discord-api-docs/images/transfer-app-to-team.png +0 -0
  131. package/discord-api-docs/images/user-command.png +0 -0
  132. package/discord-api-docs/package-lock.json +0 -3186
  133. package/discord-api-docs/package.json +0 -38
  134. package/discord-api-docs/tsconfig.eslint.json +0 -4
  135. package/discord-api-docs/tsconfig.json +0 -19
  136. package/tsconfig.json +0 -24
@@ -1,454 +0,0 @@
1
- # Message Components
2
-
3
- Message components—we'll call them "components" moving forward—are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use.
4
-
5
- There are several different types of components; this documentation will outline the basics of this new framework and each example.
6
-
7
- ## What is a Component
8
-
9
- Components are a new field on the [message object](#DOCS_RESOURCES_CHANNEL/message-object), so you can use them whether you're sending messages or responding to a [slash command](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/) or other interaction.
10
-
11
- The top-level `components` field is an array of [Action Row](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/action-rows) components.
12
-
13
- ### Component Object
14
-
15
- ###### Component Types
16
-
17
- | Type | Name | Description |
18
- | ---- | ----------- | -------------------------------------- |
19
- | 1 | Action Row | A container for other components |
20
- | 2 | Button | A button object |
21
- | 3 | Select Menu | A select menu for picking from choices |
22
- | 4 | Text Input | A text input object |
23
-
24
- The structure of each component type is described in detail below.
25
-
26
- ###### Example Component
27
-
28
- ```json
29
- {
30
- "content": "This is a message with components",
31
- "components": [
32
- {
33
- "type": 1,
34
- "components": []
35
- }
36
- ]
37
- }
38
- ```
39
-
40
- ## Action Rows
41
-
42
- An Action Row is a non-interactive container component for other types of components. It has a `type: 1` and a sub-array of `components` of other types.
43
-
44
- - You can have up to 5 Action Rows per message
45
- - An Action Row cannot contain another Action Row
46
-
47
- ```json
48
- {
49
- "content": "This is a message with components",
50
- "components": [
51
- {
52
- "type": 1,
53
- "components": [
54
- {
55
- "type": 2,
56
- "label": "Click me!",
57
- "style": 1,
58
- "custom_id": "click_one"
59
- }
60
- ]
61
-
62
- }
63
- ]
64
- }
65
- ```
66
-
67
- ## Responding to a Component Interaction
68
-
69
- Responding to a user interacting with a component is the same as other interaction types, like application commands. You can simply ACK the request, send a followup message, or edit the original message to something new. Check out [Responding to An Interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/responding-to-an-interaction) and [interaction response](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-response-object) for more.
70
-
71
- ## Custom ID
72
-
73
- Components, aside from Action Rows, must have a `custom_id` field. This field is defined by the developer when sending the component payload, and is returned in the interaction payload sent when a user interacts with the component. For example, if you set `custom_id: click_me` on a button, you'll receive an interaction containing `custom_id: click_me` when a user clicks that button.
74
-
75
- `custom_id` must be unique per component; multiple buttons on the same message must not share the same `custom_id`. This field is a string of max 100 characters, and can be used flexibly to maintain state or pass through other important data.
76
-
77
- ## Buttons
78
-
79
- Buttons are interactive components that render on messages. They can be clicked by users, and send an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object) to your app when clicked.
80
-
81
- - Buttons must be sent inside an Action Row
82
- - An Action Row can contain up to 5 buttons
83
- - An Action Row containing buttons cannot also contain a select menu
84
-
85
- ### Button Object
86
-
87
- ###### Button Structure
88
-
89
- | Field | Type | Description |
90
- | ---------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------- |
91
- | type | integer | `2` for a button |
92
- | style | integer | one of [button styles](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) |
93
- | label? | string | text that appears on the button, max 80 characters |
94
- | emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) | `name`, `id`, and `animated` |
95
- | custom_id? | string | a developer-defined identifier for the button, max 100 characters |
96
- | url? | string | a url for link-style buttons |
97
- | disabled? | boolean | whether the button is disabled (default `false`) |
98
-
99
- Buttons come in a variety of styles to convey different types of actions. These styles also define what fields are valid for a button.
100
-
101
- - Non-link buttons **must** have a `custom_id`, and cannot have a `url`
102
- - Link buttons **must** have a `url`, and cannot have a `custom_id`
103
- - Link buttons do not send an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object) to your app when clicked
104
-
105
- ###### Button Styles
106
-
107
- | Name | Value | Color | Required Field |
108
- | --------- | ----- | ------------------------ | -------------- |
109
- | Primary | 1 | blurple | `custom_id` |
110
- | Secondary | 2 | grey | `custom_id` |
111
- | Success | 3 | green | `custom_id` |
112
- | Danger | 4 | red | `custom_id` |
113
- | Link | 5 | grey, navigates to a URL | `url` |
114
-
115
- ![An image showing the different button styles](button-styles.png)
116
-
117
- When a user clicks on a button, your app will receive an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object) including the message the button was on:
118
-
119
- ### Component Interaction Object
120
-
121
- ###### Sample Component Interaction
122
-
123
- ```json
124
- {
125
- "version": 1,
126
- "type": 3,
127
- "token": "unique_interaction_token",
128
- "message": {
129
- "type": 0,
130
- "tts": false,
131
- "timestamp": "2021-05-19T02:12:51.710000+00:00",
132
- "pinned": false,
133
- "mentions": [],
134
- "mention_roles": [],
135
- "mention_everyone": false,
136
- "id": "844397162624450620",
137
- "flags": 0,
138
- "embeds": [],
139
- "edited_timestamp": null,
140
- "content": "This is a message with components.",
141
- "components": [
142
- {
143
- "type": 1,
144
- "components": [
145
- {
146
- "type": 2,
147
- "label": "Click me!",
148
- "style": 1,
149
- "custom_id": "click_one"
150
- }
151
- ]
152
- }
153
- ],
154
- "channel_id": "345626669114982402",
155
- "author": {
156
- "username": "Mason",
157
- "public_flags": 131141,
158
- "id": "53908232506183680",
159
- "discriminator": "1337",
160
- "avatar": "a_d5efa99b3eeaa7dd43acca82f5692432"
161
- },
162
- "attachments": []
163
- },
164
- "member": {
165
- "user": {
166
- "username": "Mason",
167
- "public_flags": 131141,
168
- "id": "53908232506183680",
169
- "discriminator": "1337",
170
- "avatar": "a_d5efa99b3eeaa7dd43acca82f5692432"
171
- },
172
- "roles": [
173
- "290926798626357999"
174
- ],
175
- "premium_since": null,
176
- "permissions": "17179869183",
177
- "pending": false,
178
- "nick": null,
179
- "mute": false,
180
- "joined_at": "2017-03-13T19:19:14.040000+00:00",
181
- "is_pending": false,
182
- "deaf": false,
183
- "avatar": null
184
- },
185
- "id": "846462639134605312",
186
- "guild_id": "290926798626357999",
187
- "data": {
188
- "custom_id": "click_one",
189
- "component_type": 2
190
- },
191
- "channel_id": "345626669114982999",
192
- "application_id": "290926444748734465"
193
- }
194
- ```
195
-
196
- ## Select Menus
197
-
198
- Select menus are another interactive component that renders on messages. On desktop, clicking on a select menu opens a dropdown-style UI; on mobile, tapping a select menu opens up a half-sheet with the options.
199
-
200
- ![A select menu open on desktop](desktop-select.png)
201
-
202
- Select menus support single-select and multi-select behavior, meaning you can prompt a user to choose just one item from a list, or multiple. When a user finishes making their choice by clicking out of the dropdown or closing the half-sheet, your app will receive an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-structure).
203
-
204
- - Select menus must be sent inside an Action Row
205
- - An Action Row can contain only one select menu
206
- - An Action Row containing a select menu cannot also contain buttons
207
-
208
- ###### Select Menu Example
209
-
210
- ```json
211
- // This is a message
212
- {
213
- "content": "Mason is looking for new arena partners. What classes do you play?",
214
- "components": [
215
- {
216
- "type": 1,
217
- "components": [
218
- {
219
- "type": 3,
220
- "custom_id": "class_select_1",
221
- "options":[
222
- {
223
- "label": "Rogue",
224
- "value": "rogue",
225
- "description": "Sneak n stab",
226
- "emoji": {
227
- "name": "rogue",
228
- "id": "625891304148303894"
229
- }
230
- },
231
- {
232
- "label": "Mage",
233
- "value": "mage",
234
- "description": "Turn 'em into a sheep",
235
- "emoji": {
236
- "name": "mage",
237
- "id": "625891304081063986"
238
- }
239
- },
240
- {
241
- "label": "Priest",
242
- "value": "priest",
243
- "description": "You get heals when I'm done doing damage",
244
- "emoji": {
245
- "name": "priest",
246
- "id": "625891303795982337"
247
- }
248
- }
249
- ],
250
- "placeholder": "Choose a class",
251
- "min_values": 1,
252
- "max_values": 3
253
- }
254
- ]
255
- }
256
- ]
257
- }
258
- ```
259
-
260
- ### Select Menu Object
261
-
262
- ###### Select Menu Structure
263
-
264
- | Field | Type | Description |
265
- | ------------ | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
266
- | type | integer | `3` for a select menu |
267
- | custom_id | string | a developer-defined identifier for the button, max 100 characters |
268
- | options | array of [select options](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-option-structure) | the choices in the select, max 25 |
269
- | placeholder? | string | custom placeholder text if nothing is selected, max 150 characters |
270
- | min_values? | integer | the minimum number of items that must be chosen; default 1, min 0, max 25 |
271
- | max_values? | integer | the maximum number of items that can be chosen; default 1, max 25 |
272
- | disabled? | boolean | disable the select, default false |
273
-
274
- ###### Select Option Structure
275
-
276
- | Field | Type | Description |
277
- | ------------ | ---------------------------------------------------------- | ----------------------------------------------------------- |
278
- | label | string | the user-facing name of the option, max 100 characters |
279
- | value | string | the dev-define value of the option, max 100 characters |
280
- | description? | string | an additional description of the option, max 100 characters |
281
- | emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) object | `id`, `name`, and `animated` |
282
- | default? | boolean | will render this option as selected by default |
283
-
284
- ###### Select Menu Interaction
285
-
286
- ```json
287
- {
288
- "application_id": "845027738276462632",
289
- "channel_id": "772908445358620702",
290
- "data": {
291
- "component_type":3,
292
- "custom_id": "class_select_1",
293
- "values": [
294
- "mage",
295
- "rogue"
296
- ]
297
- },
298
- "guild_id": "772904309264089089",
299
- "id": "847587388497854464",
300
- "member": {
301
- "avatar": null,
302
- "deaf": false,
303
- "is_pending": false,
304
- "joined_at": "2020-11-02T19:25:47.248000+00:00",
305
- "mute": false,
306
- "nick": "Bot Man",
307
- "pending": false,
308
- "permissions": "17179869183",
309
- "premium_since": null,
310
- "roles": [
311
- "785609923542777878"
312
- ],
313
- "user":{
314
- "avatar": "a_d5efa99b3eeaa7dd43acca82f5692432",
315
- "discriminator": "1337",
316
- "id": "53908232506183680",
317
- "public_flags": 131141,
318
- "username": "Mason"
319
- }
320
- },
321
- "message":{
322
- "application_id": "845027738276462632",
323
- "attachments": [],
324
- "author": {
325
- "avatar": null,
326
- "bot": true,
327
- "discriminator": "5284",
328
- "id": "845027738276462632",
329
- "public_flags": 0,
330
- "username": "Interactions Test"
331
- },
332
- "channel_id": "772908445358620702",
333
- "components": [
334
- {
335
- "components": [
336
- {
337
- "custom_id": "class_select_1",
338
- "max_values": 1,
339
- "min_values": 1,
340
- "options": [
341
- {
342
- "description": "Sneak n stab",
343
- "emoji":{
344
- "id": "625891304148303894",
345
- "name": "rogue"
346
- },
347
- "label": "Rogue",
348
- "value": "rogue"
349
- },
350
- {
351
- "description": "Turn 'em into a sheep",
352
- "emoji":{
353
- "id": "625891304081063986",
354
- "name": "mage"
355
- },
356
- "label": "Mage",
357
- "value": "mage"
358
- },
359
- {
360
- "description": "You get heals when I'm done doing damage",
361
- "emoji":{
362
- "id": "625891303795982337",
363
- "name": "priest"
364
- },
365
- "label": "Priest",
366
- "value": "priest"
367
- }
368
- ],
369
- "placeholder": "Choose a class",
370
- "type": 3
371
- }
372
- ],
373
- "type": 1
374
- }
375
- ],
376
- "content": "Mason is looking for new arena partners. What classes do you play?",
377
- "edited_timestamp": null,
378
- "embeds": [],
379
- "flags": 0,
380
- "id": "847587334500646933",
381
- "interaction": {
382
- "id": "847587333942935632",
383
- "name": "dropdown",
384
- "type": 2,
385
- "user": {
386
- "avatar": "a_d5efa99b3eeaa7dd43acca82f5692432",
387
- "discriminator": "1337",
388
- "id": "53908232506183680",
389
- "public_flags": 131141,
390
- "username": "Mason"
391
- }
392
- },
393
- "mention_everyone": false,
394
- "mention_roles":[],
395
- "mentions":[],
396
- "pinned": false,
397
- "timestamp": "2021-05-27T21:29:27.956000+00:00",
398
- "tts": false,
399
- "type": 20,
400
- "webhook_id": "845027738276462632"
401
- },
402
- "token": "UNIQUE_TOKEN",
403
- "type": 3,
404
- "version": 1
405
- }
406
- ```
407
-
408
- ## Text Inputs
409
-
410
- Text inputs are an interactive component that render on modals. They can be used to collect short-form or long-form text.
411
-
412
- ###### Text Input Example
413
-
414
- ```json
415
- // this is a modal
416
- {
417
- "title": "My Cool Modal",
418
- "custom_id": "cool_modal",
419
- "components": [{
420
- "type": 1,
421
- "components": [{
422
- "type": 4,
423
- "custom_id": "name",
424
- "label": "Name",
425
- "style": 1,
426
- "min_length": 1,
427
- "max_length": 4000,
428
- "placeholder": "John",
429
- "required": true
430
- }]
431
- }]
432
- }
433
- ```
434
-
435
- ###### Text Input Structure
436
-
437
- | Field | Type | Description |
438
- | ------------ | ------- | ------------------------------------------------------------------------------------------- |
439
- | type | integer | `4` for a text input |
440
- | custom_id | string | a developer-defined identifier for the input, max 100 characters |
441
- | style | integer | the [Text Input Style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/text-inputs-text-input-styles) |
442
- | label | string | the label for this component |
443
- | min_length? | integer | the minimum input length for a text input, min 0, max 4000 |
444
- | max_length? | integer | the maximum input length for a text input, min 1, max 4000 |
445
- | required? | boolean | whether this component is required to be filled, default true |
446
- | value? | string | a pre-filled value for this component, max 4000 characters |
447
- | placeholder? | string | custom placeholder text if the input is empty, max 100 characters |
448
-
449
- ###### Text Input Styles
450
-
451
- | Name | Value | Description |
452
- | --------- | ----- | ------------------- |
453
- | Short | 1 | A single-line input |
454
- | Paragraph | 2 | A multi-line input |