Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
289d1f6
1
Parent(s):
76bcefe
Update kbhelpers.py
Browse files- Powers/utils/kbhelpers.py +14 -7
Powers/utils/kbhelpers.py
CHANGED
|
@@ -13,18 +13,25 @@ def ikb(rows=None, back=False, todo="start_back"):
|
|
| 13 |
try:
|
| 14 |
for row in rows:
|
| 15 |
line = []
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
line = []
|
| 23 |
for button in rows:
|
| 24 |
button = btn(*button) # InlineKeyboardButton
|
| 25 |
line.append(button)
|
| 26 |
lines.append(line)
|
| 27 |
-
if back:
|
| 28 |
back_btn = [(btn("« Back", todo))]
|
| 29 |
lines.append(back_btn)
|
| 30 |
return InlineKeyboardMarkup(inline_keyboard=lines)
|
|
|
|
| 13 |
try:
|
| 14 |
for row in rows:
|
| 15 |
line = []
|
| 16 |
+
try:
|
| 17 |
+
for button in row:
|
| 18 |
+
btn_text = button.split(".")[1].upper()
|
| 19 |
+
button = btn(btn_text, button) # InlineKeyboardButton
|
| 20 |
+
line.append(button)
|
| 21 |
+
lines.append(line)
|
| 22 |
+
except AttributeError:
|
| 23 |
+
for button in rows:
|
| 24 |
+
button = btn(*button) # Will make the kb which don't have "." in them
|
| 25 |
+
line.append(button)
|
| 26 |
+
lines.append(line)
|
| 27 |
+
except TypeError:
|
| 28 |
+
# make a code to handel that error
|
| 29 |
line = []
|
| 30 |
for button in rows:
|
| 31 |
button = btn(*button) # InlineKeyboardButton
|
| 32 |
line.append(button)
|
| 33 |
lines.append(line)
|
| 34 |
+
if back:
|
| 35 |
back_btn = [(btn("« Back", todo))]
|
| 36 |
lines.append(back_btn)
|
| 37 |
return InlineKeyboardMarkup(inline_keyboard=lines)
|