From 71151952caf2f78406080aad68070668dd276aff Mon Sep 17 00:00:00 2001
From: onerandomusername <me@arielle.codes>
Date: Fri, 21 Oct 2022 00:32:39 -0400
Subject: [PATCH] chore: remove other parts of command sync

---
 disnake/ext/commands/bot.py                  |   5 -
 disnake/ext/commands/flags.py                | 150 -------------------
 disnake/ext/commands/interaction_bot_base.py |  12 +-
 test_bot/__main__.py                         |   2 +-
 4 files changed, 3 insertions(+), 166 deletions(-)
 delete mode 100644 disnake/ext/commands/flags.py

diff --git a/disnake/ext/commands/bot.py b/disnake/ext/commands/bot.py
index 73230a00a5..e27e1abe69 100644
--- a/disnake/ext/commands/bot.py
+++ b/disnake/ext/commands/bot.py
@@ -26,7 +26,6 @@
 
     from ._types import MaybeCoro
     from .bot_base import PrefixType
-    from .flags import ApplicationCommandSyncFlags
     from .help import HelpCommand
 
 
@@ -217,7 +216,6 @@ def __init__(
             owner_ids: Optional[Set[int]] = None,
             reload: bool = False,
             case_insensitive: bool = False,
-            command_sync: ApplicationCommandSyncFlags = ...,
             test_guilds: Optional[Sequence[int]] = None,
             asyncio_debug: bool = False,
             loop: Optional[asyncio.AbstractEventLoop] = None,
@@ -266,7 +264,6 @@ def __init__(
             owner_ids: Optional[Set[int]] = None,
             reload: bool = False,
             case_insensitive: bool = False,
-            command_sync: ApplicationCommandSyncFlags = ...,
             test_guilds: Optional[Sequence[int]] = None,
             asyncio_debug: bool = False,
             loop: Optional[asyncio.AbstractEventLoop] = None,
@@ -396,7 +393,6 @@ def __init__(
             owner_id: Optional[int] = None,
             owner_ids: Optional[Set[int]] = None,
             reload: bool = False,
-            command_sync: ApplicationCommandSyncFlags = ...,
             test_guilds: Optional[Sequence[int]] = None,
             asyncio_debug: bool = False,
             loop: Optional[asyncio.AbstractEventLoop] = None,
@@ -438,7 +434,6 @@ def __init__(
             owner_id: Optional[int] = None,
             owner_ids: Optional[Set[int]] = None,
             reload: bool = False,
-            command_sync: ApplicationCommandSyncFlags = ...,
             test_guilds: Optional[Sequence[int]] = None,
             asyncio_debug: bool = False,
             loop: Optional[asyncio.AbstractEventLoop] = None,
diff --git a/disnake/ext/commands/flags.py b/disnake/ext/commands/flags.py
deleted file mode 100644
index b3f4d260bc..0000000000
--- a/disnake/ext/commands/flags.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# SPDX-License-Identifier: MIT
-
-from __future__ import annotations
-
-from typing import TYPE_CHECKING
-
-from disnake.flags import BaseFlags, alias_flag_value, all_flags_value, flag_value
-
-if TYPE_CHECKING:
-    from typing_extensions import Self
-
-__all__ = ("ApplicationCommandSyncFlags",)
-
-
-class ApplicationCommandSyncFlags(BaseFlags):
-    """Controls the library's application command syncing policy.
-
-    This allows for finer grained control over what commands are synced automatically and in what cases.
-
-    To construct an object you can pass keyword arguments denoting the flags
-    to enable or disable.
-
-    The default value is all flags enabled.
-
-    .. versionadded:: 2.6
-
-    .. container:: operations
-
-        .. describe:: x == y
-
-            Checks if two ApplicationCommandSyncFlags instances are equal.
-        .. describe:: x != y
-
-            Checks if two ApplicationCommandSyncFlags instances are not equal.
-        .. describe:: x <= y
-
-            Checks if an ApplicationCommandSyncFlags instance is a subset of another ApplicationCommandSyncFlags instance.
-        .. describe:: x >= y
-
-            Checks if an ApplicationCommandSyncFlags instance is a superset of another ApplicationCommandSyncFlags instance.
-        .. describe:: x < y
-
-            Checks if an ApplicationCommandSyncFlags instance is a strict subset of another ApplicationCommandSyncFlags instance.
-        .. describe:: x > y
-
-            Checks if an ApplicationCommandSyncFlags instance is a strict superset of another ApplicationCommandSyncFlags instance.
-        .. describe:: x | y, x |= y
-
-            Returns a new ApplicationCommandSyncFlags instance with all enabled flags from both x and y.
-            (Using ``|=`` will update in place).
-        .. describe:: x & y, x &= y
-
-            Returns a new ApplicationCommandSyncFlags instance with only flags enabled on both x and y.
-            (Using ``&=`` will update in place).
-        .. describe:: x ^ y, x ^= y
-
-            Returns a new ApplicationCommandSyncFlags instance with only flags enabled on one of x or y, but not both.
-            (Using ``^=`` will update in place).
-        .. describe:: ~x
-
-            Returns a new ApplicationCommandSyncFlags instance with all flags from x inverted.
-        .. describe:: hash(x)
-
-            Return the flag's hash.
-        .. describe:: iter(x)
-
-            Returns an iterator of ``(name, value)`` pairs. This allows it
-            to be, for example, constructed as a dict or a list of pairs.
-            Note that aliases are not shown.
-
-
-        Additionally supported are a few operations on class attributes.
-
-        .. describe:: ApplicationCommandSyncFlags.y | ApplicationCommandSyncFlags.z, ApplicationCommandSyncFlags(y=True) | ApplicationCommandSyncFlags.z
-
-            Returns a ApplicationCommandSyncFlags instance with all provided flags enabled.
-
-        .. describe:: ~ApplicationCommandSyncFlags.y
-
-            Returns a ApplicationCommandSyncFlags instance with all flags except ``y`` inverted from their default value.
-
-    .. versionadded:: 2.6
-    Attributes
-    ----------
-    value: :class:`int`
-        The raw value. You should query flags via the properties
-        rather than using this raw value.
-    """
-
-    __slots__ = ()
-
-    def __init__(self, **kwargs: bool):
-        self.value = all_flags_value(self.VALID_FLAGS)
-        for key, value in kwargs.items():
-            if key not in self.VALID_FLAGS:
-                raise TypeError(f"{key!r} is not a valid flag name.")
-            setattr(self, key, value)
-
-    @classmethod
-    def all(cls) -> Self:
-        """A factory method that creates a :class:`ApplicationCommandSyncFlags` with everything enabled."""
-        self = cls.__new__(cls)
-        self.value = all_flags_value(cls.VALID_FLAGS)
-        return self
-
-    @classmethod
-    def none(cls) -> Self:
-        """A factory method that creates a :class:`ApplicationCommandSyncFlags` with everything disabled."""
-        self = cls.__new__(cls)
-        self.value = self.DEFAULT_VALUE
-        return self
-
-    @classmethod
-    def default(cls) -> Self:
-        """A factory method that creates a :class:`ApplicationCommandSyncFlags` with the default settings."""
-        instance = cls.all()
-        instance.sync_commands_debug = False
-        return instance
-
-    @alias_flag_value
-    def sync_commands(self):
-        """:class:`bool`: Whether to sync app commands at all."""
-        return 1 << 5 | 1 << 6
-
-    @flag_value
-    def sync_commands_debug(self):
-        """:class:`bool`: Whether or not to show app command sync debug messages"""
-        return 1 << 1
-
-    @alias_flag_value
-    def on_cog_actions(self):
-        """:class:`bool`: Whether or not to sync app commands on cog load, unload, or reload."""
-        return 1 << 2 | 1 << 4
-
-    @flag_value
-    def on_cog_unload(self):
-        """:class:`bool`: Whether or not to sync app commands on cog unload or reload."""
-        return 1 << 2
-
-    @flag_value
-    def allow_command_deletion(self):
-        return 1 << 3
-
-    @flag_value
-    def global_commands(self):
-        return 1 << 5
-
-    @flag_value
-    def guild_commands(self):
-        return 1 << 6
diff --git a/disnake/ext/commands/interaction_bot_base.py b/disnake/ext/commands/interaction_bot_base.py
index b5c7deca57..cab9170b87 100644
--- a/disnake/ext/commands/interaction_bot_base.py
+++ b/disnake/ext/commands/interaction_bot_base.py
@@ -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
@@ -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
diff --git a/test_bot/__main__.py b/test_bot/__main__.py
index 3e4e7babae..5e084fdcb3 100644
--- a/test_bot/__main__.py
+++ b/test_bot/__main__.py
@@ -32,7 +32,7 @@ def __init__(self):
             command_prefix=Config.prefix,
             intents=disnake.Intents.all(),
             help_command=None,  # type: ignore
-            command_sync=commands.ApplicationCommandSyncFlags.all(),
+            sync_commands_debug=Config.sync_commands_debug,
             strict_localization=Config.strict_localization,
             test_guilds=Config.test_guilds,
             reload=Config.auto_reload,