Skip to content

Commit 81d2830

Browse files
authored
Fix order and support subcommands
1 parent dc1cf97 commit 81d2830

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

discord_slash/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ async def on_socket_response(self, msg):
339339
if to_use["data"]["name"] in self.commands.keys():
340340
selected_cmd = self.commands[to_use["data"]["name"]]
341341
ctx = model.SlashContext(self.req, to_use, self._discord, self.logger)
342-
await self._discord.dispatch("slash_command", to_use["data"]["name"], selected_cmd)
343342
if selected_cmd["guild_ids"]:
344343
if ctx.guild.id not in selected_cmd["guild_ids"]:
345344
return
346345
if selected_cmd["has_subcommands"]:
347346
return await self.handle_subcommand(ctx, to_use)
348347
args = await self.process_options(ctx.guild, to_use["data"]["options"], selected_cmd["auto_convert"]) \
349348
if "options" in to_use["data"] else []
349+
await self._discord.dispatch("slash_command", to_use["data"]["name"], selected_cmd)
350350
await selected_cmd["func"](ctx, *args)
351351

352352
async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
@@ -375,9 +375,11 @@ async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
375375
selected = base[sub_name][sub_group]
376376
args = await self.process_options(ctx.guild, x["options"], selected["auto_convert"]) \
377377
if "options" in x.keys() else []
378+
await self._discord.dispatch("slash_command", sub_name, selected)
378379
await selected["func"](ctx, *args)
379380
return
380381
selected = base[sub_name]
381382
args = await self.process_options(ctx.guild, sub_opts, selected["auto_convert"]) \
382383
if "options" in sub.keys() else []
384+
await self._discord.dispatch("slash_command", sub_name, selected)
383385
await selected["func"](ctx, *args)

0 commit comments

Comments
 (0)