Skip to content

Commit f0336ef

Browse files
committed
It's almost done.
1 parent 1bc941a commit f0336ef

File tree

2 files changed

+17
-39
lines changed

2 files changed

+17
-39
lines changed

discord_slash/client.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,10 +1381,12 @@ async def on_socket_response(self, msg):
13811381

13821382
to_use = msg["d"]
13831383
interaction_type = to_use["type"]
1384-
if interaction_type in (1, 2):
1384+
if interaction_type == 1:
13851385
return await self._on_slash(to_use)
1386-
if interaction_type == 3:
1387-
return await self._on_component(to_use)
1386+
if interaction_type in (2, 3):
1387+
return await self._on_context_menu(to_use)
1388+
# if interaction_type == 3:
1389+
# return await self._on_component(to_use)
13881390

13891391
raise NotImplementedError
13901392

@@ -1469,26 +1471,9 @@ async def _on_context_menu(self, to_use):
14691471
if "value" not in x:
14701472
return await self.handle_subcommand(ctx, to_use)
14711473

1472-
# This is to temporarily fix Issue #97, that on Android device
1473-
# does not give option type from API.
1474-
temporary_auto_convert = {}
1475-
for x in selected_cmd.options:
1476-
temporary_auto_convert[x["name"].lower()] = x["type"]
1477-
1478-
args = (
1479-
await self.process_options(
1480-
ctx.guild,
1481-
to_use["data"]["options"],
1482-
selected_cmd.connector,
1483-
temporary_auto_convert,
1484-
)
1485-
if "options" in to_use["data"]
1486-
else {}
1487-
)
1488-
14891474
self._discord.dispatch("context_menu", ctx)
14901475

1491-
await self.invoke_command(selected_cmd, ctx, args)
1476+
await self.invoke_command(selected_cmd, ctx, args=[])
14921477

14931478
async def handle_subcommand(self, ctx: context.SlashContext, data: dict):
14941479
"""

discord_slash/context.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,10 @@ def __init__(
6262
self._deferred_hidden = False # To check if the patch to the deferred response matches
6363
self.guild_id = int(_json["guild_id"]) if "guild_id" in _json.keys() else None
6464
if self.guild and self._author_menus_id:
65-
self.author_menus = []
66-
for user in self._author_menus_id:
67-
self.author.menus.append(
68-
discord.Member(
69-
data=self._author_menus_id[user], state=self.bot._connection
70-
)
71-
)
65+
self.author_menus = discord.Member(
66+
data=self._author_menus_id[self._author_menus_id],
67+
state=self.bot._connection
68+
)
7269
else:
7370
self.author_menus = None
7471
self.author_id = int(
@@ -78,17 +75,13 @@ def __init__(
7875
self.message_menus = None
7976
try:
8077
if self._message_menu_id:
81-
self.message_menus = []
82-
for message in self._message_menu_id:
83-
self.message_menus.append(
84-
model.SlashMessage(
85-
state=self.bot._connection,
86-
channel=_discord.get_channel(self.channel_id),
87-
data=self._message_menu_id[message],
88-
_http=_http,
89-
interaction_token=self._token,
90-
)
91-
)
78+
self.message_menus = model.SlashMessage(
79+
state=self.bot._connection,
80+
channel=_discord.get_channel(self.channel_id),
81+
data=self._message_menu_id[self._message_menu_id],
82+
_http=_http,
83+
interaction_token=self._token,
84+
)
9285
else:
9386
raise KeyError
9487
except KeyError as err:

0 commit comments

Comments
 (0)