-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
37 lines (30 loc) · 744 Bytes
/
Copy pathexample.py
File metadata and controls
37 lines (30 loc) · 744 Bytes
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
from telegramenu import Client, Menu, CallbackAction
class Action(CallbackAction):
title = 'this has no text/buttons'
class SubMenu1(Menu):
def __init__(self,arg):
self.title = 'Record number {}'.format(arg)
keyboard = [
[Action()]
]
class SubMenu2(Menu):
title = 'Sub 2'
def on_click(self, cb):
raise Exception('sample exception')
class MainMenu(Menu):
title = 'Main Menu'
text = 'Welcome to Main Menu'
keyboard = [
[SubMenu1(3)],
[SubMenu2()]
]
token = 'token'
bot = Client('example',bot_token=token)
@bot.on_message()
def _hello(_,msg):
menu = MainMenu()
msg.reply(
menu.text,
reply_markup=menu.get_reply_markup()
)
bot.run()