randydev commited on
Commit
f302594
1 Parent(s): 081f65e

Update chatbot/plugins/keyboards.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/keyboards.py +27 -26
chatbot/plugins/keyboards.py CHANGED
@@ -1,33 +1,34 @@
1
  from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
2
  from chatbot.plugins.languages import LANGUAGES
3
 
4
- def get_language_keyboard(buttons_per_row=2):
5
- """
6
- Generates an InlineKeyboardMarkup for language selection.
7
-
8
- :param buttons_per_row: Number of language buttons per row.
9
- :return: InlineKeyboardMarkup object.
10
- """
11
  keyboard = []
12
- buttons = []
13
 
14
- for index, lang in enumerate(LANGUAGES, start=1):
15
- buttons.append(
16
- InlineKeyboardButton(
17
- text=lang['name'],
18
- callback_data=f"lang_{lang['code']}"
19
- )
20
- )
21
-
22
- if index % buttons_per_row == 0:
23
- keyboard.append(buttons)
24
- buttons = []
25
-
26
- # Append any remaining buttons
27
- if buttons:
28
- keyboard.append(buttons)
29
-
30
- # Add the Cancel button on a new row
31
- keyboard.append([InlineKeyboardButton("Cancel", callback_data="cancel")])
 
 
 
 
 
 
 
 
32
 
33
  return InlineKeyboardMarkup(keyboard)
 
1
  from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
2
  from chatbot.plugins.languages import LANGUAGES
3
 
4
+ def get_language_keyboard():
 
 
 
 
 
 
5
  keyboard = []
 
6
 
7
+ # Row 1: English, Indonesian
8
+ keyboard.append([
9
+ InlineKeyboardButton("English", callback_data="lang_en"),
10
+ InlineKeyboardButton("Indonesian", callback_data="lang_id")
11
+ ])
12
+
13
+ # Row 2: Spanish
14
+ keyboard.append([
15
+ InlineKeyboardButton("Spanish", callback_data="lang_es")
16
+ ])
17
+
18
+ # Row 3: French, German, Japanese
19
+ keyboard.append([
20
+ InlineKeyboardButton("French", callback_data="lang_fr"),
21
+ InlineKeyboardButton("German", callback_data="lang_de"),
22
+ InlineKeyboardButton("Japanese", callback_data="lang_jp")
23
+ ])
24
+
25
+ keyboard.append([
26
+ InlineKeyboardButton("Malagasy", callback_data="lang_mg"),
27
+ InlineKeyboardButton("Russian", callback_data="lang_ru"),
28
+ InlineKeyboardButton("Hindi", callback_data="lang_hi"),
29
+ ])
30
+ keyboard.append([
31
+ InlineKeyboardButton("Cancel", callback_data="cancel")
32
+ ])
33
 
34
  return InlineKeyboardMarkup(keyboard)