How to use the telegraf.Extra.markdown 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 EdJoPaTo / telegraf-inline-menu / source / index.ts View on Github external
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}
  }
github EdJoPaTo / telegraf-inline-menu / source / index.js View on Github external
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}
  }
github pyatyispyatil / github-releases-notify-bot / src / bot.js View on Github external
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);
    }
  }
github Fazendaaa / AnilistBot / src / lib / telegram / extra / notification.ts View on Github external
export const dailyNotificationExtra = (data: IDailyNotificationExtra): ExtraEditMessage => {
    return Extra.markdown().markup(dailyNotificationKeyboard(data));
};
github Fazendaaa / AnilistBot / src / lib / telegram / extra / menu.ts View on Github external
export const notifyBackExtra = () => Extra.markdown().markup(notifyBackKeyboard());
github EdJoPaTo / telegraf-inline-menu / telegraf-inline-menu.js View on Github external
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}
  }
github Fazendaaa / AnilistBot / src / lib / telegram / extra / location.ts View on Github external
export const removeLocationExtra = (translation: I18n): ExtraEditMessage => Extra.markdown().markup(removeLocationKeyboard(translation));
github pyatyispyatil / github-releases-notify-bot / src / bot.js View on Github external
            .then(() => ctx.replyWithMarkdown(message, Extra.markdown())),
            ctx.deleteMessage(ctx.update.callback_query.id));
github Fazendaaa / AnilistBot / src / lib / telegram / extra / media.ts View on Github external
const readlistExtra = (translation: I18n): ExtraEditMessage => Extra.markdown().markup(readlistKeyboard(translation));