54
54
55
55
56
56
class UnfurledMediaItem (DictSerializationMixin ):
57
- """A basic object for making media items."""
57
+ """
58
+ A basic object for making media items.
59
+
60
+ Attributes:
61
+ url str: The source url of the media.
62
+ proxy_url Optional[str]: A proxied url of the media. Only present when provided by Discord.
63
+ height Optional[int]: The height of the media. Only present when provided by Discord.
64
+ width Optional[int]: The width of the media. Only present when provided by Discord.
65
+ content_type Optional[str]: The content type of the media. Only present when provided by Discord.
66
+ loading_state Optional[UnfurledMediaItemLoadingState]: The loading state of the media.
67
+
68
+ """
58
69
59
70
url : str
60
71
proxy_url : Optional [str ] = None
@@ -569,12 +580,12 @@ class StringSelectMenu(BaseSelectMenu):
569
580
570
581
Attributes:
571
582
options List[dict]: The choices in the select, max 25.
572
- custom_id str: A developer-defined identifier for the button , max 100 characters.
583
+ custom_id str: A developer-defined identifier for the select , max 100 characters.
573
584
placeholder str: The custom placeholder text to show if nothing is selected, max 100 characters.
574
585
min_values Optional[int]: The minimum number of items that must be chosen. (default 1, min 0, max 25)
575
586
max_values Optional[int]: The maximum number of items that can be chosen. (default 1, max 25)
576
587
disabled bool: Disable the select and make it not intractable, default false.
577
- type Union[ComponentType, int]: The action role type number defined by discord. This cannot be modified.
588
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
578
589
579
590
"""
580
591
@@ -630,12 +641,13 @@ class UserSelectMenu(DefaultableSelectMenu):
630
641
Represents a user select component.
631
642
632
643
Attributes:
633
- custom_id str: A developer-defined identifier for the button, max 100 characters.
634
644
placeholder str: The custom placeholder text to show if nothing is selected, max 100 characters.
635
645
min_values Optional[int]: The minimum number of items that must be chosen. (default 1, min 0, max 25)
636
646
max_values Optional[int]: The maximum number of items that can be chosen. (default 1, max 25)
647
+ custom_id str: A developer-defined identifier for the select, max 100 characters.
648
+ default_values list[BaseUser, Member, SelectDefaultValues]: A list of default values to pre-select in the select.
637
649
disabled bool: Disable the select and make it not intractable, default false.
638
- type Union[ComponentType, int]: The action role type number defined by discord. This cannot be modified.
650
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
639
651
640
652
"""
641
653
@@ -650,8 +662,6 @@ def __init__(
650
662
list [
651
663
Union [
652
664
"interactions.models.discord.BaseUser" ,
653
- "interactions.models.discord.Role" ,
654
- "interactions.models.discord.BaseChannel" ,
655
665
"interactions.models.discord.Member" ,
656
666
SelectDefaultValues ,
657
667
],
@@ -674,15 +684,16 @@ def __init__(
674
684
675
685
class RoleSelectMenu (DefaultableSelectMenu ):
676
686
"""
677
- Represents a user select component.
687
+ Represents a role select component.
678
688
679
689
Attributes:
680
- custom_id str: A developer-defined identifier for the button, max 100 characters.
681
690
placeholder str: The custom placeholder text to show if nothing is selected, max 100 characters.
682
691
min_values Optional[int]: The minimum number of items that must be chosen. (default 1, min 0, max 25)
683
692
max_values Optional[int]: The maximum number of items that can be chosen. (default 1, max 25)
693
+ custom_id str: A developer-defined identifier for the select, max 100 characters.
694
+ default_values list[Role, SelectDefaultValues]: A list of default values to pre-select in the select.
684
695
disabled bool: Disable the select and make it not intractable, default false.
685
- type Union[ComponentType, int]: The action role type number defined by discord. This cannot be modified.
696
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
686
697
687
698
"""
688
699
@@ -697,10 +708,7 @@ def __init__(
697
708
default_values : (
698
709
list [
699
710
Union [
700
- "interactions.models.discord.BaseUser" ,
701
711
"interactions.models.discord.Role" ,
702
- "interactions.models.discord.BaseChannel" ,
703
- "interactions.models.discord.Member" ,
704
712
SelectDefaultValues ,
705
713
],
706
714
]
@@ -720,6 +728,20 @@ def __init__(
720
728
721
729
722
730
class MentionableSelectMenu (DefaultableSelectMenu ):
731
+ """
732
+ Represents a mentional select component, which includes users, roles, and channels.
733
+
734
+ Attributes:
735
+ placeholder str: The custom placeholder text to show if nothing is selected, max 100 characters.
736
+ min_values Optional[int]: The minimum number of items that must be chosen. (default 1, min 0, max 25)
737
+ max_values Optional[int]: The maximum number of items that can be chosen. (default 1, max 25)
738
+ custom_id str: A developer-defined identifier for the select, max 100 characters.
739
+ default_values list[BaseUser, Role, BaseChannel, Member, SelectDefaultValues]: A list of default values to pre-select in the select.
740
+ disabled bool: Disable the select and make it not intractable, default false.
741
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
742
+
743
+ """
744
+
723
745
def __init__ (
724
746
self ,
725
747
* ,
@@ -754,6 +776,20 @@ def __init__(
754
776
755
777
756
778
class ChannelSelectMenu (DefaultableSelectMenu ):
779
+ """
780
+ Represents a chanel select component.
781
+
782
+ Attributes:
783
+ placeholder str: The custom placeholder text to show if nothing is selected, max 100 characters.
784
+ min_values Optional[int]: The minimum number of items that must be chosen. (default 1, min 0, max 25)
785
+ max_values Optional[int]: The maximum number of items that can be chosen. (default 1, max 25)
786
+ custom_id str: A developer-defined identifier for the select, max 100 characters.
787
+ default_values list[BaseChannel, SelectDefaultValues]: A list of default values to pre-select in the select.
788
+ disabled bool: Disable the select and make it not intractable, default false.
789
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
790
+
791
+ """
792
+
757
793
def __init__ (
758
794
self ,
759
795
* ,
@@ -766,10 +802,7 @@ def __init__(
766
802
default_values : (
767
803
list [
768
804
Union [
769
- "interactions.models.discord.BaseUser" ,
770
- "interactions.models.discord.Role" ,
771
805
"interactions.models.discord.BaseChannel" ,
772
- "interactions.models.discord.Member" ,
773
806
SelectDefaultValues ,
774
807
],
775
808
]
@@ -812,6 +845,16 @@ def to_dict(self) -> discord_typings.SelectMenuComponentData:
812
845
813
846
814
847
class SectionComponent (BaseComponent ):
848
+ """
849
+ A top-level layout component that allows you to join text contextually with an accessory.
850
+
851
+ Attributes:
852
+ components list[TextDisplayComponent]: The text components to include in this section.
853
+ accessory Button | ThumbnailComponent: The accessory to include in this section.
854
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
855
+
856
+ """
857
+
815
858
components : "list[TextDisplayComponent]"
816
859
accessory : "Button | ThumbnailComponent"
817
860
@@ -840,6 +883,15 @@ def to_dict(self) -> dict:
840
883
841
884
842
885
class TextDisplayComponent (BaseComponent ):
886
+ """
887
+ A top-level content component that allows you to add text to your message.
888
+
889
+ Attributes:
890
+ content str: Text that will be displayed, similar to a message.
891
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
892
+
893
+ """
894
+
843
895
content : str
844
896
845
897
def __init__ (self , content : str ):
@@ -861,6 +913,17 @@ def to_dict(self) -> dict:
861
913
862
914
863
915
class ThumbnailComponent (BaseComponent ):
916
+ """
917
+ A content component that is a small image only usable as an accessory in a section.
918
+
919
+ Attributes:
920
+ media UnfurledMediaItem: The media item to display as a thumbnail.
921
+ description Optional[str]: An optional description to show below the thumbnail.
922
+ spoiler bool: Whether the thumbnail should be marked as a spoiler, default false.
923
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
924
+
925
+ """
926
+
864
927
media : UnfurledMediaItem
865
928
description : Optional [str ] = None
866
929
spoiler : bool = False
@@ -892,6 +955,17 @@ def to_dict(self) -> dict:
892
955
893
956
894
957
class MediaGalleryItem (DictSerializationMixin ):
958
+ """
959
+ A basic object for displaying a media attachment.
960
+
961
+ Attributes:
962
+ media UnfurledMediaItem: The media item to display in the gallery.
963
+ description Optional[str]: An optional description to show below the media.
964
+ spoiler bool: Whether the media should be marked as a spoiler, default false.
965
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
966
+
967
+ """
968
+
895
969
media : UnfurledMediaItem
896
970
description : Optional [str ] = None
897
971
spoiler : bool = False
@@ -921,6 +995,15 @@ def to_dict(self) -> dict:
921
995
922
996
923
997
class MediaGalleryComponent (BaseComponent ):
998
+ """
999
+ A top-level content component that allows you to display 1-10 media attachments in an organized gallery format.
1000
+
1001
+ Attributes:
1002
+ items list[MediaGalleryItem]: A list of media gallery items to display, max 10.
1003
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
1004
+
1005
+ """
1006
+
924
1007
items : list [MediaGalleryItem ]
925
1008
926
1009
def __init__ (self , items : list [MediaGalleryItem ] | None = None ):
@@ -942,6 +1025,16 @@ def to_dict(self) -> dict:
942
1025
943
1026
944
1027
class FileComponent (BaseComponent ):
1028
+ """
1029
+ A top-level component that allows you to display an uploaded file in a component.
1030
+
1031
+ Attributes:
1032
+ file UnfurledMediaItem: The media item to display as a file.
1033
+ spoiler bool: Whether the file should be marked as a spoiler, default false.
1034
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
1035
+
1036
+ """
1037
+
945
1038
file : UnfurledMediaItem
946
1039
spoiler : bool = False
947
1040
@@ -966,6 +1059,16 @@ def to_dict(self) -> dict:
966
1059
967
1060
968
1061
class SeparatorComponent (BaseComponent ):
1062
+ """
1063
+ A top-level layout component that adds vertical padding and visual division between other components.
1064
+
1065
+ Attributes:
1066
+ divider bool: Whether this is a divider, which adds a horizontal line, default false.
1067
+ spacing SeparatorSpacingSize | int: The amount of vertical space to add, default SeparatorSpacingSize.SMALL.
1068
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
1069
+
1070
+ """
1071
+
969
1072
divider : bool = False
970
1073
spacing : SeparatorSpacingSize = SeparatorSpacingSize .SMALL
971
1074
@@ -990,6 +1093,17 @@ def to_dict(self) -> dict:
990
1093
991
1094
992
1095
class ContainerComponent (BaseComponent ):
1096
+ """
1097
+ A top-level layout component. Containers are visually distinct from surrounding components and have an optional customizable color bar.
1098
+
1099
+ Attributes:
1100
+ components list[ActionRow | SectionComponent | TextDisplayComponent | MediaGalleryComponent | FileComponent | SeparatorComponent]: The components to include in this container.
1101
+ accent_color Optional[int]: The color of the container, as a hex value, default None.
1102
+ spoiler bool: Whether the container should be marked as a spoiler, default false.
1103
+ type Union[ComponentType, int]: The type of component, as defined by discord. This cannot be modified.
1104
+
1105
+ """
1106
+
993
1107
components : list [
994
1108
ActionRow | SectionComponent | TextDisplayComponent | MediaGalleryComponent | FileComponent | SeparatorComponent
995
1109
]
0 commit comments