<commit_before>let Promise
try {
  Promise = require('bluebird')
} catch (err) {
  Promise = global.Promise
}

const { padEnd, emojis } = require('../util')

class Responder {
  constructor (command) {
    this.command = command
    this.i18n = command.i18n

    /** Response methods */
    this.responseMethods = {
      send: (msg, res) => res,
      reply: (msg, res) => `**${msg.author.username}**, ${res}`,
      success: (msg, res) => `${emojis['white_check_mark']}  |  **${msg.author.username}**, ${res}`,
      error: (msg, res) => `${emojis['negative_squared_cross_mark']}  |  **${msg.author.username}**, ` + (res || '{{%ERROR}}')
    }

    /** Formatter methods */
    this.formatMethods = {
      bold: (res) => `**${res}**`,
      italic: (res) => `*${res}*`,
      underline: (res) => `__${res}__`,
      strikethrough: (res) => `~~${res}~~`,
      inlineCode: (res) => `\`${res}\``,
      code: (res, type = '') => `\`\`\`${type}\n${res}\n\`\`\``,
      emoji: (res, type) => `${emojis[type] || emojis['information_source']}  |  ${res}`
    }
  }

  create ({ msg: message, settings = {} }, data) {
    let responder = Object.assign((...args) => responder.send(...args), {
      command: this.command,
      message: message,
      settings: settings,
      data: data,
      _options: {},
      responseMethods: this.responseMethods,
      formatMethods: this.formatMethods
    })

    const copy = ['_send', 't', 'clean', 'typing', 'format', 'file', 'embed', 'dialog', 'selection']
    copy.forEach(prop => { responder[prop] = this[prop].bind(responder) })

    for (let method in this.responseMethods) {
      responder[method] = responder._send.bind(responder, method)
    }

    return responder
  }

  t (content = '', tags = {}) {
    const cmd = this.command
    const file = cmd.name ? cmd.name.split(':')[0] : (cmd.labels ? cmd.labels[0] : 'common')
    const res = cmd.i18n.parse(content, cmd.localeKey || file, this.settings.lang || 'en', tags)
    return res.replace(/:(\S+):/gi, (matched, name) => emojis[name] || emojis['information_source'])
  }

  _send (method, response = '', options = {}) {<commit_msg>Fix Responder string interpolation<commit_after>let Promise
try {
  Promise = require('bluebird')
} catch (err) {
  Promise = global.Promise
}

const { padEnd, emojis } = require('../util')

class Responder {
  constructor (command) {
    this.command = command
    this.i18n = command.i18n

    /** Response methods */
    this.responseMethods = {
      send: (msg, res) => res,
      reply: (msg, res) => `**${msg.author.username}**, ${res}`,
      success: (msg, res) => `${emojis['white_check_mark']}  |  **${msg.author.username}**, ${res}`,
      error: (msg, res) => `${emojis['negative_squared_cross_mark']}  |  **${msg.author.username}**, ` + (res || '{{%ERROR}}')
    }

    /** Formatter methods */
    this.formatMethods = {
      bold: (res) => `**${res}**`,
      italic: (res) => `*${res}*`,
      underline: (res) => `__${res}__`,
      strikethrough: (res) => `~~${res}~~`,
      inlineCode: (res) => `\`${res}\``,
      code: (res, type = '') => `\`\`\`${type}\n${res}\n\`\`\``,
      emoji: (res, type) => `${emojis[type] || emojis['information_source']}  |  ${res}`
    }
  }

  create ({ msg: message, settings = {} }, data) {
    let responder = Object.assign((...args) => responder.send(...args), {
      command: this.command,
      message: message,
      settings: settings,
      data: data,
      _options: {},
      responseMethods: this.responseMethods,
      formatMethods: this.formatMethods
    })

    const copy = ['_send', 't', 'clean', 'typing', 'format', 'file', 'embed', 'dialog', 'selection']
    copy.forEach(prop => { responder[prop] = this[prop].bind(responder) })

    for (let method in this.responseMethods) {
      responder[method] = responder._send.bind(responder, method)
    }

    return responder
  }

  t (content = '', tags = {}) {
    const cmd = this.command
    const file = cmd.name ? cmd.name.split(':')[0] : (cmd.triggers ? cmd.triggers[0] : 'common')
    const res = cmd.i18n.parse(content, cmd.localeKey || file, this.settings.lang || 'en', tags)
    return res.replace(/:(\S+):/gi, (matched, name) => emojis[name] || emojis['information_source'])
  }

  _send (method, response = '', options = {}) {
{'fraction_non_alphanumeric': 0.21958595022098162, 'fraction_numerical': 0.0037217957664573155, 'mean_word_length': 3.126679462571977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '326457', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1480, 'n_words': 305}