Skip to content

Commit 950292d

Browse files
authored
Merge pull request #22 from PredaaA/patch-1
Dispatch an event on valid command
2 parents 66deebf + 81d2830 commit 950292d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

discord_slash/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ async def on_socket_response(self, msg):
346346
return await self.handle_subcommand(ctx, to_use)
347347
args = await self.process_options(ctx.guild, to_use["data"]["options"], selected_cmd["auto_convert"]) \
348348
if "options" in to_use["data"] else []
349+
await self._discord.dispatch("slash_command", to_use["data"]["name"], selected_cmd)
349350
await selected_cmd["func"](ctx, *args)
350351

351352
async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
@@ -374,9 +375,11 @@ async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
374375
selected = base[sub_name][sub_group]
375376
args = await self.process_options(ctx.guild, x["options"], selected["auto_convert"]) \
376377
if "options" in x.keys() else []
378+
await self._discord.dispatch("slash_command", sub_name, selected)
377379
await selected["func"](ctx, *args)
378380
return
379381
selected = base[sub_name]
380382
args = await self.process_options(ctx.guild, sub_opts, selected["auto_convert"]) \
381383
if "options" in sub.keys() else []
384+
await self._discord.dispatch("slash_command", sub_name, selected)
382385
await selected["func"](ctx, *args)

0 commit comments

Comments
 (0)