Skip to content

Commit

Permalink
hotfix for logic missed in Pycord-Development#1065 when optional para…
Browse files Browse the repository at this point in the history
…meters are omitted
  • Loading branch information
krittick committed Apr 19, 2022
1 parent 96925fe commit a3a18d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion discord/ui/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(
row: Optional[int] = None,
):
super().__init__()
if len(label) > 80:
if label and len(label) > 80:
raise ValueError("label must be 80 characters or fewer")
if custom_id is not None and len(custom_id) > 100:
raise ValueError("custom_id must be 100 characters or fewer")
Expand Down
8 changes: 4 additions & 4 deletions discord/ui/input_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def __init__(
super().__init__()
if len(label) > 45:
raise ValueError("label must be 45 characters or fewer")
if min_length < 0 or min_length > 4000:
if min_length and (min_length < 0 or min_length > 4000):
raise ValueError("min_length must be between 0 and 4000")
if max_length < 0 or max_length > 4000:
if max_length and (max_length < 0 or max_length > 4000):
raise ValueError("max_length must be between 1 and 4000")
if len(value) > 4000:
if value and len(value) > 4000:
raise ValueError("value must be 4000 characters or fewer")
if len(placeholder) > 100:
if placeholder and len(placeholder) > 100:
raise ValueError("placeholder must be 100 characters or fewer")
if not isinstance(custom_id, str) and custom_id is not None:
raise TypeError(f"expected custom_id to be str, not {custom_id.__class__.__name__}")
Expand Down
2 changes: 1 addition & 1 deletion discord/ui/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(
raise ValueError("min_values must be between 0 and 25")
if max_values < 1 or max_values > 25:
raise ValueError("max_values must be between 1 and 25")
if len(placeholder) > 150:
if placeholder and len(placeholder) > 150:
raise ValueError("placeholder must be 150 characters or fewer")
if not isinstance(custom_id, str) and custom_id is not None:
raise TypeError(f"expected custom_id to be str, not {custom_id.__class__.__name__}")
Expand Down

0 comments on commit a3a18d7

Please sign in to comment.