Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()` });
}
${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}`));
}
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));
function keyboardUnspamUser({ banned }) {
return Markup.inlineKeyboard([
Markup.callbackButton(text.spamHammer.actionUnspam(), `${actUnspamUser} ${banned.id}`),
])
}
function keyboardUnspamUserConfirm({ banned }) {
return Markup.inlineKeyboard([
Markup.callbackButton(text.spamHammer.actionUnspam(), `${actUnspamUserOk} ${banned.id}`),
Markup.callbackButton(text.common.actionCancel(), `${actUnspamUserNo} ${banned.id}`),
])
}
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();
}),
);
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);
}
}
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()
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`
)
])
})
}
}