@@ -713,7 +713,7 @@ def _handle_embeds(self, value):
713
713
self .embeds = [Embed .from_dict (data ) for data in value ]
714
714
715
715
def _handle_components (self , value ):
716
- self .components = [DecodeMessageComponents for data in value ]
716
+ self .components = [ActionRow . from_dict ( data ) for data in value ]
717
717
718
718
def _handle_nonce (self , value ):
719
719
self .nonce = value
@@ -1153,29 +1153,29 @@ async def edit(self, **fields):
1153
1153
interaction_id = fields .pop ('__interaction_id' , None )
1154
1154
interaction_token = fields .pop ('__interaction_token' , None )
1155
1155
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 :
1160
1157
try :
1161
1158
data = await self ._state .http .edit_interaction_response (use_webhook = use_webhook ,
1162
1159
interaction_id = interaction_id ,
1163
1160
token = interaction_token ,
1164
1161
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
1169
1165
raise UnknowInteraction (application_id )
1170
1166
else :
1171
- self ._update ( dict ( data ))
1167
+ [ self .__setattr__ ( k , v ) for k , v in fields . items ()]
1172
1168
1173
1169
elif is_interaction_responce is None :
1174
1170
payload = await self ._state .http .edit_message (self .channel .id , self .id , ** fields )
1175
1171
self ._update (payload )
1176
1172
if delete_after is not None :
1177
1173
await self .delete (delay = delete_after )
1178
1174
1175
+ @property
1176
+ def dict (self ):
1177
+ return {s : self .__getattribute__ (s ) for s in self .__slots__ if not s .startswith ('_' )}
1178
+
1179
1179
async def publish (self ):
1180
1180
"""|coro|
1181
1181
@@ -1686,17 +1686,18 @@ async def edit(self, **fields):
1686
1686
interaction_id = fields .pop ('__interaction_id' , None )
1687
1687
interaction_token = fields .pop ('__interaction_token' , None )
1688
1688
application_id = fields .pop ('__application_id' , None )
1689
- payload = {'data' : fields }
1690
- if payload :
1689
+ if fields :
1691
1690
try :
1692
1691
data = await self ._state .http .edit_interaction_response (use_webhook = use_webhook ,
1693
1692
interaction_id = interaction_id ,
1694
1693
token = interaction_token ,
1695
1694
application_id = application_id ,
1696
- deffered = deffered ,
1697
- fields = payload )
1695
+ deffered = deffered , ** fields )
1698
1696
except NotFound :
1697
+ is_interaction_responce = None
1699
1698
raise UnknowInteraction (application_id )
1699
+ else :
1700
+ [self .__setattr__ (k , v ) for k , v in fields .items ()]
1700
1701
1701
1702
elif is_interaction_responce is None :
1702
1703
payload = await self ._state .http .edit_message (self .channel .id , self .id , ** fields )
0 commit comments