Skip to content

How to create messages with reply buttons #1450

Answered by dcdunkan
atTheShikhar asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, there is a lot of examples of Inline Keyboard (That's what they named it 😁).

See from Line 61 to Line 125 of the ./docs/examples/keyboard-bot.js

They should help you. Those uses Markup class. But, you can either do it in the raw method:

For example,

bot.command("inline", (ctx) => {
    ctx.reply("Hi there!", {
        reply_markup: {
            inline_keyboard: [
                /* Inline buttons. 2 side-by-side */
                [ { text: "Button 1", callback_data: "btn-1" }, { text: "Button 2", callback_data: "btn-2" } ],

                /* One button */
                [ { text: "Next", callback_data: "next" } ],
                
                /* Also, we can have URL buttons. */

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@SpiffGreen
Comment options

@albertogparrado
Comment options

@nimafam
Comment options

@h3li0p4us3
Comment options

@ndhet
Comment options

Answer selected by atTheShikhar
Comment options

You must be logged in to vote
1 reply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants