Keyboard types, building keyboard
You can add keyboard to the chat or to the message using Keyboard class
Last updated
You can add keyboard to the chat or to the message using Keyboard class
Last updated
The keyboard underTheChat is the keyboard you can always see. You can scroll up, but this keyboard won't be removed. The user can only hide it with the button next to the input, or you can remove it in code using the removeUnderTheChat keyboard type. This type of keyboards, when pressed, simply sends a message from the user
The keyboard underTheMessage is a keyboard under the message, with some buttons that you can click to perform some actions in the code.
You can create a keyboard using Keyboard class and pass keyboard type as constructor argument using KeyboardTypes enum. Then you can add buttons to the keyboard using button type as method name (e.g. text, btn, url. You can see list of supported button types below). Then, if you want to add a new row, call .row method and continue creating new buttons. In some buttons you can pass "hidden" argument as the last, and if it will be true, button will be hide. You can do this in .row method too.
You can set the placeholder for the underTheChat keyboard using the .setPlaceholder method
You can add keyboard once (one time keyboard) using .oneTime method
text
underTheChat
text: string, hidden?: boolean
btn
underTheMessage
text: string, buttonId: string, hidden?: boolean
url
underTheMessage
text: string, url: string, hidden?: boolean
contact
underTheChat
text: string, hidden?: boolean
location
underTheChat
text: string, hidden?: boolean
switch
underTheMessage
text: string, switchQueryId: string, hidden?: boolean
pay
underTheMessage
text: string
webApp
underTheMessage, underTheChat
text: string, url: string, hidden?: boolean
If you want to handle when user clicks on underTheMessage keyboard button, you can use @OnClick
decorator for method and pass button id to it. More about this here