Skip to content

Commit 15cec02

Browse files
Fix AttributeError (#923)
1 parent 1fb5c0d commit 15cec02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

discord/bot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,15 @@ async def sync_commands(
572572
# Permissions (Roles will be converted to IDs just before Upsert for Global Commands)
573573
global_permissions.append({"id": i["id"], "permissions": cmd.permissions})
574574

575-
for guild_id, guild_data in registered_guild_commands.items():
576-
commands = registered_guild_commands[guild_id]
575+
for guild_id, commands in registered_guild_commands.items():
577576
guild_permissions: List = []
578577

579578
for i in commands:
580579
cmd = find(lambda cmd: cmd.name == i["name"] and cmd.type == i["type"] and cmd.guild_ids is not None
581580
and (i["guild_id"]) in cmd.guild_ids, self.pending_application_commands)
581+
if not cmd:
582+
# command has not been added yet
583+
continue
582584
cmd.id = i["id"]
583585
self._application_commands[cmd.id] = cmd
584586

0 commit comments

Comments
 (0)