Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/vi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliyS <vitaliys@hetleven.(none)>2017-07-24 13:25:26 +0300
committerVitaliyS <vitaliys@hetleven.(none)>2017-07-24 13:25:26 +0300
commit088e7427f6d7d72eb38d57f0a88bdc6f3b2b1c55 (patch)
tree54a9982837ce18ac4bcaf582c1d4d4f10968a545
parent0291d69fe5ef0b8549649206d2eaf84296c5aa9b (diff)
add: keyboard in messages
-rw-r--r--kernel.py4
-rw-r--r--plugins/oboobs.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/kernel.py b/kernel.py
index b06609e..866380f 100644
--- a/kernel.py
+++ b/kernel.py
@@ -579,6 +579,10 @@ def check_updates():
if msg_in.has_key('edited_message'):
msg_in['message'] = msg_in['edited_message']
pprint('*** Edited message!', 'yellow')
+ elif msg_in.has_key('callback_query'):
+ msg_in['message'] = msg_in['callback_query']['message']
+ msg_in['message']['text'] = msg_in['callback_query']['data']
+ pprint('*** Callback query!', 'yellow')
#send_msg(msg_in, '<i>Edited messages not supported now!</i>')
diff --git a/plugins/oboobs.py b/plugins/oboobs.py
index 7cc5ea3..9ab81bf 100644
--- a/plugins/oboobs.py
+++ b/plugins/oboobs.py
@@ -25,7 +25,8 @@ def cmd_oboobs(raw_in):
try:
data = json.loads(load_page('http://api.oboobs.ru/noise/1/'))[0]
photo_url = "http://media.oboobs.ru/%s" % data['preview']
- send_photo(raw_in, photo_url, {'caption': 'Another one - /oboobs'})
+ kbd = {"inline_keyboard": [[{'text': 'Another one', 'callback_data': 'oboobs'}]]}
+ send_photo(raw_in, photo_url, custom={'reply_markup': json.dumps(kbd)})
except:
msg = 'Error!'
send_msg(raw_in, msg)
@@ -34,7 +35,8 @@ def cmd_obutts(raw_in):
try:
data = json.loads(load_page('http://api.obutts.ru/noise/1/'))[0]
photo_url = "http://media.obutts.ru/%s" % data['preview']
- send_photo(raw_in, photo_url, {'caption': 'Another one - /obutts'})
+ kbd = {"inline_keyboard": [[{'text': 'Another one', 'callback_data': 'obutts'}]]}
+ send_photo(raw_in, photo_url, custom={'reply_markup': json.dumps(kbd)})
except:
msg = 'Error!'
send_msg(raw_in, msg)