How to use the monochrome-bot.Navigation.fromOneNavigationChapter 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_commands / jisho_kanji_search.js View on Github external
action(bot, msg, suffix, monochrome) {
    if (!suffix) {
      const { prefix } = msg;
      return throwPublicErrorInfo('Kanji', `Say **${prefix}kanji [kanji]** to search for kanji. For example: **${prefix}kanji 瞬間**. Say **${prefix}help kanji** for more help.`, 'No suffix');
    }

    const { navigationChapter, pageCount } = createKanjiNavigationChapter(
      suffix,
      msg.author.username,
      msg.prefix,
      false,
    );

    const navigation = Navigation.fromOneNavigationChapter(
      msg.author.id,
      navigationChapter,
      pageCount > 1,
    );

    return monochrome.getNavigationManager().show(
      navigation,
      constants.NAVIGATION_EXPIRATION_TIME,
      msg.channel,
      msg,
    );
  },
};
github mistval / kotoba / bot / src / discord_commands / strokeorder.js View on Github external
action(bot, msg, suffix, monochrome) {
    if (!suffix) {
      const { prefix } = msg;
      return throwPublicErrorInfo('Stroke Order Search', `Say **${prefix}strokeorder [kanji]** to search for stroke order information. For example: **${prefix}strokeorder 瞬間**. Say **${prefix}help strokeorder** for more help.`, 'No suffix');
    }

    const { navigationChapter, pageCount } = createStrokeOrderNavigationChapter(
      suffix,
      msg.author.username,
      false,
    );

    const navigation = Navigation.fromOneNavigationChapter(
      msg.author.id,
      navigationChapter,
      pageCount > 1,
    );

    return monochrome.getNavigationManager().show(
      navigation,
      constants.NAVIGATION_EXPIRATION_TIME,
      msg.channel,
      msg,
    );
  },
};
github mistval / kotoba / bot / src / discord_commands / leaderboard.js View on Github external
throw err;
    }

    const numUsers = await scoreQuery.countUsers();

    const showArrows = numUsers > MAX_SCORERS_PER_PAGE;
    const navigationDataSource = new ScoresDataSource(
      deckNamesArray,
      isGlobal,
      scoreQuery,
      msg,
    );

    const navigationChapter = new NavigationChapter(navigationDataSource);
    const navigation = Navigation.fromOneNavigationChapter(
      msg.author.id,
      navigationChapter,
      showArrows,
    );

    return monochrome.getNavigationManager().show(
      navigation,
      constants.NAVIGATION_EXPIRATION_TIME,
      msg.channel,
      msg,
    );
  },
};