Skip to content

Commit

Permalink
Raise fatal errors on permissions failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorukyum authored and Lulalaby committed Feb 10, 2022
1 parent 5066886 commit f38896a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ async def sync_commands(
}
)
else:
print(
raise RuntimeError(
"No Role ID found in Guild ({guild_id}) for Role ({role})".format(
guild_id=guild_id, role=permission["id"]
)
Expand Down Expand Up @@ -677,9 +677,8 @@ async def sync_commands(

# Make sure we don't have over 10 overwrites
if len(new_cmd_perm["permissions"]) > 10:
print(
"Command '{name}' has more than 10 permission overrides in guild ({guild_id}).\nwill only use "
"the first 10 permission overrides.".format(
raise RuntimeError(
"Command '{name}' has more than 10 permission overrides in guild ({guild_id}).".format(
name=self._application_commands[new_cmd_perm["id"]].name,
guild_id=guild_id,
)
Expand All @@ -695,7 +694,7 @@ async def sync_commands(
self.user.id, guild_id, guild_cmd_perms
)
except Forbidden:
print(
raise RuntimeError(
f"Failed to add command permissions to guild {guild_id}",
file=sys.stderr,
)
Expand Down

0 comments on commit f38896a

Please sign in to comment.