<commit_before>const crypto = require('crypto')

/**
 * @module Util
 */
module.exports = {
  /**
   * Performs string formatting for things like custom nicknames.
   *
   * @param {string} formatString The string to format (contains replacement strings)
   * @param {object} data The data to replace the string replacements with
   * @param {GuildMember} member The guild member this string is being formatted for
   * @returns {string} The processed string
   */
  formatDataString (formatString, data, member) {
    let replacements = {
      '%USERNAME%': data.robloxUsername,
      '%USERID%': data.robloxId,
      '%RANK%': data.groupRank || '',
      '%DISCORDNAME%': data.discordName || '',
      '%DISCORDID%': data.discordId || ''
    }

    if (member != null) {
      replacements['%DISCORDNAME%'] = member.user.username
      replacements['%DISCORDID%'] = member.id
      replacements['%SERVER%'] = member.guild.name
    }

    return formatString.replace(/%\w+%/g, (all) => {
      return replacements[all] || all
    })
  },

  /**
   * Returns a promise that resolves after the given time in milliseconds.<commit_msg>useless attempt<commit_after>const crypto = require('crypto')

/**
 * @module Util
 */
module.exports = {
  /**
   * Performs string formatting for things like custom nicknames.
   *
   * @param {string} formatString The string to format (contains replacement strings)
   * @param {object} data The data to replace the string replacements with
   * @param {GuildMember} member The guild member this string is being formatted for
   * @returns {string} The processed string
   */
  formatDataString (formatString, data, member) {
    let replacements = {
      '%USERNAME%': data.robloxUsername,
      '%USERID%': data.robloxId,
      '%RANK%': data.groupRank || "",
      '%DISCORDNAME%': data.discordName || '',
      '%DISCORDID%': data.discordId || ''
    }

    if (member != null) {
      replacements['%DISCORDNAME%'] = member.user.username
      replacements['%DISCORDID%'] = member.id
      replacements['%SERVER%'] = member.guild.name
    }

    return formatString.replace(/%\w+%/g, (all) => {
      return replacements[all] || all
    })
  },

  /**
   * Returns a promise that resolves after the given time in milliseconds.
{'fraction_non_alphanumeric': 0.1384479717813051, 'fraction_numerical': 0.0, 'mean_word_length': 3.217472118959108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '593605', 'n_tokens_mistral': 702, 'n_tokens_neox': 679, 'n_words': 188}