How to use the telegraf/markup.callbackButton function in telegraf

To help you get started, we’ve selected a few telegraf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qlik-bots / QlikBotNode / app / server / routes / api / sense-bot / telegram.js View on Github external
catch (error) {
		site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::cioCustomerService()` });
	}
});

/***************
 * HELPDESK
 **************/
// BUTTONS
const keyboardHelpdesk = Markup.inlineKeyboard([
	[
		Markup.urlButton('View Demo', 'https://demos.qlik.com/qliksense/HelpdeskManagement'),
		Markup.callbackButton(config.text[lang].helpdesk.highPriorityCases.button, 'helpdeskHighPriorityCases')
	],
	[
		Markup.callbackButton(config.text[lang].helpdesk.mediumPriorityCases.button, 'helpdeskMediumPriorityCases'),
		Markup.callbackButton(config.text[lang].helpdesk.lowPriorityCases.button, 'helpdeskLowPriorityCases')
	]
]);
// COMMANDS - ACTIONS
bot.command('helpdesk', (ctx) => {
	try {
		site.logger.info(`helpdesk-main`, { route: `api/sense-bot/telegram` });
		ctx.reply(config.text[lang].helpdesk.welcome);
		ctx.replyWithPhoto({ url: 'https://sense-demo-staging.qlik.com/appcontent/133dab5d-8f56-4d40-b3e0-a6b401391bde/helpdesk_management.jpg' });
		ctx.telegram.sendCopy(ctx.from.id, ctx.message, Extra.markup(keyboardHelpdesk));
	}
	catch (error) {
		site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::helpdesk()` });
	}
});
bot.action('helpdeskHighPriorityCases', (ctx) => {
github qlik-bots / QlikBotNode / app / server / routes / api / sense-bot / telegram.js View on Github external
})
			.catch(error => ctx.reply(`Error: ${error}`));
	}
	catch (error) {
		site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::helpdeskLowPriorityCases()` });
	}
});

/***************
 * LANGUAGE SELECTOR
 **************/
// BUTTONS
const keyboardLang = Markup.inlineKeyboard([
	[
		Markup.callbackButton(config.text.en.title, 'langEn'),
		Markup.callbackButton(config.text.el.title, 'langGr')
	]
]);
// COMMANDS - ACTIONS
bot.command('lang', (ctx) => {
	try {
		site.logger.info(`lang-main`, { route: `api/sense-bot/telegram` });
		ctx.reply("Select Language");
		ctx.telegram.sendCopy(ctx.from.id, ctx.message, Extra.markup(keyboardLang));
	}
	catch (error) {
		site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::lang()` });
	}
});
bot.action('langEn', (ctx) => {
	try {
		lang = 'en';
github telegraf / telegraf / docs / examples / keyboard-bot.js View on Github external
bot.command('random', (ctx) => {
  return ctx.reply('random example',
    Markup.inlineKeyboard([
      Markup.callbackButton('Coke', 'Coke'),
      Markup.callbackButton('Dr Pepper', 'Dr Pepper', Math.random() > 0.5),
      Markup.callbackButton('Pepsi', 'Pepsi')
    ]).extra()
  )
})
github N3TC4T / xrp-telegram-bot / handlers / scenes / feed_notify.js View on Github external
}

                if (isSubscribed) {
                    ctx.replyWithHTML(
                        `You already subscribed to this feed\n\nDo you want to unsubsribe to ${source.url} ?`,
                        Markup.inlineKeyboard([
                            Markup.callbackButton('Yes', 'confirm-unsubscribe-yes'),
                            Markup.callbackButton('No', 'confirm-unsubscribe-no'),
                        ]).extra(),
                    );
                } else {
                    ctx.replyWithHTML(
                        `You are not subscribe to this feed\n\nDo you want to subsribe to ${source.url} ?`,
                        Markup.inlineKeyboard([
                            Markup.callbackButton('Yes', 'confirm-subscribe-yes'),
                            Markup.callbackButton('No', 'confirm-subscribe-no'),
                        ]).extra(),
                    );
                }
                return ctx.wizard.next();
            }),
        );
github telegraf / telegraf / docs / examples / keyboard-bot.js View on Github external
bot.action('italic', (ctx) => {
  ctx.editMessageCaption('_Caption_', Extra.markdown().markup(Markup.inlineKeyboard([
    Markup.callbackButton('Plain', 'plain'),
    Markup.callbackButton('* Italic *', 'italic')
  ])))
})
github telegraf / telegraf / docs / examples / keyboard-bot.js View on Github external
bot.action('plain', async (ctx) => {
  ctx.editMessageCaption('Caption', Markup.inlineKeyboard([
    Markup.callbackButton('Plain', 'plain'),
    Markup.callbackButton('Italic', 'italic')
  ]))
})
github N3TC4T / xrp-telegram-bot / handlers / scenes / send.js View on Github external
ctx => {
                    const { state } = ctx.scene.session;
                    ctx.replyWithHTML(
                        `<b>CONFIRM</b>\n\nYou want to send <b>${state.amount} XRP</b> to <b>@${
                            state.username
                        }</b> is this correct?`,
                        Markup.inlineKeyboard([
                            Markup.callbackButton('Yes', 'confirm-send-yes'),
                            Markup.callbackButton('No', 'confirm-send-no'),
                        ]).extra(),
                    );
                    return ctx.wizard.next();
                },
                this.stepThree(),
github TrueGrom / gitlab_helper_bot / bot_handlers / scenes.js View on Github external
      Markup.inlineKeyboard([...groups.map(group => Markup.callbackButton(group.title, `deactivate_${group.id}`))], {
        columns: 3
github N3TC4T / xrp-telegram-bot / handlers / scenes / wallet_notify.js View on Github external
const wallet = await this.db.WalletNotify.findOne({
                    where: { address: text, for_user: user.id },
                });
                if (!wallet) {
                    return ctx.replyWithHTML('⚠️ Please select a wallet from list!', CANCEL_MENU);
                }

                //set wallet notify id
                ctx.scene.session.state.id = wallet.id;

                ctx.replyWithHTML(
                    `Are you sure you want to delete wallet address : <b>${
                        wallet.address
                    }</b> ?\n\nYou will not get any notify on this address anymore.`,
                    Markup.inlineKeyboard([
                        Markup.callbackButton('Yes', 'confirm-delete-wallet-yes'),
                        Markup.callbackButton('No', 'confirm-delete-wallet-no'),
                    ]).extra(),
                );

                ctx.wizard.next();
            }),
        );
github telegram-ru / ru-bot / src / features / spam-hammer / keyboards.js View on Github external
function keyboardUnspamUserConfirm({ banned }) {
  return Markup.inlineKeyboard([
    Markup.callbackButton(text.spamHammer.actionUnspam(), `${actUnspamUserOk} ${banned.id}`),
    Markup.callbackButton(text.common.actionCancel(), `${actUnspamUserNo} ${banned.id}`),
  ])
}