Repository: hikari-py/hikari
Pull request #1535 (2023-03-06 07:13:48)

Remove deprecated behaviour for 2.0.0.dev118


Patch:
diff --git a/changes/1535.breaking.md b/changes/1535.breaking.md
new file mode 100644
index 00000000..6602a4ed
--- /dev/null
+++ b/changes/1535.breaking.md
@@ -0,0 +1,4 @@
+Remove previously deprecated functionality:
+- `Intents.GUILD_BANS` (deprecated alias for `Intents.GUILD_MODERATION`)
+- `ComponentType.SELECT_MENU` (deprecated alias for `Intents.TEXT_SELECT_MENU`)
+- Not passing type through `type` argument explicitly to `MessageActionRowBuilder.add_select_menu`
diff --git a/hikari/api/special_endpoints.py b/hikari/api/special_endpoints.py
index 99f2e2af..ef85ce82 100644
--- a/hikari/api/special_endpoints.py
+++ b/hikari/api/special_endpoints.py
@@ -1933,15 +1933,6 @@ def add_button(
             component.
         """
 
-    @typing.overload  # Deprecated overload
-    @abc.abstractmethod
-    def add_select_menu(
-        self,
-        custom_id: str,
-        /,
-    ) -> TextSelectMenuBuilder[Self]:
-        ...
-
     @typing.overload
     @abc.abstractmethod
     def add_select_menu(
@@ -1962,30 +1953,15 @@ def add_select_menu(
     ) -> ChannelSelectMenuBuilder[Self]:
         ...
 
-    @typing.overload
     @abc.abstractmethod
     def add_select_menu(
         self,
         type_: typing.Union[components_.ComponentType, int],
         custom_id: str,
         /,
-    ) -> SelectMenuBuilder[Self]:
-        ...
-
-    @abc.abstractmethod
-    def add_select_menu(
-        self,
-        type_: typing.Union[components_.ComponentType, int, str],
-        # These have default during the deprecation period for backwards compatibility, as custom_id
-        # used to come first
-        custom_id: str = "",
-        /,
     ) -> SelectMenuBuilder[Self]:
         """Add a select menu component to this action row builder.
 
-        .. deprecated:: 2.0.0.dev116
-            `type_` now comes as a positional-only argument before `custom_id`.
-
         Parameters
         ----------
         type_ : typing.Union[hikari.components.ComponentType, int]
diff --git a/hikari/components.py b/hikari/components.py
index 51ae1989..386b4229 100644
--- a/hikari/components.py
+++ b/hikari/components.py
@@ -84,9 +84,6 @@ class ComponentType(int, enums.Enum):
         as `ComponentType.ACTION_ROW`.
     """
 
-    SELECT_MENU = enums.deprecated(TEXT_SELECT_MENU, removal_version="2.0.0.dev118")
-    """Deprecated alias for `TEXT_MENU_SELECT`."""
-
     TEXT_INPUT = 4
     """A text input component.
 
diff --git a/hikari/impl/special_endpoints.py b/hikari/impl/special_endpoints.py
index 92974d74..18ba761b 100644
--- a/hikari/impl/special_endpoints.py
+++ b/hikari/impl/special_endpoints.py
@@ -66,7 +66,6 @@
 from hikari.interactions import base_interactions
 from hikari.internal import attr_extensions
 from hikari.internal import data_binding
-from hikari.internal import deprecation
 from hikari.internal import mentions
 from hikari.internal import routes
 from hikari.internal import time
@@ -1864,7 +1863,8 @@ def type(self) -> typing.Literal[component_models.ComponentType.ACTION_ROW]:
     def components(self) -> typing.Sequence[special_endpoints.ComponentBuilder]:
         return self._components.copy()
 
-    def _assert_can_add_type(self, type_: component_models.ComponentType, /) -> None:
+    def _assert_can_add_type(self, type_: typing.Union[component_models.ComponentType, int], /) -> None:
+        type_ = component_models.ComponentType(type_)
         if self._stored_type is not None and self._stored_type != type_:
             raise ValueError(
                 f"{type_} component type cannot be added to a container which already holds {self._stored_type}"
@@ -1912,14 +1912,6 @@ def add_button(
 
         return LinkButtonBuilder(container=self, style=style, url=url_or_custom_id)
 
-    @typing.overload  # Deprecated overload
-    def add_select_menu(
-        self,
-        custom_id: str,
-        /,
-    ) -> special_endpoints.TextSelectMenuBuilder[Self]:
-        ...
-
     @typing.overload
     def add_select_menu(
         self,
@@ -1938,38 +1930,12 @@ def add_select_menu(
     ) -> special_endpoints.ChannelSelectMenuBuilder[Self]:
         ...
 
-    @typing.overload
     def add_select_menu(
         self,
         type_: typing.Union[component_models.ComponentType, int],
         custom_id: str,
         /,
     ) -> special_endpoints.SelectMenuBuilder[Self]:
-        ...
-
-    def add_select_menu(
-        self,
-        type_: typing.Union[component_models.ComponentType, int, str],
-        # These have default during the deprecation period for backwards compatibility, as custom_id
-        # used to come first
-        custom_id: str = "",
-        /,
-    ) -> special_endpoints.SelectMenuBuilder[Self]:
-        # custom_id used to come first, so just switch them around if only of them is passed
-        if type_ and not custom_id:
-            custom_id = str(type_)
-
-            deprecation.warn_deprecated(
-                "not passing 'type' explicitly",
-                removal_version="2.0.0.dev118",
-                additional_info="Please set the type by passing 'type' explicitly",
-                quote=False,
-            )
-            type_ = component_models.ComponentType.TEXT_SELECT_MENU
-
-        # A little guard during the deprecation period to stop mypy from complaining
-        type_ = component_models.ComponentType(type_)
-
         if type_ not in component_models.SelectMenuTypes:
             raise ValueError(f"{type_!r} is an invalid type option")
 
diff --git a/hikari/intents.py b/hikari/intents.py
index 0e015255..19591ac9 100644
--- a/hikari/intents.py
+++ b/hikari/intents.py
@@ -227,9 +227,6 @@ class Intents(enums.Flag):
     * `GUILD_BAN_REMOVE`
     """
 
-    GUILD_BANS = enums.deprecated(GUILD_MODERATION, removal_version="2.0.0.dev118")
-    """Deprecated alias of `GUILD_BANS`."""
-
     GUILD_EMOJIS = 1 << 3
     """Subscribes to the events listed below.
 


Test patch:
diff --git a/tests/hikari/impl/test_special_endpoints.py b/tests/hikari/impl/test_special_endpoints.py
index 80e8f732..68abdae8 100644
--- a/tests/hikari/impl/test_special_endpoints.py
+++ b/tests/hikari/impl/test_special_endpoints.py
@@ -1678,7 +1678,7 @@ def test_add_button_for_link(self):
 
     def test_add_select_menu(self):
         row = special_endpoints.MessageActionRowBuilder()
-        menu = row.add_select_menu("hihihi")
+        menu = row.add_select_menu(components.ComponentType.TEXT_SELECT_MENU, "hihihi")
 
         menu.add_to_container()