Skip to content

Commit a650d65

Browse files
committed
Improving logging for sync_commands.
1 parent 3a15ee4 commit a650d65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

discord_slash/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ async def sync_all_commands(
368368
permissions_map[applicable_guild].append(permission)
369369

370370

371-
self.logger.debug(permissions_map)
371+
self.logger.info("Syncing permissions...")
372+
self.logger.debug(f"Commands permission data are {permissions_map}")
372373
for scope in permissions_map:
373374
existing_perms = await self.req.get_all_guild_commands_permissions(scope)
374375
new_perms = permissions_map[scope]
@@ -396,6 +397,7 @@ async def sync_all_commands(
396397

397398

398399
if delete_from_unused_guilds:
400+
self.logger.info("Deleting unused guild commands...")
399401
other_guilds = [guild.id for guild in self._discord.guilds if guild.id not in cmds["guild"]]
400402
# This is an extremly bad way to do this, because slash cmds can be in guilds the bot isn't in
401403
# But it's the only way until discord makes an endpoint to request all the guild with cmds registered.
@@ -404,13 +406,16 @@ async def sync_all_commands(
404406
with suppress(discord.Forbidden):
405407
existing = await self.req.get_all_commands(guild_id = guild)
406408
if len(existing) != 0:
409+
self.logger.debug(f"Deleting commands from {guild}")
407410
await self.req.put_slash_commands(slash_commands=[], guild_id=guild)
408411

409412

410413
if delete_perms_from_unused_guilds:
414+
self.logger.info("Deleting unused guild permissions...")
411415
other_guilds = [guild.id for guild in self._discord.guilds if guild.id not in permissions_map.keys()]
412416
for guild in other_guilds:
413417
with suppress(discord.Forbidden):
418+
self.logger.debug(f"Deleting permissions from {guild}")
414419
existing_perms = await self.req.get_all_guild_commands_permissions(guild)
415420
if len(existing_perms) != 0:
416421
await self.req.update_guild_commands_permissions(guild, [])

0 commit comments

Comments
 (0)