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 pyatyispyatil / github-releases-notify-bot / src / bot.js View on Github external
async editRepos(ctx) {
    const {subscriptions} = await this.db.getUser(getUser(ctx).id);

    ctx.answerCallbackQuery('');

    if (subscriptions && subscriptions.length) {
      const row = (repo) => [
        Markup.urlButton(`${repo.owner}/${repo.name}`, `https://github.com/${repo.owner}/${repo.name}`),
        Markup.callbackButton('🗑️', `editRepos:delete:${repo.owner}/${repo.name}`)
      ];

      return this.editMessageText(ctx,
        'Your subscriptions',
        Markup.inlineKeyboard([...subscriptions.map(row), [Markup.callbackButton('Back', `actionsList`)]]).extra()
      );
    } else {
      this.editMessageText(ctx,
        'You do not have a subscriptions',
        keyboards.backToActions()
      );
    }
  }
github lomaster1 / youtube-subscription-watcher-telegram-bot / bot / settings.js View on Github external
selectLanguage(ctx, isStart) {
        const lang = ctx.state.userSettings.language;
        const message = L(lang, 'ASK_CHANGE_LANGUAGE');
        return ctx.reply(message, Extra.markup(
            Markup.inlineKeyboard([
                Markup.callbackButton('English', 'setlang|en|' + (isStart ? '1' : '0')),
                Markup.callbackButton('Русский', 'setlang|ru|' + (isStart ? '1' : '0'))
            ])
        ));
    },
    changeLanguage(ctx, language) {
github Fazendaaa / AnilistBot / src / lib / telegram / keyboard / menu.ts View on Github external
Markup.callbackButton(translation.t('deButton'), 'USER/LANGUAGE/DEUTSCH'),
        Markup.callbackButton(translation.t('nlButton'), 'USER/LANGUAGE/DUTCH'),
        Markup.callbackButton(translation.t('enButton'), 'USER/LANGUAGE/ENGLISH'),
        Markup.callbackButton(translation.t('deButton'), 'USER/LANGUAGE/GERMAN'),
        Markup.callbackButton(translation.t('ruButton'), 'USER/LANGUAGE/RUSSIAN'),
        Markup.callbackButton(translation.t('frButton'), 'USER/LANGUAGE/FRENCH'),
        Markup.callbackButton(translation.t('idButton'), 'USER/LANGUAGE/INDONESIAN'),
        Markup.callbackButton(translation.t('jpButton'), 'USER/LANGUAGE/JAPANESE'),
        Markup.callbackButton(translation.t('ptButton'), 'USER/LANGUAGE/PORTUGUESE'),
        Markup.callbackButton(translation.t('esButton'), 'USER/LANGUAGE/SPANISH')
    ];
    const back = [
        Markup.callbackButton('<', 'USER/ALL')
    ];

    return Markup.inlineKeyboard(languages.concat(back).map(line => [ line ]));
};
github lomaster1 / youtube-subscription-watcher-telegram-bot / bot / reminder.js View on Github external
sendVideoUrl(userId, chatId, videoId, message, lang) {
        let msg = (message ? `${message} ` : '');
        msg += `https://www.youtube.com/watch?v=${videoId}`;
        return this._bot.telegrafApp.telegram.sendMessage(chatId, msg, Extra.markup(
            Markup.inlineKeyboard([
                Markup.callbackButton(L(lang, 'REMIND'), `remind|${videoId}`)
            ])
        ));
    },
    showRemindButton(ctx) {
github rjmunhoz / carbon-telegram-bot / src / util / keyboard.ts View on Github external
function getKeyboardObject (url: string, refresh?: RefreshData) {
  const buttons = getButtons(url, refresh)

  return Markup.inlineKeyboard(buttons as any)
}
github EdJoPaTo / telegraf-inline-menu / source / build-keyboard.js View on Github external
async function buildKeyboard(buttons, actionCodePrefix, ctx) {
  const resultButtons = await Promise.all(buttons.map(async row => {
    if (typeof row === 'function') {
      const rows = await row(ctx)
      return Promise.all(rows.map(row => buildKeyboardRow(row, actionCodePrefix, ctx)))
    }

    return [await buildKeyboardRow(row, actionCodePrefix, ctx)]
  }))
  const resultButtonsFlatted = [].concat(...resultButtons)
  return Markup.inlineKeyboard(resultButtonsFlatted)
}
github Fazendaaa / AnilistBot / src / lib / telegram / keyboard / location.ts View on Github external
export const confirmLocationKeyboard = (translation: I18n): InlineKeyboardMarkup => {
    return Markup.inlineKeyboard([
        Markup.callbackButton(translation.t('yesButton'), 'LOCATION/CONFIRM/YES'),
        Markup.callbackButton(translation.t('noButton'), 'LOCATION/CONFIRM/NO')
    ]);
};
github Fazendaaa / AnilistBot / src / lib / telegram / keyboard / list.ts View on Github external
export const readlistMoreInfoKeyboard = (mangas: IListTitle[]): InlineKeyboardMarkup => {
    const content = mangas.map((title: IListTitle) => [handleMediaButton({ kind: 'MANGA', title })]);

    content.push([ Markup.callbackButton('<', 'MEDIA/READ/ALL') ]);

    return Markup.inlineKeyboard(content);
};
github Fazendaaa / AnilistBot / src / lib / telegram / keyboard / notifications.ts View on Github external
export const dailyNotificationKeyboard = ({ language, translation }: IDailyNotificationKeyboard): InlineKeyboardMarkup => {
    return Markup.inlineKeyboard([
        Markup.callbackButton(translation.t(language, 'sourceButton'), 'SOURCE')
    ]);
};