Skip to content

Commit 62f52b1

Browse files
committed
fix: selectoption not rendering when ephemeral message
1 parent be0fce4 commit 62f52b1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

discord_components/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ async def on_socket_response(res):
5757
if (res["t"] != "INTERACTION_CREATE") or (res["d"]["type"] != 3):
5858
return
5959

60-
if ("message_reference" in res["d"]["message"]) and (not "channel_id" in res["d"]["message"]["message_reference"]):
60+
if ("message_reference" in res["d"]["message"]) and (
61+
not "channel_id" in res["d"]["message"]["message_reference"]
62+
):
6163
res["d"]["message"]["message_reference"]["channel_id"] = res["d"]["channel_id"]
62-
64+
6365
for key, value in InteractionEventType.items():
6466
if value == res["d"]["data"]["component_type"]:
6567
self.bot.dispatch(f"raw_{key}", res["d"])
@@ -307,6 +309,10 @@ async def _get_interaction(self, json: dict):
307309
if len(data["component"]["values"]) > 0:
308310
for value in data["component"]["values"]:
309311
rescomponent.append(SelectOption.from_json({"value": value}))
312+
313+
data["component"]["options"] = list(
314+
map(lambda x: {"value": x}, data["component"]["values"])
315+
)
310316
parentcomponent = Select.from_json(data["component"])
311317

312318
ctx = Interaction(

0 commit comments

Comments
 (0)