@@ -381,9 +381,10 @@ async def register_commands(
381
381
382
382
commands = [copy .copy (cmd ) for cmd in commands ]
383
383
384
- for cmd in commands :
385
- to_rep_with = [guild_id ] if guild_id is not None else guild_id
386
- cmd .guild_ids = to_rep_with
384
+ if guild_id is not None :
385
+ for cmd in commands :
386
+ to_rep_with = [guild_id ]
387
+ cmd .guild_ids = to_rep_with
387
388
388
389
is_global = guild_id is None
389
390
@@ -537,7 +538,8 @@ async def sync_commands(
537
538
for cmd in commands :
538
539
cmd .guild_ids = guild_ids
539
540
540
- registered_commands = await self .register_commands (commands , force = force )
541
+ global_commands = [cmd for cmd in commands if cmd .guild_ids is None ]
542
+ registered_commands = await self .register_commands (global_commands , force = force )
541
543
542
544
cmd_guild_ids = []
543
545
registered_guild_commands = {}
@@ -549,10 +551,12 @@ async def sync_commands(
549
551
if unregister_guilds is not None :
550
552
cmd_guild_ids .extend (unregister_guilds )
551
553
for guild_id in set (cmd_guild_ids ):
554
+ guild_commands = [cmd for cmd in commands if cmd .guild_ids is not None and guild_id in cmd .guild_ids ]
552
555
registered_guild_commands [guild_id ] = await self .register_commands (
553
- commands ,
556
+ guild_commands ,
554
557
guild_id = guild_id ,
555
- force = force )
558
+ force = force
559
+ )
556
560
557
561
# TODO: 2.1: Remove this and favor permissions v2
558
562
# Global Command Permissions
0 commit comments