Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Create a inline keyboard
Error: TypeError: Markup.callbackButton is not a function
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Please provide detailed steps for reproducing the issue.
My code:
const env = require('../.env');
const Telegraf = require('telegraf');
const Extra = require('telegraf/extra');
const Markup = require('telegraf');
const bot = new Telegraf(env.token);
let contagem = 0;
const botoes = Extra.markup(Markup.inlineKeyboard([
Markup.callbackButton('+1', 'add 1'),
Markup.callbackButton('+10', 'add 10'),
Markup.callbackButton('+100', 'add 100'),
Markup.callbackButton('-1', 'sub 1'),
Markup.callbackButton('-10', 'sub 10'),
Markup.callbackButton('-100', 'sub 100'),
Markup.callbackButton('Zerar', 'reset'),
Markup.callbackButton('Resultado', 'result')
], { columns: 3 }));
bot.start(async ctx => {
const nome = ctx.message.from.first_name;
await ctx.reply(`Seja bem vindo, ${nome}`);
await ctx.reply(`A contagem atual est谩 em ${contagem}`, botoes);
});
bot.action(/add (\d+)/gi, ctx => {
contagem += parseInt(ctx.match[1]);
ctx.reply(`A contagem atual est谩 em ${contagem}`, botoes);
});
bot.action(/sub (\d+)/gi, ctx => {
contagem -= parseInt(ctx.match[1]);
ctx.reply(`A vontagem atual est谩 em ${contagem}`, botoes);
});
bot.action('reset', ctx => {
contagem = 0;
ctx.reply(`A vontagem atual est谩 em ${contagem}`, botoes);
});
bot.action('result', ctx => {
ctx.answerCbQuery(`A contagem atual est谩 em ${contagem}`);
});
bot.launch();
This feature "Markup.callbackButton" is not supported anymore?
My bad. Just found what was missing. Sry about that. Admins, you guys can delete this stupid one. Sry.
Having the same isue. What was the solution @jwandekoken ?
Having the same isue. What was the solution @jwandekoken ?
//create inline keyboard
Markup.inlineKeyboard([
Markup.button.callback("馃憤", "like"),
Markup.button.callback("馃憥", "dislike"),
])
//catch callback
bot.action(/.+/, ctx => {
return ctx.answerCbQuery(Oh, ${ctx.match[0]}! Great choice);
});
Most helpful comment
//create inline keyboard
Markup.inlineKeyboard([
Markup.button.callback("馃憤", "like"),
Markup.button.callback("馃憥", "dislike"),
])
//catch callback
bot.action(/.+/, ctx => {
return ctx.answerCbQuery(
Oh, ${ctx.match[0]}! Great choice);});