Skip to content

Commit f38896a

Browse files
DorukyumLulalaby
authored andcommitted
Raise fatal errors on permissions failure
1 parent 5066886 commit f38896a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

discord/bot.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ async def sync_commands(
644644
}
645645
)
646646
else:
647-
print(
647+
raise RuntimeError(
648648
"No Role ID found in Guild ({guild_id}) for Role ({role})".format(
649649
guild_id=guild_id, role=permission["id"]
650650
)
@@ -677,9 +677,8 @@ async def sync_commands(
677677

678678
# Make sure we don't have over 10 overwrites
679679
if len(new_cmd_perm["permissions"]) > 10:
680-
print(
681-
"Command '{name}' has more than 10 permission overrides in guild ({guild_id}).\nwill only use "
682-
"the first 10 permission overrides.".format(
680+
raise RuntimeError(
681+
"Command '{name}' has more than 10 permission overrides in guild ({guild_id}).".format(
683682
name=self._application_commands[new_cmd_perm["id"]].name,
684683
guild_id=guild_id,
685684
)
@@ -695,7 +694,7 @@ async def sync_commands(
695694
self.user.id, guild_id, guild_cmd_perms
696695
)
697696
except Forbidden:
698-
print(
697+
raise RuntimeError(
699698
f"Failed to add command permissions to guild {guild_id}",
700699
file=sys.stderr,
701700
)

0 commit comments

Comments
 (0)