81
81
from .poll import Poll
82
82
from .state import ConnectionState
83
83
from .threads import Thread
84
- from .types .interactions import Interaction as InteractionPayload , InteractionCallbackResponse
85
- from .types .interactions import InteractionData
84
+ from .types .interactions import Interaction as InteractionPayload
85
+ from .types .interactions import InteractionCallbackResponse , InteractionData
86
86
from .types .interactions import InteractionMetadata as InteractionMetadataPayload
87
87
from .types .interactions import MessageInteraction as MessageInteractionPayload
88
88
from .ui .modal import Modal
@@ -892,8 +892,12 @@ async def pong(self) -> None:
892
892
)
893
893
self ._responded = True
894
894
895
- async def _process_callback_response (self , callback_response : InteractionCallbackResponse ):
896
- if callback_response .get ("resource" ) and callback_response ["resource" ].get ("message" ):
895
+ async def _process_callback_response (
896
+ self , callback_response : InteractionCallbackResponse
897
+ ):
898
+ if callback_response .get ("resource" ) and callback_response ["resource" ].get (
899
+ "message"
900
+ ):
897
901
# TODO: fix later to not raise?
898
902
channel = self ._parent .channel
899
903
if channel is None :
@@ -902,8 +906,12 @@ async def _process_callback_response(self, callback_response: InteractionCallbac
902
906
message = InteractionMessage (state = state , channel = channel , data = callback_response ["resource" ]["message" ]) # type: ignore
903
907
self ._parent ._original_response = message
904
908
905
- self ._parent ._response_message_ephemeral = callback_response ["interaction" ].get ("response_message_ephemeral" , False )
906
- self ._parent ._response_message_loading = callback_response ["interaction" ].get ("response_message_loading" , False )
909
+ self ._parent ._response_message_ephemeral = callback_response ["interaction" ].get (
910
+ "response_message_ephemeral" , False
911
+ )
912
+ self ._parent ._response_message_loading = callback_response ["interaction" ].get (
913
+ "response_message_loading" , False
914
+ )
907
915
908
916
async def send_message (
909
917
self ,
@@ -1041,16 +1049,18 @@ async def send_message(
1041
1049
adapter = async_context .get ()
1042
1050
http = parent ._state .http
1043
1051
try :
1044
- callback_response : InteractionCallbackResponse = await self ._locked_response (
1045
- adapter .create_interaction_response (
1046
- parent .id ,
1047
- parent .token ,
1048
- session = parent ._session ,
1049
- type = InteractionResponseType .channel_message .value ,
1050
- proxy = http .proxy ,
1051
- proxy_auth = http .proxy_auth ,
1052
- data = payload ,
1053
- files = files ,
1052
+ callback_response : InteractionCallbackResponse = (
1053
+ await self ._locked_response (
1054
+ adapter .create_interaction_response (
1055
+ parent .id ,
1056
+ parent .token ,
1057
+ session = parent ._session ,
1058
+ type = InteractionResponseType .channel_message .value ,
1059
+ proxy = http .proxy ,
1060
+ proxy_auth = http .proxy_auth ,
1061
+ data = payload ,
1062
+ files = files ,
1063
+ )
1054
1064
)
1055
1065
)
1056
1066
finally :
@@ -1207,16 +1217,18 @@ async def edit_message(
1207
1217
adapter = async_context .get ()
1208
1218
http = parent ._state .http
1209
1219
try :
1210
- callback_response : InteractionCallbackResponse = await self ._locked_response (
1211
- adapter .create_interaction_response (
1212
- parent .id ,
1213
- parent .token ,
1214
- session = parent ._session ,
1215
- type = InteractionResponseType .message_update .value ,
1216
- proxy = http .proxy ,
1217
- proxy_auth = http .proxy_auth ,
1218
- data = payload ,
1219
- files = files ,
1220
+ callback_response : InteractionCallbackResponse = (
1221
+ await self ._locked_response (
1222
+ adapter .create_interaction_response (
1223
+ parent .id ,
1224
+ parent .token ,
1225
+ session = parent ._session ,
1226
+ type = InteractionResponseType .message_update .value ,
1227
+ proxy = http .proxy ,
1228
+ proxy_auth = http .proxy_auth ,
1229
+ data = payload ,
1230
+ files = files ,
1231
+ )
1220
1232
)
1221
1233
)
1222
1234
finally :
0 commit comments