Skip to content

Commit 54e79e7

Browse files
committed
Add support for merge permissions by cog subcommand.
1 parent 63bef90 commit 54e79e7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

discord_slash/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,20 @@ def get_cog_commands(self, cog: commands.Cog):
121121
self.commands[x.name] = x
122122
else:
123123
if x.base in self.commands:
124+
base_command = self.commands[x.base]
124125
for i in x.allowed_guild_ids:
125-
if i not in self.commands[x.base].allowed_guild_ids:
126-
self.commands[x.base].allowed_guild_ids.append(i)
126+
if i not in base_command.allowed_guild_ids:
127+
base_command.allowed_guild_ids.append(i)
128+
129+
base_permissions = x.base_command_data["api_permissions"]
130+
if base_permissions:
131+
for applicable_guild in base_permissions:
132+
if applicable_guild not in base_command.permissions:
133+
base_command.permissions[applicable_guild] = []
134+
base_command.permissions[applicable_guild].extend(base_permissions[applicable_guild])
135+
127136
self.commands[x.base].has_subcommands = True
137+
128138
else:
129139
self.commands[x.base] = model.BaseCommandObject(x.base, x.base_command_data)
130140
if x.base not in self.subcommands:

0 commit comments

Comments
 (0)