<commit_before>const NavigationChapter = require('./navigation_chapter.js');

const LOGGER_TITLE = 'NAVIGATION';
const EDIT_DELAY_TIME_IN_MS = 1500;

async function sendReactions(msg, reactions, logger) {
  for (let i = 0; i < reactions.length; i += 1) {
    const reaction = reactions[i];
    try {
      await msg.channel.addMessageReaction(msg.id, reaction);
    } catch (err) {
      logger.logFailure(LOGGER_TITLE, 'Failed to add reaction button to navigation', err);
      if (err.code === 50013 || err.code === 10008) {
        return; // Missing permissions error or unknown message error (probably already deleted). Don't bother trying to send the other reactions.
      }
    }
  }
}

/**
 * Represents a collection of messages that can be navigated in two dimensions
 * via reaction buttons below the message. A navigation is a collection of {@link NavigationChapter}s.<commit_msg>don't try to add other reaction buttons if there's a 50001 missing access error. (different error code from 50013, missing permissions)<commit_after>const NavigationChapter = require('./navigation_chapter.js');

const LOGGER_TITLE = 'NAVIGATION';
const EDIT_DELAY_TIME_IN_MS = 1500;

async function sendReactions(msg, reactions, logger) {
  for (let i = 0; i < reactions.length; i += 1) {
    const reaction = reactions[i];
    try {
      await msg.channel.addMessageReaction(msg.id, reaction);
    } catch (err) {
      logger.logFailure(LOGGER_TITLE, 'Failed to add reaction button to navigation', err);
      if (err.code === 50001 || err.code === 50013 || err.code === 10008) {
        return; // Missing permissions error or unknown message error (probably already deleted). Don't bother trying to send the other reactions.
      }
    }
  }
}

/**
 * Represents a collection of messages that can be navigated in two dimensions
 * via reaction buttons below the message. A navigation is a collection of {@link NavigationChapter}s.
{'fraction_non_alphanumeric': 0.1016597510373444, 'fraction_numerical': 0.02437759336099585, 'mean_word_length': 3.8104738154613464, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2531674', 'n_tokens_mistral': 590, 'n_tokens_neox': 531, 'n_words': 201}