From c30dbcc6f81f8c2e27ffab2f77407975f2f5f0ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=83=D1=80=20=D0=A1=D0=B0=D0=B3=D0=B0?=
=?UTF-8?q?=D0=B4=D0=B0=D0=B2?= <42406802+sagadav@users.noreply.github.com>
Date: Tue, 14 Apr 2020 13:19:07 +0500
Subject: [PATCH] Update README.md
Inline-keyboard
---
README.md | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 947e206..22f9cc7 100644
--- a/README.md
+++ b/README.md
@@ -219,8 +219,30 @@ And if you wanted to get user profile pictures you can use [getUserProfilePhotos
### Inline Keybords
-This section is under construction...
-
+You can use the inline keyboard in the following way:
+```js
+var keyboard = {
+ reply_markup: JSON.stringify({
+ inline_keyboard: [
+ [{ text: 'Button 1', callback_data: '1' }],
+ [{ text: 'Button 2', callback_data: 'data 2' }],
+ [{ text: 'Button 3', callback_data: 'data 3' }]
+ ]
+ })
+};
+
+bot.onText(/\/start/, function (msg) {
+ bot.sendMessage(msg.chat.id, "Text", keyboard);
+});
+```
+To process a button click use callback_query:
+```js
+bot.on('callback_query', function (msg) {
+ if(msg.data == "1") {
+ bot.sendMessage(msg.from.id, "You clicked on Button 1");
+ }
+});
+```
### parse_mode
If you want to send messages with some style there, here is how it goes. parse_mode defines how you want you message to be rendered.You can define it inside in your options when sending message.