Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda