Skip to content

Commit 0388ce3

Browse files
committed
use else in try except
1 parent 4af8da5 commit 0388ce3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

discord/bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,15 @@ async def register_commands(self) -> None:
193193
try:
194194
cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id,
195195
update_guild_commands[guild_id])
196-
for i in cmds:
197-
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
198-
self.app_commands[i["id"]] = cmd
199196
except Forbidden:
200197
if update_guild_commands[guild_id] == []:
201198
continue
202199
else:
203200
raise
201+
else:
202+
for i in cmds:
203+
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
204+
self.app_commands[i["id"]] = cmd
204205

205206
cmds = await self.http.bulk_upsert_global_commands(self.user.id, commands)
206207

0 commit comments

Comments
 (0)