Skip to content

Commit ebc8c52

Browse files
committed
Added not existing command handling
1 parent bf8b5ed commit ebc8c52

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

discord_slash/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,19 @@ async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
358358
:param ctx: :class:`.model.SlashContext` instance.
359359
:param data: Gateway message.
360360
"""
361+
if data["data"]["name"] not in self.subcommands.keys():
362+
return
361363
base = self.subcommands[data["data"]["name"]]
362364
sub = data["data"]["options"][0]
363365
sub_name = sub["name"]
366+
if sub_name not in base.keys():
367+
return
364368
sub_opts = sub["options"] if "options" in sub else []
365369
for x in sub_opts:
366370
if "options" in x.keys() or "value" not in x.keys():
367371
sub_group = x["name"]
372+
if sub_group not in base[sub_name].keys():
373+
return
368374
selected = base[sub_name][sub_group]
369375
args = await self.process_options(ctx.guild, x["options"], selected["auto_convert"]) \
370376
if "options" in x.keys() else []

0 commit comments

Comments
 (0)