Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const actualParts = ctx.callbackQuery.data.split(':')
// Go up to the menu that shall be opened
while (actualParts.length > expectedPartCount) {
actualParts.pop()
}
const menuAction = actualParts.join(':')
actualActionCode = new ActionCode(menuAction).getString()
options.log('generate with actualActionCode', actualActionCode, actionCode.get(), ctx.callbackQuery.data)
} else {
actualActionCode = actionCode.getString()
}
const keyboardMarkup = await this.buttons.generateKeyboardMarkup(ctx, actualActionCode, options)
options.log('buttons', keyboardMarkup.inline_keyboard)
const extra = Extra.markdown().markup(keyboardMarkup) as Extra
return {text, extra}
}
const actualParts = ctx.callbackQuery.data.split(':')
// Go up to the menu that shall be opened
while (actualParts.length > expectedPartCount) {
actualParts.pop()
}
const menuAction = actualParts.join(':')
actualActionCode = new ActionCode(menuAction)
options.log('generate with actualActionCode', actualActionCode.get(), actionCode.get(), ctx.callbackQuery.data)
} else {
actualActionCode = actionCode
}
const keyboardMarkup = await this.buttons.generateKeyboardMarkup(ctx, actualActionCode, options)
options.log('buttons', keyboardMarkup.inline_keyboard)
const extra = Extra.markdown().markup(keyboardMarkup)
return {text, extra}
}
async getReleasesExpandRelease(ctx) {
const data = ctx.match[1];
ctx.answerCallbackQuery('');
const index = parseInt(data);
const releases = ctx.session.releasesDescriptions;
if (releases && releases[index]) {
if (releases[index].length <= 1) {
const result = await this.editMessageText(ctx, releases[index][0], Extra.markdown());
return this.checkForExeption(ctx, result);
} else {
return releases[index]
.reduce((promise, message) => promise
.then(() => ctx.replyWithMarkdown(message, Extra.markdown())),
ctx.deleteMessage(ctx.update.callback_query.id));
}
} else {
return this.dataBrokenException(ctx);
}
}
export const dailyNotificationExtra = (data: IDailyNotificationExtra): ExtraEditMessage => {
return Extra.markdown().markup(dailyNotificationKeyboard(data));
};
export const notifyBackExtra = () => Extra.markdown().markup(notifyBackKeyboard());
async generate(ctx) {
let text = this.mainText
if (typeof this.mainText === 'function') {
text = await this.mainText(ctx)
}
const buttons = [...this.buttons]
const lastButtonRow = this.getNeededLastRowButtons()
if (lastButtonRow.length > 0) {
buttons.push(lastButtonRow)
}
const keyboardMarkup = await buildKeyboard(buttons, ctx)
const extra = Extra.markdown().markup(keyboardMarkup)
return {text, extra}
}
export const removeLocationExtra = (translation: I18n): ExtraEditMessage => Extra.markdown().markup(removeLocationKeyboard(translation));
.then(() => ctx.replyWithMarkdown(message, Extra.markdown())),
ctx.deleteMessage(ctx.update.callback_query.id));
const readlistExtra = (translation: I18n): ExtraEditMessage => Extra.markdown().markup(readlistKeyboard(translation));