diff options
author | VitaliyS <vitaliys@hetleven.(none)> | 2017-07-24 13:25:26 +0300 |
---|---|---|
committer | VitaliyS <vitaliys@hetleven.(none)> | 2017-07-24 13:25:26 +0300 |
commit | 088e7427f6d7d72eb38d57f0a88bdc6f3b2b1c55 (patch) | |
tree | 54a9982837ce18ac4bcaf582c1d4d4f10968a545 | |
parent | 0291d69fe5ef0b8549649206d2eaf84296c5aa9b (diff) |
add: keyboard in messages
-rw-r--r-- | kernel.py | 4 | ||||
-rw-r--r-- | plugins/oboobs.py | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -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)
|