Skip to content

Commit

Permalink
chore: remove other parts of command sync
Browse files Browse the repository at this point in the history
  • Loading branch information
onerandomusername committed Oct 21, 2022
1 parent e824ed8 commit 3f94527
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 160 deletions.
150 changes: 0 additions & 150 deletions disnake/ext/commands/flags.py

This file was deleted.

12 changes: 2 additions & 10 deletions disnake/ext/commands/interaction_bot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,11 @@ async def _sync_application_commands(self) -> None:
# Sort all invokable commands between guild IDs:
global_cmds, guild_cmds = self._ordered_unsynced_commands(self._test_guilds)

if global_cmds is not None and self._command_sync.global_commands:
if global_cmds is not None:
# Update global commands first
diff = _app_commands_diff(
global_cmds, self._connection._global_application_commands.values()
)
if not self._command_sync.allow_command_deletion:
# because allow_command_deletion is disabled, we want to never delete a command, so we move the delete commands to no_changes
diff["no_changes"] += diff["delete"]
diff["delete"].clear()
update_required = bool(diff["upsert"]) or bool(diff["edit"]) or bool(diff["delete"])

# Show the difference
Expand All @@ -889,14 +885,10 @@ async def _sync_application_commands(self) -> None:
# Same process but for each specified guild individually.
# Notice that we're not doing this for every single guild for optimisation purposes.
# See the note in :meth:`_cache_application_commands` about guild app commands.
if guild_cmds is not None and self._command_sync.guild_commands:
if guild_cmds is not None:
for guild_id, cmds in guild_cmds.items():
current_guild_cmds = self._connection._guild_application_commands.get(guild_id, {})
diff = _app_commands_diff(cmds, current_guild_cmds.values())
if not self._command_sync.allow_command_deletion:
# because allow_command_deletion is disabled, we want to never delete a command, so we move the delete commands to no_changes
diff["no_changes"] += diff["delete"]
diff["delete"].clear()
update_required = bool(diff["upsert"]) or bool(diff["edit"]) or bool(diff["delete"])

# Show diff
Expand Down

0 comments on commit 3f94527

Please sign in to comment.