Skip to content

Commit 8eb098d

Browse files
committed
refactor(helpers): remove validation for optional fields in inline button dict
- Comment out the validation logic for requiring exactly one optional field in inline button dictionaries - Simplify the handling of inline button dicts to allow more flexible configurations - Improve code maintainability by reducing strict constraints
1 parent 5e8b11e commit 8eb098d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pyrogram/helpers/helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def ikb(
6868
elif isinstance(button, dict):
6969
if "text" not in button:
7070
raise ValueError("Inline button dict must include 'text'")
71-
# Validate exactly one optional field
72-
opt_keys = [k for k in button.keys() if k != "text"]
73-
if len(opt_keys) != 1:
74-
raise ValueError("Inline button dict must include exactly one optional field")
71+
# # Validate exactly one optional field
72+
# opt_keys = [k for k in button.keys() if k != "text"]
73+
# if len(opt_keys) != 1:
74+
# raise ValueError("Inline button dict must include exactly one optional field")
7575
built = InlineKeyboardButton(**button)
7676
elif isinstance(button, tuple):
7777
if len(button) == 2:

0 commit comments

Comments
 (0)