Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bot.command('edit_media', (ctx) => ctx.replyWithAnimation(AnimationUrl1, Extra.markup((m) =>
m.inlineKeyboard([
m.callbackButton('Change media', 'swap_media')
])
)))
bot.command('cio', (ctx) => {
try {
site.logger.info(`cio-main`, { route: `api/sense-bot/telegram` });
ctx.reply(config.text[lang].cio.welcome);
ctx.replyWithPhoto({ url: 'https://sense-demo-staging.qlik.com/appcontent/d0dd198f-138b-41d8-a099-5c5071bd6b33/CIO-desktop-development.jpg' });
ctx.telegram.sendCopy(ctx.from.id, ctx.message, Extra.markup(keyboardCio));
}
catch (error) {
site.logger.info(`error: ${error}`, { route: `api/sense-bot/telegram::cio()` });
}
});
bot.action('cioManagement', (ctx) => {
.then(result => {
ctx.replyWithHTML(`
<b>${config.text[lang].cio.customer.title}</b>
${config.text[lang].cio.customer.kpi1}: <b>${result[0][0].qText}</b>
${config.text[lang].cio.customer.kpi2}: <b>3.75</b>
${config.text[lang].cio.customer.kpi3}: <b>${result[1][0].qText}</b>
${config.text[lang].cio.customer.kpi4}: <b>${result[2][0].qText}</b>
${config.text[lang].cio.customer.kpi5}: <b>${result[3][0].qText}</b>
${config.text[lang].cio.customer.kpi6}: <b>${result[4][0].qText}</b>
${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 => ctx.reply(`Error: ${error}`));
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()` });
}
});
bot.action('salesforceChart', (ctx) => {
function hide() {
const replyMarkup = Markup.removeKeyboard();
return Extra.markup(replyMarkup);
}
bot.command('special', (ctx) => {
return ctx.reply('Special buttons keyboard', Extra.markup((markup) => {
return markup.resize()
.keyboard([
markup.contactRequestButton('Send contact'),
markup.locationRequestButton('Send location')
])
}))
})
bot.on('message', (ctx) => ctx.telegram.sendCopy(ctx.chat.id, ctx.message, Extra.markup(keyboard)))
bot.action('delete', ({ deleteMessage }) => deleteMessage())
bot.command('pyramid', (ctx) => {
return ctx.reply('Keyboard wrap', Extra.markup(
Markup.keyboard(['one', 'two', 'three', 'four', 'five', 'six'], {
wrap: (btn, index, currentRow) => currentRow.length >= (index + 1) / 2
})
))
})
bot.command('simple', (ctx) => {
return ctx.replyWithHTML('<b>Coke</b> or <i>Pepsi?</i>', Extra.markup(
Markup.keyboard(['Coke', 'Pepsi'])
))
})
.then(result => {
ctx.replyWithHTML(`
<b>${config.text[lang].salesforce.opportunities.title}</b>
${config.text[lang].salesforce.opportunities.kpi1}: <b>${result[0][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi2}: <b>${result[1][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi3}: <b>${result[2][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi4}: <b>${result[3][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi5}: <b>${result[4][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi6}: <b>${result[5][0].qText}</b>
${config.text[lang].salesforce.opportunities.kpi7}: <b>${result[6][0].qText}</b>
`, Extra.markup(keyboardSalesforce));
})
.catch(error => ctx.reply(`Error: ${error}`));