<commit_before>const { MessageEmbed } = require('discord.js')
const { DiscordPrompt, MenuEmbed, MenuVisual } = require('discord.js-prompts')
const Translator = require('../../../structs/Translator.js')
const createLogger = require('../../../util/logger/create.js')

/**
 * @typedef {Object} Data
 * @property {import('../../../structs/db/Profile.js')} [profile]
 * @property {import('../../../structs/db/Feed.js')[]} feeds
 * @property {import('../../../structs/db/Feed.js')} [selectedFeed]
 */

/**
 * @param {Error} err
 * @param {import('discord.js').Message} message
 */
async function handlePaginationError (err, message) {
  const log = createLogger(message.client.shard.ids[0])
  const newEmbed = new MessageEmbed(message.embeds[0])
    .setFooter(`Failed to enable pagination ${err.message}`)
  try {
    await message.edit(message.content, newEmbed)
  } catch (err) {
    log.warn({
      error: err,
      guild: message.guild
    }, 'Pagination controls error')
  }
}

/**
 * @param {Data} data
 */
function selectFeedVisual (data) {
  const feeds = data.feeds
  const { locale } = data.profile || {}
  const translate = Translator.createLocaleTranslator(locale)
  const embed = new MessageEmbed({
    title: translate('structs.FeedSelector.feedSelectionMenu'),
    description: `${translate('structs.FeedSelector.prompt')} ${translate('structs.FeedSelector.exitToCancel')} `
  })
  const menu = new MenuEmbed(embed, { maxPerPage: 1 })
    .enablePagination(handlePaginationError)
<commit_msg>Fix page limit for selectFeed<commit_after>const { MessageEmbed } = require('discord.js')
const { DiscordPrompt, MenuEmbed, MenuVisual } = require('discord.js-prompts')
const Translator = require('../../../structs/Translator.js')
const createLogger = require('../../../util/logger/create.js')

/**
 * @typedef {Object} Data
 * @property {import('../../../structs/db/Profile.js')} [profile]
 * @property {import('../../../structs/db/Feed.js')[]} feeds
 * @property {import('../../../structs/db/Feed.js')} [selectedFeed]
 */

/**
 * @param {Error} err
 * @param {import('discord.js').Message} message
 */
async function handlePaginationError (err, message) {
  const log = createLogger(message.client.shard.ids[0])
  const newEmbed = new MessageEmbed(message.embeds[0])
    .setFooter(`Failed to enable pagination ${err.message}`)
  try {
    await message.edit(message.content, newEmbed)
  } catch (err) {
    log.warn({
      error: err,
      guild: message.guild
    }, 'Pagination controls error')
  }
}

/**
 * @param {Data} data
 */
function selectFeedVisual (data) {
  const feeds = data.feeds
  const { locale } = data.profile || {}
  const translate = Translator.createLocaleTranslator(locale)
  const embed = new MessageEmbed({
    title: translate('structs.FeedSelector.feedSelectionMenu'),
    description: `${translate('structs.FeedSelector.prompt')} ${translate('structs.FeedSelector.exitToCancel')} `
  })
  const menu = new MenuEmbed(embed)
    .enablePagination(handlePaginationError)

{'fraction_non_alphanumeric': 0.178369384359401, 'fraction_numerical': 0.0016638935108153079, 'mean_word_length': 3.952224052718287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6707713', 'n_tokens_mistral': 958, 'n_tokens_neox': 940, 'n_words': 190}