Skip to content

Commit fd40793

Browse files
committed
Undo #d2a0aa9
1 parent f332cc4 commit fd40793

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

discord/bot.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -188,29 +188,12 @@ async def register_commands(self) -> None:
188188
to_update = update_guild_commands[guild_id]
189189
update_guild_commands[guild_id] = to_update + [as_dict]
190190

191-
for guild_id, value in update_guild_commands.items():
192-
if value:
193-
try:
194-
cmds = await self.http.bulk_upsert_guild_commands(
195-
self.user.id, guild_id, value
196-
)
197-
except Forbidden as e:
198-
if "Missing Access" in e.args[0]:
199-
print(
200-
f"Bot is missing access to create application commands in this guild: {guild_id}."
201-
)
202-
continue # raising an error causes the function to stop but the bot still runs
203-
else:
204-
raise e
205-
206-
for i in cmds:
207-
cmd = get(
208-
self.to_register,
209-
name=i["name"],
210-
description=i["description"],
211-
type=i["type"],
212-
)
213-
self.app_commands[i["id"]] = cmd
191+
for guild_id in update_guild_commands:
192+
cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id,
193+
update_guild_commands[guild_id])
194+
for i in cmds:
195+
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
196+
self.app_commands[i["id"]] = cmd
214197

215198
cmds = await self.http.bulk_upsert_global_commands(self.user.id, commands)
216199

0 commit comments

Comments
 (0)