Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

246
Visualizações
Telegraft (Javascript) : How do I return the function in telegram keyboard or inline keyboard?

I want to return a function I tried replacing the "Yes" It doesn't work, when I look at the function itself, it only accepts string,

thus I'm puzzled, because if I use bot.hear in telegraf, any person who says yes, will activate the command.

is there anyway to call a function ?

 bot.command("report", (ctx) => {
            ctx.reply("Are you sure? using this will have a refresh timeout of 2 minutes.", {
                reply_markup: {
                    keyboard: [
                        /* Inline buttons. 2 side-by-side */
                        [{ text: "Yes", callback_data: test() }, { text: "No", callback_data: "No" }],

                        /* One button */
                        [{ text: "Next", callback_data: "next" }],

                        /* Also, we can have URL buttons. */
                        [{ text: "Open in browser", url: "telegraf.js.org" }]
                    ]
                }
            });

        });
    const test = () => {
       console.log("test")
    }

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda