Skip to content

Commit f4cb20d

Browse files
committed
Ensure guild_ids is never None.
1 parent 875e6fa commit f4cb20d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

discord_slash/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ def add_slash_command(
535535
"""
536536
name = name or cmd.__name__
537537
name = name.lower()
538-
if guild_ids and not all(isinstance(item, int) for item in guild_ids):
538+
guild_ids = guild_ids if guild_ids else []
539+
if not all(isinstance(item, int) for item in guild_ids):
539540
raise error.IncorrectGuildIDType(
540541
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."
541542
)
@@ -616,7 +617,8 @@ def add_subcommand(
616617
name = name or cmd.__name__
617618
name = name.lower()
618619
description = description or getdoc(cmd)
619-
if guild_ids and not all(isinstance(item, int) for item in guild_ids):
620+
guild_ids = guild_ids if guild_ids else []
621+
if not all(isinstance(item, int) for item in guild_ids):
620622
raise error.IncorrectGuildIDType(
621623
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."
622624
)

0 commit comments

Comments
 (0)