How to use the monochrome-bot.NavigationChapter.fromContent 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 / bot / src / discord / jisho_search.js View on Github external
authorId,
  crossPlatformResponseData,
) {
  const chapterForEmojiName = {};

  /* Create the Jisho (J) chapter */

  const word = crossPlatformResponseData.searchPhrase;
  const discordContents = JishoDiscordContentFormatter.formatJishoDataBig(
    crossPlatformResponseData,
    true,
    true,
    authorName,
  );

  const jishoNavigationChapter = NavigationChapter.fromContent(discordContents);
  chapterForEmojiName[JISHO_EMOTE] = jishoNavigationChapter;

  /* Create the Kanji (K) chapter */

  const kanjiNavigationChapterInformation = createNavigationChapterInformationForKanji(
    authorName,
    word,
    msg.prefix,
  );

  if (kanjiNavigationChapterInformation.hasAnyPages) {
    chapterForEmojiName[KANJI_EMOTE] =
      kanjiNavigationChapterInformation.navigationChapter;
  }

  /* Create the stroke order (S) chapter */
github mistval / kotoba / bot / src / common / yourei_search.js View on Github external
value: usageExamples.length !== 0 ? usageExamples.join('・') : '-',
    inline: false,
  };

  const embed = {
    title: `${keyword} - 用例.jp Search Results`,
    url: self,
    color: constants.EMBED_NEUTRAL_COLOR,
    fields: [frequencyField, usageExampleField],
    footer: {
      icon_url: constants.FOOTER_ICON_URI,
      text: `${authorName} can use the reaction buttons below to see more information!`,
    },
  };

  return NavigationChapter.fromContent([trimEmbed({ embed })]);
}
github mistval / kotoba / src / common / yourei_search.js View on Github external
value: scrapeResult.data.usageExamples.join('・'),
    inline: false,
  };

  const embed = {
    title: `${keyword} - 用例.jp Search Results`,
    url: scrapeResult.links.self,
    color: constants.EMBED_NEUTRAL_COLOR,
    fields: [frequencyField, usageExampleField],
    footer: {
      icon_url: constants.FOOTER_ICON_URI,
      text: `${authorName} can use the reaction buttons below to see more information!`,
    },
  };

  return NavigationChapter.fromContent([trimEmbed({ embed })]);
}
github mistval / kotoba / bot / src / common / yourei_search.js View on Github external
url: self,
      fields: [],
      color: constants.EMBED_NEUTRAL_COLOR,
      footer: {
        icon_url: constants.FOOTER_ICON_URI,
        text: `${authorName} can use the reaction buttons below to see more information!`,
      },
    };
    for (let i = 0; i < EXAMPLES_PER_PAGE; i += 1) {
      if (fields.length !== 0) embed.fields.push(fields.pop());
    }
    pages.push(trimEmbed({ embed }));
    pageNumber += 1;
  }

  return NavigationChapter.fromContent(pages);
}
github mistval / kotoba / src / common / yourei_search.js View on Github external
url: self,
      fields: [],
      color: constants.EMBED_NEUTRAL_COLOR,
      footer: {
        icon_url: constants.FOOTER_ICON_URI,
        text: `${authorName} can use the reaction buttons below to see more information!`,
      },
    };
    for (let i = 0; i < EXAMPLES_PER_PAGE; i += 1) {
      embed.fields.push(fields.pop());
    }
    pages.push(trimEmbed({ embed }));
    pageNumber += 1;
  }

  return NavigationChapter.fromContent(pages);
}