1- from typing import Dict , List , Optional , Union
1+ from typing import Dict , List , Optional
22
33from ..api .models .channel import Channel
44from ..api .models .member import Member
55from ..api .models .message import Message
66from ..api .models .misc import DictSerializerMixin , Snowflake
77from ..api .models .role import Role
88from ..api .models .user import User
9- from ..enums import ApplicationCommandType , InteractionType
9+ from ..enums import ApplicationCommandType , ComponentType , InteractionType
1010from ..models .command import Option
11- from ..models .component import Component , SelectOption
11+ from ..models .component import SelectOption
1212
1313
1414class InteractionResolvedData (DictSerializerMixin ):
@@ -67,21 +67,21 @@ class InteractionData(DictSerializerMixin):
6767 :ivar str name: The name of the interaction.
6868 :ivar ApplicationCommandType type: The type of command from the interaction.
6969 :ivar Optional[InteractionResolvedData] resolved?: The resolved version of the data.
70- :ivar Optional[Union[ Option, List[Option] ]] options?: The options of the interaction.
70+ :ivar Optional[Option, List[Option]] options?: The options of the interaction.
7171 :ivar Optional[str] custom_id?: The custom ID of the interaction.
72- :ivar Optional[int ] component_type?: The type of component from the interaction.
73- :ivar Optional[Union[SelectOption, List[SelectOption] ]] values?: The values of the selected options in the interaction.
72+ :ivar Optional[ComponentType ] component_type?: The type of component from the interaction.
73+ :ivar Optional[List[SelectOption]] values?: The values of the selected options in the interaction.
7474 :ivar Optional[str] target_id?: The targeted ID of the interaction.
7575 """
7676
7777 id : Snowflake
7878 name : str
7979 type : ApplicationCommandType
8080 resolved : Optional [InteractionResolvedData ]
81- options : Optional [Union [ Option , List [Option ] ]]
81+ options : Optional [List [Option ]]
8282 custom_id : Optional [str ]
83- component_type : Optional [int ]
84- values : Optional [Union [ SelectOption , List [SelectOption ] ]]
83+ component_type : Optional [ComponentType ]
84+ values : Optional [List [SelectOption ]]
8585 target_id : Optional [Snowflake ]
8686
8787 __slots__ = (
@@ -106,11 +106,14 @@ def __init__(self, **kwargs):
106106 )
107107 self .id = Snowflake (self .id ) if self ._json .get ("id" ) else None
108108 self .target_id = Snowflake (self .target_id ) if self ._json .get ("target_id" ) else None
109- self .components = (
110- [Component (** component ) for component in self .components ]
111- if self ._json .get ("components" )
112- else None
109+ self .options = (
110+ [Option (** option ) for option in self .options ] if self ._json .get ("options" ) else None
113111 )
112+ self .component_type = ComponentType (self .component_type )
113+ self .values = (
114+ [SelectOption (** value ) for value in self .values ] if self ._json .get ("values" ) else None
115+ )
116+ self ._json .update ({"component_type" : self .component_type .value })
114117
115118
116119class Interaction (DictSerializerMixin ):
0 commit comments