How to use the telegraf/markup.inlineKeyboard 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
site.logger.info(`Loaded`, { route: `${req.originalUrl}` });
});


// bot.telegram.setWebhook('https://localhost:3443/api/sense-bot/telegram/adhoc/')
/*************
 * MAIN
 *************/
bot.use(session());
bot.start((ctx) => ctx.reply(config.text[lang].welcome));

/*************
 * SALESFORCE
 *************/
// BUTTONS
const keyboardSalesforce = Markup.inlineKeyboard([
	Markup.urlButton(config.text[lang].viewDemo, 'https://webapps.qlik.com/salesforce/index.html'),
	Markup.callbackButton(config.text[lang].salesforce.dashboard.button, 'salesforceDashboard'),
	Markup.callbackButton(config.text[lang].salesforce.opportunities.button, 'salesforceOpportunities')
	// Markup.callbackButton('Chart', 'salesforceChart')
]);
// COMMANDS - ACTIONS
bot.command('salesforce', (ctx) => {
	try {
		site.logger.info(`salesforce-main`, { route: `api/sense-bot/telegram` });
		ctx.reply(config.text[lang].salesforce.welcome);
		ctx.replyWithPhoto({ url: 'https://webapps.qlik.com/img/2017_salesforce.png' });
		ctx.telegram.sendCopy(ctx.from.id, ctx.message, Extra.markup(keyboardSalesforce));
	}
	catch (error) {
		site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::salesforce()` });
	}
github qlik-bots / QlikBotNode / app / server / routes / api / sense-bot / telegram.js View on Github external
${config.text[lang].cio.customer.kpi7}: <b>${result[5][0].qText}</b>
		${config.text[lang].cio.customer.kpi8}: <b>${result[6][0].qText}</b>
			`, Extra.markup(keyboardCio));
			})
			.catch(error =&gt; ctx.reply(`Error: ${error}`));
	}
	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) =&gt; {
	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));
github telegram-ru / ru-bot / src / features / spam-hammer / keyboards.js View on Github external
function keyboardUnspamUser({ banned }) {
  return Markup.inlineKeyboard([
    Markup.callbackButton(text.spamHammer.actionUnspam(), `${actUnspamUser} ${banned.id}`),
  ])
}
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}`),
  ])
}
github N3TC4T / xrp-telegram-bot / handlers / scenes / wallet_notify.js View on Github external
const user = await userModel.getUser(ctx);
                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 TrueGrom / gitlab_helper_bot / bot_handlers / scenes.js View on Github external
async function selectGitlabMember(ctx) {
  try {
    const members = await Member.getNotAttached();
    if (members.length) {
      return ctx.reply(
        "GITLAB users:",
        Markup.inlineKeyboard(
          [...members.map(member => Markup.callbackButton(member.username, `attach_${member.username}`))],
          { columns: 3 }
        ).extra()
      );
    }
    return ctx.reply("All users already attached");
  } catch (e) {
    logger.error(e);
    ctx.scene.leave();
    return ctx.reportError(e);
  }
}
github telegraf / telegraf / docs / examples / echo-bot.js View on Github external
const Telegraf = require('telegraf')
const Extra = require('telegraf/extra')
const Markup = require('telegraf/markup')

const keyboard = Markup.inlineKeyboard([
  Markup.urlButton('❤️', 'http://telegraf.js.org'),
  Markup.callbackButton('Delete', 'delete')
])

const bot = new Telegraf(process.env.BOT_TOKEN)
bot.start((ctx) => ctx.reply('Hello'))
bot.help((ctx) => ctx.reply('Help message'))
bot.on('message', (ctx) => ctx.telegram.sendCopy(ctx.chat.id, ctx.message, Extra.markup(keyboard)))
bot.action('delete', ({ deleteMessage }) => deleteMessage())
bot.launch()
github LyoSU / LyAdminBot / handlers / quote.js View on Github external
module.exports = async (ctx) => {
  const quoteBot = await ctx.getChatMember(1031952739)
  if (!['member', 'administrator'].includes(quoteBot.status)) {
    ctx.replyWithHTML(ctx.i18n.t('cmd.quote'), {
      reply_to_message_id: ctx.message.message_id,
      reply_markup: Markup.inlineKeyboard([
        Markup.urlButton(
          ctx.i18n.t('private.btn_add'),
          `https://t.me/QuotLyBot?startgroup=add`
        )
      ])
    })
  }
}