Skip to content

Commit b14a15d

Browse files
committed
Merge branch 'with-response' of https://github.com/Icebluewolf/pycord into with-response
chore: Linter Fixes
2 parents 04a0f27 + 0b4aa8c commit b14a15d

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

discord/interactions.py

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
from .poll import Poll
8282
from .state import ConnectionState
8383
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
8686
from .types.interactions import InteractionMetadata as InteractionMetadataPayload
8787
from .types.interactions import MessageInteraction as MessageInteractionPayload
8888
from .ui.modal import Modal
@@ -892,8 +892,12 @@ async def pong(self) -> None:
892892
)
893893
self._responded = True
894894

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+
):
897901
# TODO: fix later to not raise?
898902
channel = self._parent.channel
899903
if channel is None:
@@ -902,8 +906,12 @@ async def _process_callback_response(self, callback_response: InteractionCallbac
902906
message = InteractionMessage(state=state, channel=channel, data=callback_response["resource"]["message"]) # type: ignore
903907
self._parent._original_response = message
904908

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+
)
907915

908916
async def send_message(
909917
self,
@@ -1041,16 +1049,18 @@ async def send_message(
10411049
adapter = async_context.get()
10421050
http = parent._state.http
10431051
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+
)
10541064
)
10551065
)
10561066
finally:
@@ -1207,16 +1217,18 @@ async def edit_message(
12071217
adapter = async_context.get()
12081218
http = parent._state.http
12091219
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+
)
12201232
)
12211233
)
12221234
finally:

discord/types/interactions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,3 @@ class InteractionCallbackResource(TypedDict):
293293
# This is not fully typed as activities are out of scope
294294
activity_instance: NotRequired[dict]
295295
message: NotRequired[Message]
296-
297-

0 commit comments

Comments
 (0)