How to use the monochrome-bot.NavigationChapter function in monochrome-bot

To help you get started, we’ve selected a few monochrome-bot 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 mistval / kotoba / src / common / jisho_search.js View on Github external
function createNavigationChapterInformationForExamples(authorName, word, isStandalone) {
  const navigationChapter = new NavigationChapter(new ExamplesSource(
    authorName,
    word,
    isStandalone,
  ));

  return new NavigationChapterInformation(navigationChapter);
}
github mistval / kotoba / src / common / jisho_search.js View on Github external
function createNavigationChapterInformationForKanji(authorName, word, isStandalone, prefix) {
  const kanjis = removeDuplicates(word.match(KANJI_REGEX));
  const pageCount = kanjis ? kanjis.length : 0;
  const hasMultiplePages = pageCount > 1;
  const hasAnyPages = pageCount > 0;
  let navigationChapter;

  if (kanjis && kanjis.length > 0) {
    navigationChapter = new NavigationChapter(new KanjiDataSource(
      authorName,
      kanjis,
      isStandalone,
      hasMultiplePages,
      prefix,
    ));
  } else if (isStandalone) {
    navigationChapter = new NavigationChapter(new KanjiDataSource(
      authorName,
      word,
      isStandalone,
      hasMultiplePages,
      prefix,
    ));
  }
github mistval / kotoba / bot / src / discord_commands / pronounce.js View on Github external
function createFoundResult(msg, pronounceInfo, navigationManager, logger) {
  const navigationDataSource = new PronunciationDataSource(
    msg.author.username,
    pronounceInfo,
    logger,
  );

  const navigationChapter = new NavigationChapter(navigationDataSource);
  const chapterForEmojiName = { a: navigationChapter };
  const hasMultiplePages = pronounceInfo.entries.length > 1;
  const authorId = msg.author.id;
  const navigation = new Navigation(authorId, hasMultiplePages, 'a', chapterForEmojiName);
  return navigationManager.show(navigation, constants.NAVIGATION_EXPIRATION_TIME, msg.channel, msg);
}
github mistval / kotoba / src / discord_commands / pronounce.js View on Github external
function createFoundResult(msg, pronounceInfo, navigationManager, logger) {
  const navigationDataSource = new PronunciationDataSource(
    msg.author.username,
    pronounceInfo,
    logger,
  );

  const navigationChapter = new NavigationChapter(navigationDataSource);
  const chapterForEmojiName = { a: navigationChapter };
  const hasMultiplePages = pronounceInfo.entries.length > 1;
  const authorId = msg.author.id;
  const navigation = new Navigation(authorId, hasMultiplePages, 'a', chapterForEmojiName);
  return navigationManager.show(navigation, constants.NAVIGATION_EXPIRATION_TIME, msg.channel, msg);
}
github mistval / kotoba / src / common / jisho_search.js View on Github external
function createNavigationChapterInformationForStrokeOrder(authorName, word, isStandalone) {
  const kanjis = removeDuplicates(word.match(KANJI_REGEX));
  const pageCount = kanjis ? kanjis.length : 0;
  const hasMultiplePages = pageCount > 1;
  const hasAnyPages = pageCount > 0;
  let navigationChapter;

  if (kanjis && kanjis.length > 0) {
    navigationChapter = new NavigationChapter(new StrokeOrderDataSource(
      authorName,
      kanjis,
      isStandalone,
      hasMultiplePages,
    ));
  } else if (isStandalone) {
    navigationChapter = new NavigationChapter(new StrokeOrderDataSource(
      authorName,
      word,
      isStandalone,
      hasMultiplePages,
    ));
  }

  return new NavigationChapterInformation(navigationChapter, hasMultiplePages, hasAnyPages);
}
github mistval / kotoba / src / common / jisho_search.js View on Github external
const kanjis = removeDuplicates(word.match(KANJI_REGEX));
  const pageCount = kanjis ? kanjis.length : 0;
  const hasMultiplePages = pageCount > 1;
  const hasAnyPages = pageCount > 0;
  let navigationChapter;

  if (kanjis && kanjis.length > 0) {
    navigationChapter = new NavigationChapter(new KanjiDataSource(
      authorName,
      kanjis,
      isStandalone,
      hasMultiplePages,
      prefix,
    ));
  } else if (isStandalone) {
    navigationChapter = new NavigationChapter(new KanjiDataSource(
      authorName,
      word,
      isStandalone,
      hasMultiplePages,
      prefix,
    ));
  }

  return new NavigationChapterInformation(navigationChapter, hasMultiplePages, hasAnyPages);
}