Skip to content

Commit af90421

Browse files
committed
Fix stuff with viewing perm
1 parent 31c1164 commit af90421

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Un-deprecated the `OWNERS` config variable to support discord developer team acc
225225
### New Permissions System
226226

227227
- A brand new permission system! Replacing the old guild-based permissions (ie. manage channels, manage messages), the new system enables you to customize your desired permission level specific to a command or a group of commands for a role or user.
228-
- There are five permission groups/levels:
228+
- There are five permission levels:
229229
- Owner [5]
230230
- Administrator [4]
231231
- Moderator [3]
@@ -247,7 +247,7 @@ The same applies to individual commands permissions:
247247

248248
To revoke permission, use `remove` instead of `add`.
249249

250-
To view all roles and users with permission for a permission group or command do:
250+
To view all roles and users with permission for a permission level or command do:
251251
- `?permissions get command command-name`
252252
- `?permissions get level owner`
253253

cogs/modmail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def setup(self, ctx):
8787
await self.bot.config.update()
8888
await ctx.send(
8989
"Successfully set up server.\n"
90-
"Consider setting permission groups to give access "
90+
"Consider setting permission levels to give access "
9191
"to roles or users the ability to use Modmail.\n"
9292
f"Type `{self.bot.prefix}permissions` for more info."
9393
)

cogs/utility.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ async def send_error_message(self, error):
220220

221221
choices = set()
222222

223-
for name, cmd in self.context.bot.all_commands.items():
223+
for cmd in self.context.bot.walk_commands():
224224
if not cmd.hidden:
225-
choices.add(name)
225+
choices.add(cmd.name)
226226

227227
closest = get_close_matches(command, choices)
228228
if closest:
@@ -1221,7 +1221,7 @@ def _verify_user_or_role(user_or_role):
12211221
@permissions.command(name="add", usage="[command/level] [name] [user_or_role]")
12221222
@checks.has_permissions(PermissionLevel.OWNER)
12231223
async def permissions_add(
1224-
self, ctx, type_: str.lower, name: str, *, user_or_role: Union[User, Role, str]
1224+
self, ctx, type_: str.lower, name: str, *, user_or_role: Union[Role, User, str]
12251225
):
12261226
"""
12271227
Add a permission to a command or a permission level.
@@ -1279,7 +1279,7 @@ async def permissions_add(
12791279
)
12801280
@checks.has_permissions(PermissionLevel.OWNER)
12811281
async def permissions_remove(
1282-
self, ctx, type_: str.lower, name: str, *, user_or_role: Union[User, Role, str]
1282+
self, ctx, type_: str.lower, name: str, *, user_or_role: Union[Role, User, str]
12831283
):
12841284
"""
12851285
Remove permission to use a command or permission level.
@@ -1300,8 +1300,7 @@ async def permissions_remove(
13001300

13011301
level = None
13021302
if type_ == "command":
1303-
command = self.bot.get_command(name.lower())
1304-
name = command.qualified_name if command is not None else name
1303+
name = getattr(self.bot.get_command(name.lower()), "qualified_name", name)
13051304
else:
13061305
if name.upper() not in PermissionLevel.__members__:
13071306
embed = Embed(
@@ -1364,7 +1363,7 @@ def _get_perm(self, ctx, name, type_):
13641363
@permissions.command(name="get", usage="[@user] or [command/level] [name]")
13651364
@checks.has_permissions(PermissionLevel.OWNER)
13661365
async def permissions_get(
1367-
self, ctx, user_or_role: Union[User, Role, str], *, name: str = None
1366+
self, ctx, user_or_role: Union[Role, User, str], *, name: str = None
13681367
):
13691368
"""
13701369
View the currently-set permissions.
@@ -1388,7 +1387,7 @@ async def permissions_get(
13881387
levels = []
13891388

13901389
done = set()
1391-
for _, command in self.bot.all_commands.items():
1390+
for command in self.bot.walk_commands():
13921391
if command not in done:
13931392
done.add(command)
13941393
permissions = self.bot.config["command_permissions"].get(
@@ -1421,7 +1420,7 @@ async def permissions_get(
14211420
color=self.bot.main_color,
14221421
),
14231422
Embed(
1424-
title=f"{mention} has permission with the following permission groups:",
1423+
title=f"{mention} has permission with the following permission levels:",
14251424
description=desc_level,
14261425
color=self.bot.main_color,
14271426
),
@@ -1457,7 +1456,7 @@ async def permissions_get(
14571456
else:
14581457
if user_or_role == "command":
14591458
done = set()
1460-
for _, command in self.bot.all_commands.items():
1459+
for command in self.bot.walk_commands():
14611460
if command not in done:
14621461
done.add(command)
14631462
embeds.append(

0 commit comments

Comments
 (0)