Skip to content

Commit 3d385ef

Browse files
committed
Fix Guild ID check (from 1.2.2, deleted from 2.0.x)
1 parent a7f468b commit 3d385ef

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

discord_slash/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,13 @@ def add_slash_command(
535535
"""
536536
name = name or cmd.__name__
537537
name = name.lower()
538+
539+
guild_ids = guild_ids or []
538540
if not all(isinstance(item, int) for item in guild_ids):
539541
raise error.IncorrectGuildIDType(
540-
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."
542+
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 or cmd.__name__}' will be deactivated and broken until fixed."
541543
)
544+
542545
if name in self.commands:
543546
tgt = self.commands[name]
544547
if not tgt.has_subcommands:
@@ -616,9 +619,10 @@ def add_subcommand(
616619
name = name or cmd.__name__
617620
name = name.lower()
618621
description = description or getdoc(cmd)
619-
if guild_ids and not all(isinstance(item, int) for item in guild_ids):
622+
guild_ids = guild_ids or []
623+
if not all(isinstance(item, int) for item in guild_ids):
620624
raise error.IncorrectGuildIDType(
621-
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."
625+
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 or cmd.__name__}' will be deactivated and broken until fixed."
622626
)
623627

624628
if base in self.commands:

0 commit comments

Comments
 (0)