-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.py
42 lines (34 loc) · 1.21 KB
/
buttons.py
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
import pyrogram
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
def cb(l:list = ["text", "data", "url", "login_url", "switch_inline_query, switch_inline_query_current_chat"]):
text = l[0] if len(l) >= 1 else "No Text"
data = l[1] if len(l) >= 2 else "nope"
url = l[2] if len(l) >= 3 else None
login_url = l[3] if len(l) >= 4 else None
switch_inline_query = l[4] if len(l) >= 5 else None
switch_inline_query_current_chat = l[5] if len(l) >= 6 else None
return InlineKeyboardButton(text, data, url, login_url, switch_inline_query, switch_inline_query_current_chat)
def create_markup(_list: list=[[]]):
result = []
for row in _list:
result.append([])
for item in row:
btn = cb(item)
result[-1].append(btn)
return InlineKeyboardMarkup(result)
r_home_btn = ["🏠 Home", "home"]
r_help_btn = ["🙂 Help", "help"]
r_ourc_btn = ["💝 Our Channel", None, "https://telegram.me/bots_universe"]
r_rohith = ["@Rohithaditya", None, "t.me/Rohithaditya"]
main_markup = create_markup([
[r_help_btn],
[r_ourc_btn],
[r_home_btn]
])
help_text = """\
Edit tesxt
```
"""
help_markup = create_markup([
[r_home_btn]
])