1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

changed markup.add row from hardcoded index to *row

This commit is contained in:
zeph1997 2021-12-11 02:28:19 +08:00
parent e76649bb49
commit 5a06d8021b

View File

@ -12,31 +12,31 @@ def keyboard(key_type="Normal"):
markup = ReplyKeyboardMarkup(row_width=10) markup = ReplyKeyboardMarkup(row_width=10)
if key_type == "Normal": if key_type == "Normal":
row = [KeyboardButton(x) for x in keys[:10]] row = [KeyboardButton(x) for x in keys[:10]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x) for x in keys[10:20]] row = [KeyboardButton(x) for x in keys[10:20]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x) for x in keys[20:29]] row = [KeyboardButton(x) for x in keys[20:29]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8]) markup.add(*row)
row = [KeyboardButton(x) for x in keys[29:]] row = [KeyboardButton(x) for x in keys[29:]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6]) markup.add(*row)
markup.add(KeyboardButton("Caps Lock"),KeyboardButton("Symbols"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done")) markup.add(KeyboardButton("Caps Lock"),KeyboardButton("Symbols"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done"))
elif key_type == "Symbols": elif key_type == "Symbols":
row = [KeyboardButton(x) for x in symbols[:10]] row = [KeyboardButton(x) for x in symbols[:10]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x) for x in symbols[10:20]] row = [KeyboardButton(x) for x in symbols[10:20]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x) for x in symbols[20:]] row = [KeyboardButton(x) for x in symbols[20:]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7]) markup.add(*row)
markup.add(KeyboardButton("Caps Lock"),KeyboardButton("Normal"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done")) markup.add(KeyboardButton("Caps Lock"),KeyboardButton("Normal"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done"))
else: else:
row = [KeyboardButton(x.upper()) for x in keys[:10]] row = [KeyboardButton(x.upper()) for x in keys[:10]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x.upper()) for x in keys[10:20]] row = [KeyboardButton(x.upper()) for x in keys[10:20]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) markup.add(*row)
row = [KeyboardButton(x.upper()) for x in keys[20:29]] row = [KeyboardButton(x.upper()) for x in keys[20:29]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8]) markup.add(*row)
row = [KeyboardButton(x.upper()) for x in keys[29:]] row = [KeyboardButton(x.upper()) for x in keys[29:]]
markup.add(row[0],row[1],row[2],row[3],row[4],row[5],row[6]) markup.add(*row)
markup.add(KeyboardButton("Normal"),KeyboardButton("Symbols"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done")) markup.add(KeyboardButton("Normal"),KeyboardButton("Symbols"),KeyboardButton("🔙Delete"),KeyboardButton("✅Done"))
return markup return markup