Skip to content

Commit e668a1e

Browse files
committed
fix UnboundLocalError in register_commands
1 parent 148f249 commit e668a1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

discord/bot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ async def register_commands(self) -> None:
197197
try:
198198
cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id,
199199
update_guild_commands[guild_id])
200+
for i in cmds:
201+
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
202+
self.app_commands[i["id"]] = cmd
200203
except Forbidden as e:
201204
raised_error = e
202205
raised_guilds.append(guild_id)
203-
for i in cmds:
204-
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
205-
self.app_commands[i["id"]] = cmd
206206
if raised_error:
207-
try:
207+
try: # TODO: this is awful
208208
raise raised_error
209209
except Forbidden:
210210
print(f'Ignoring exception running bulk_upsert_guild_commands on guilds {raised_guilds}',

0 commit comments

Comments
 (0)