Skip to content

Commit 595f3e3

Browse files
authored
fix: prevent key error (#786)
1 parent ade1830 commit 595f3e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interactions/client/bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ async def __sync(self) -> None: # sourcery no-metrics
447447

448448
# responsible for checking if a command is in the cache but not a coro -> allowing removal
449449

450-
for _id in _guild_ids:
450+
for _id in _guild_ids.copy():
451451
_cmds = await self._http.get_application_commands(
452452
application_id=self.me.id, guild_id=_id, with_localizations=True
453453
)
@@ -463,6 +463,7 @@ async def __sync(self) -> None: # sourcery no-metrics
463463
"`application.commands` scope!"
464464
)
465465
__blocked_guilds.add(_id)
466+
_guild_ids.remove(_id)
466467
continue
467468

468469
for command in _cmds:

0 commit comments

Comments
 (0)