Skip to content

Commit f168ea3

Browse files
committed
refactor: fix typo + add code/result tabs
1 parent 9ba290d commit f168ea3

1 file changed

Lines changed: 54 additions & 3 deletions

File tree

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1+
import Tabs from '@theme/Tabs';
2+
import TabItem from '@theme/TabItem';
3+
14
# Keyboards
25

36
Nutgram provides a better way to create keyboards.
47

58
## Inline Keyboard
69

7-
The `InlineKeyboard` class helps you to create inline keyboards.
10+
The `InlineKeyboardMarkup` class helps you to create inline keyboards.
811
Here is an example:
912

13+
<Tabs>
14+
<TabItem value="code" label="Code" default>
15+
1016
```php
1117
$bot->onCommand('start', function(Nutgram $bot){
1218
$bot->sendMessage(
1319
text: 'Welcome!',
1420
reply_markup: InlineKeyboardMarkup::make()
1521
->addRow(
16-
InlineKeyboardButton::make('A', callback_data: 'type:a'),
22+
InlineKeyboardButton::make('A', callback_data: 'type:a'),
1723
InlineKeyboardButton::make('B', callback_data: 'type:b')
1824
)
1925
);
@@ -32,15 +38,27 @@ $bot->onCallbackQueryData('type:b', function(Nutgram $bot){
3238
});
3339
```
3440

41+
</TabItem>
42+
43+
<TabItem value="result" label="Result">
44+
45+
![img](https://i.imgur.com/TC8RLoq.png)
46+
47+
</TabItem>
48+
</Tabs>
49+
3550
:::info
3651
To handle inline keyboard callbacks as a Menu, you can check the [Inline Menu](/docs/usage/inline_menu) section.
3752
:::
3853

3954
## Reply Keyboard
4055

41-
The `ReplyKeyboard` class helps you to create reply keyboards.
56+
The `ReplyKeyboardMarkup` class helps you to create reply keyboards.
4257
Here is an example:
4358

59+
<Tabs>
60+
<TabItem value="code" label="Code" default>
61+
4462
```php
4563
$bot->onCommand('start', function(Nutgram $bot){
4664
$bot->sendMessage(
@@ -61,6 +79,15 @@ $bot->onText('Give me animal!', function (Nutgram $bot) {
6179
});
6280
```
6381

82+
</TabItem>
83+
84+
<TabItem value="result" label="Result">
85+
86+
![img](https://i.imgur.com/3BZ9W8J.png)
87+
88+
</TabItem>
89+
</Tabs>
90+
6491
### Optional keyboard parameters
6592

6693
You can pass optional parameters to the `ReplyKeyboardMarkup` class:
@@ -80,6 +107,9 @@ Check the [Telegram API documentation](https://core.telegram.org/bots/api#replyk
80107

81108
To remove the reply keyboard, you can use the `ReplyKeyboardRemove` class:
82109

110+
<Tabs>
111+
<TabItem value="code" label="Code" default>
112+
83113
```php
84114
$bot->onCommand('cancel', function (Nutgram $bot) {
85115
$bot->sendMessage(
@@ -89,11 +119,23 @@ $bot->onCommand('cancel', function (Nutgram $bot) {
89119
});
90120
```
91121

122+
</TabItem>
123+
124+
<TabItem value="result" label="Result">
125+
126+
![img](https://i.imgur.com/cB2xQXv.gif)
127+
128+
</TabItem>
129+
</Tabs>
130+
92131
## Force Reply
93132

94133
The `ForceReply` class helps you to force the user to reply to a message.
95134
Here is an example:
96135

136+
<Tabs>
137+
<TabItem value="code" label="Code" default>
138+
97139
```php
98140
$bot->onCommand('start', function(Nutgram $bot){
99141
$bot->sendMessage(
@@ -106,3 +148,12 @@ $bot->onCommand('start', function(Nutgram $bot){
106148
);
107149
});
108150
```
151+
152+
</TabItem>
153+
154+
<TabItem value="result" label="Result">
155+
156+
![img](https://i.imgur.com/0ZoAu2l.png)
157+
158+
</TabItem>
159+
</Tabs>

0 commit comments

Comments
 (0)