diff --git a/discord_slash/client.py b/discord_slash/client.py index 5fa5bbf11..ba323fd76 100644 --- a/discord_slash/client.py +++ b/discord_slash/client.py @@ -535,8 +535,7 @@ def add_slash_command( """ name = name or cmd.__name__ name = name.lower() - guild_ids = guild_ids if guild_ids else [] - if not all(isinstance(item, int) for item in guild_ids) and guild_ids is not []: + if not all(isinstance(item, int) for item in guild_ids): raise error.IncorrectGuildIDType( f"The snowflake IDs {guild_ids} given are not a list of integers. Because of discord.py convention, please use integer IDs instead. Furthermore, the command '{name}' will be deactivated and broken until fixed." ) @@ -617,8 +616,7 @@ def add_subcommand( name = name or cmd.__name__ name = name.lower() description = description or getdoc(cmd) - guild_ids = guild_ids if guild_ids else [] - if not all(isinstance(item, int) for item in guild_ids) and guild_ids is not []: + if guild_ids and not all(isinstance(item, int) for item in guild_ids): raise error.IncorrectGuildIDType( f"The snowflake IDs {guild_ids} given are not a list of integers. Because of discord.py convention, please use integer IDs instead. Furthermore, the command '{name}' will be deactivated and broken until fixed." ) diff --git a/discord_slash/dpy_overrides.py b/discord_slash/dpy_overrides.py index 27c6c9822..ac4ada447 100644 --- a/discord_slash/dpy_overrides.py +++ b/discord_slash/dpy_overrides.py @@ -23,12 +23,12 @@ def get_component(self, custom_id: int) -> typing.Optional[dict]: """ for row in self.components: for component in row["components"]: - if component["custom_id"] is custom_id: + if component["custom_id"] == custom_id: return component def new_override(cls, *args, **kwargs): - if cls is discord.Message: + if isinstance(cls, discord.Message): return object.__new__(ComponentMessage) else: return object.__new__(cls) diff --git a/discord_slash/utils/manage_components.py b/discord_slash/utils/manage_components.py index 2bc5ca1a4..552eae31d 100644 --- a/discord_slash/utils/manage_components.py +++ b/discord_slash/utils/manage_components.py @@ -47,7 +47,7 @@ def spread_to_rows(*components, max_in_row=5) -> typing.List[dict]: rows = [] button_row = [] for component in list(components) + [None]: - if component is not None and component["type"] is ComponentType.button: + if component is not None and component["type"] == ComponentType.button: button_row.append(component) if len(button_row) == max_in_row: @@ -62,9 +62,9 @@ def spread_to_rows(*components, max_in_row=5) -> typing.List[dict]: if component is None: pass - elif component["type"] is ComponentType.actionrow: + elif component["type"] == ComponentType.actionrow: rows.append(component) - elif component["type"] is ComponentType.select: + elif component["type"] == ComponentType.select: rows.append(create_actionrow(component)) if len(rows) > 5: