Skip to content

Commit a5d5242

Browse files
committed
feat: add radio and checkbox components
1 parent 2fa6e6c commit a5d5242

6 files changed

Lines changed: 325 additions & 5 deletions

File tree

interactions/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@
377377
WebhookMixin,
378378
WebhookTypes,
379379
WebSocketOPCode,
380+
RadioGroupOption,
381+
RadioGroupComponent,
382+
CheckboxGroupOption,
383+
CheckboxGroupComponent,
384+
CheckboxComponent,
380385
)
381386
from .api import events
382387
from . import ext
@@ -469,6 +474,9 @@
469474
"ChannelMention",
470475
"ChannelSelectMenu",
471476
"ChannelType",
477+
"CheckboxComponent",
478+
"CheckboxGroupComponent",
479+
"CheckboxGroupOption",
472480
"Client",
473481
"ClientT",
474482
"ClientUser",
@@ -619,6 +627,8 @@
619627
"PollResults",
620628
"PremiumTier",
621629
"PremiumType",
630+
"RadioGroupComponent",
631+
"RadioGroupOption",
622632
"Reaction",
623633
"ReactionUsers",
624634
"Resolved",

interactions/models/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@
219219
WebhookMixin,
220220
WebhookTypes,
221221
WebSocketOPCode,
222+
RadioGroupOption,
223+
RadioGroupComponent,
224+
CheckboxGroupOption,
225+
CheckboxGroupComponent,
226+
CheckboxComponent,
222227
)
223228
from .internal import (
224229
ActiveVoiceState,
@@ -401,6 +406,9 @@
401406
"ChannelMention",
402407
"ChannelSelectMenu",
403408
"ChannelType",
409+
"CheckboxComponent",
410+
"CheckboxGroupComponent",
411+
"CheckboxGroupOption",
404412
"ClientUser",
405413
"Color",
406414
"Colour",
@@ -546,6 +554,8 @@
546554
"PollResults",
547555
"PremiumTier",
548556
"PremiumType",
557+
"RadioGroupComponent",
558+
"RadioGroupOption",
549559
"Reaction",
550560
"ReactionUsers",
551561
"Resolved",

interactions/models/discord/__init__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,20 @@
166166
process_message_payload,
167167
process_message_reference,
168168
)
169-
from .modal import InputText, Modal, ParagraphText, ShortText, TextStyles, LabelComponent, FileUploadComponent
169+
from .modal import (
170+
InputText,
171+
Modal,
172+
ParagraphText,
173+
ShortText,
174+
TextStyles,
175+
LabelComponent,
176+
FileUploadComponent,
177+
RadioGroupOption,
178+
RadioGroupComponent,
179+
CheckboxGroupOption,
180+
CheckboxGroupComponent,
181+
CheckboxComponent,
182+
)
170183
from .onboarding import Onboarding, OnboardingPrompt, OnboardingPromptOption
171184
from .poll import PollMedia, PollAnswer, PollAnswerCount, PollResults, Poll
172185
from .reaction import Reaction, ReactionUsers
@@ -240,6 +253,9 @@
240253
"ChannelMention",
241254
"ChannelSelectMenu",
242255
"ChannelType",
256+
"CheckboxComponent",
257+
"CheckboxGroupComponent",
258+
"CheckboxGroupOption",
243259
"ClientUser",
244260
"Color",
245261
"Colour",
@@ -337,6 +353,8 @@
337353
"PollResults",
338354
"PremiumTier",
339355
"PremiumType",
356+
"RadioGroupComponent",
357+
"RadioGroupOption",
340358
"Reaction",
341359
"ReactionUsers",
342360
"Role",

interactions/models/discord/enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,12 @@ class ComponentType(CursedIntEnum):
730730
"""Label component for modals"""
731731
FILE_UPLOAD = 19
732732
"""File upload component for modals"""
733+
RADIO_GROUP = 21
734+
"""Radio group component for modals"""
735+
CHECKBOX_GROUP = 22
736+
"""Checkbox group component for modals"""
737+
CHECKBOX = 23
738+
"""Checkbox component for modals"""
733739

734740
# TODO: this is hacky, is there a better way to do this?
735741
@staticmethod

0 commit comments

Comments
 (0)