Skip to content

Commit b32d0e2

Browse files
committed
Consolidate ifs
1 parent 82f98fc commit b32d0e2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

discord_slash/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,7 @@ def add_slash_command(
535535
"""
536536
name = name or cmd.__name__
537537
name = name.lower()
538-
guild_ids = guild_ids if guild_ids else []
539-
if not all(isinstance(item, int) for item in guild_ids) and guild_ids is not []:
538+
if not all(isinstance(item, int) for item in guild_ids):
540539
raise error.IncorrectGuildIDType(
541540
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."
542541
)
@@ -617,8 +616,7 @@ def add_subcommand(
617616
name = name or cmd.__name__
618617
name = name.lower()
619618
description = description or getdoc(cmd)
620-
guild_ids = guild_ids if guild_ids else []
621-
if not all(isinstance(item, int) for item in guild_ids) and guild_ids is not []:
619+
if guild_ids and not all(isinstance(item, int) for item in guild_ids):
622620
raise error.IncorrectGuildIDType(
623621
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."
624622
)

0 commit comments

Comments
 (0)