@@ -713,7 +713,7 @@ def _handle_embeds(self, value):
713713 self .embeds = [Embed .from_dict (data ) for data in value ]
714714
715715 def _handle_components (self , value ):
716- self .components = [DecodeMessageComponents for data in value ]
716+ self .components = [ActionRow . from_dict ( data ) for data in value ]
717717
718718 def _handle_nonce (self , value ):
719719 self .nonce = value
@@ -1153,29 +1153,29 @@ async def edit(self, **fields):
11531153 interaction_id = fields .pop ('__interaction_id' , None )
11541154 interaction_token = fields .pop ('__interaction_token' , None )
11551155 application_id = fields .pop ('__application_id' , None )
1156- payload = {'data' : fields }
1157- if not deffered :
1158- payload ['type' ] = 7
1159- if payload :
1156+ if fields :
11601157 try :
11611158 data = await self ._state .http .edit_interaction_response (use_webhook = use_webhook ,
11621159 interaction_id = interaction_id ,
11631160 token = interaction_token ,
11641161 application_id = application_id ,
1165- deffered = deffered ,
1166- fields = payload )
1167- except Exception as exc :
1168- print (exc )
1162+ deffered = deffered ,** fields )
1163+ except NotFound :
1164+ is_interaction_responce = None
11691165 raise UnknowInteraction (application_id )
11701166 else :
1171- self ._update ( dict ( data ))
1167+ [ self .__setattr__ ( k , v ) for k , v in fields . items ()]
11721168
11731169 elif is_interaction_responce is None :
11741170 payload = await self ._state .http .edit_message (self .channel .id , self .id , ** fields )
11751171 self ._update (payload )
11761172 if delete_after is not None :
11771173 await self .delete (delay = delete_after )
11781174
1175+ @property
1176+ def dict (self ):
1177+ return {s : self .__getattribute__ (s ) for s in self .__slots__ if not s .startswith ('_' )}
1178+
11791179 async def publish (self ):
11801180 """|coro|
11811181
@@ -1686,17 +1686,18 @@ async def edit(self, **fields):
16861686 interaction_id = fields .pop ('__interaction_id' , None )
16871687 interaction_token = fields .pop ('__interaction_token' , None )
16881688 application_id = fields .pop ('__application_id' , None )
1689- payload = {'data' : fields }
1690- if payload :
1689+ if fields :
16911690 try :
16921691 data = await self ._state .http .edit_interaction_response (use_webhook = use_webhook ,
16931692 interaction_id = interaction_id ,
16941693 token = interaction_token ,
16951694 application_id = application_id ,
1696- deffered = deffered ,
1697- fields = payload )
1695+ deffered = deffered , ** fields )
16981696 except NotFound :
1697+ is_interaction_responce = None
16991698 raise UnknowInteraction (application_id )
1699+ else :
1700+ [self .__setattr__ (k , v ) for k , v in fields .items ()]
17001701
17011702 elif is_interaction_responce is None :
17021703 payload = await self ._state .http .edit_message (self .channel .id , self .id , ** fields )
0 commit comments