Repository navigation
Expand file tree
/
Copy pathkeyboards.py
More file actions
81 lines (60 loc) · 2.86 KB
/
Copy pathkeyboards.py
File metadata and controls
81 lines (60 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from telegram_bot_pagination import InlineKeyboardPaginator
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from math import ceil
ITEM_PER_PAGE = 10
def get_account_keyboard(usernames, page, pool_name):
paginator = InlineKeyboardPaginator(
ceil(len(usernames) / ITEM_PER_PAGE),
data_pattern='user#{page}',
current_page=page
)
start_index = (page - 1) * ITEM_PER_PAGE
end_index = start_index + ITEM_PER_PAGE
for username in usernames[start_index:end_index]:
row = [
InlineKeyboardButton(username, callback_data=" "),
InlineKeyboardButton("Pause", callback_data=f"{username}!pause"),
InlineKeyboardButton("Resume", callback_data=f"{username}!resume"),
]
paginator.add_before(*row)
paginator.add_after(InlineKeyboardButton("⬅️ Back", callback_data=f"select_pool#{pool_name}"))
return paginator.markup
def get_main_keyboard():
return InlineKeyboardMarkup([
[InlineKeyboardButton("🐋 POOLS 🐋", callback_data="pool")],
[InlineKeyboardButton("⚙️ SETTINGS ⚙️", callback_data="settings")]
])
def get_pool_menu_keyboard(pools):
keyboard = []
pool_names = list(pools.keys())
for i in range(0, len(pool_names), 2):
row = [InlineKeyboardButton(pool_names[i], callback_data=f"select_pool#{pool_names[i]}")]
if i + 1 < len(pool_names):
row.append(InlineKeyboardButton(pool_names[i + 1], callback_data=f"select_pool#{pool_names[i + 1]}"))
keyboard.append(row)
keyboard.append([InlineKeyboardButton("⬅️ Back", callback_data="back")])
return InlineKeyboardMarkup(keyboard)
def get_settings_keyboard():
return InlineKeyboardMarkup([
[InlineKeyboardButton("Add Pool ➕", callback_data="add_pool")],
[InlineKeyboardButton("Remove Pool ➖", callback_data="remove_pool")],
[InlineKeyboardButton("Self destruction 💣", callback_data="self_destruct")],
[InlineKeyboardButton("⬅️ Back", callback_data="back")]
])
def get_confirm_remove_keyboard():
return InlineKeyboardMarkup([
[InlineKeyboardButton("YES ✅", callback_data="remove_pool_yes"),
InlineKeyboardButton("NO ❌", callback_data="remove_pool_no")],
])
def get_selected_pool_keyboard():
return InlineKeyboardMarkup([
[InlineKeyboardButton("Pause All Accounts ⏸", callback_data="pause")],
[InlineKeyboardButton("Resume All Accounts ▶", callback_data="resume")],
[InlineKeyboardButton("List All Accounts 🧾", callback_data="accounts")],
[InlineKeyboardButton("⬅️ Back", callback_data="pool")]
])
def get_self_destruct_keyboard():
return InlineKeyboardMarkup([
[InlineKeyboardButton("YES ✅", callback_data="self_destruct_yes"),
InlineKeyboardButton("NO ❌", callback_data="self_destruct_no")]
])