<commit_before>const logger = require('../logger')

module.exports = (controller) => {

  controller.hears([/encode base64 (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let encoded = Buffer.from(message.match[1]).toString('base64')
    bot.reply(message, encoded)
  })

  controller.hears([/decode base64 (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let decoded = Buffer.from(message.match[1], 'base64').toString('utf8')
    bot.reply(message, decoded)
  })

  logger.info('Loaded slack-users skill')
}<commit_msg>Add url encoding/decoding and handle slack characters<commit_after>const logger = require('../logger')
const slackEncoder = require('../slack-encoder')

module.exports = (controller) => {

  controller.hears([/encode base64 (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let encoded = Buffer.from(slackEncoder.decode(message.match[1])).toString('base64')
    bot.reply(message, slackEncoder.encode(encoded))
  })

  controller.hears([/decode base64 (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let decoded = Buffer.from(slackEncoder.decode(message.match[1]), 'base64').toString('utf8')
    bot.reply(message, slackEncoder.encode(decoded))
  })

  controller.hears([/encode url (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let encoded = encodeURIComponent(slackEncoder.decode(message.match[1]))
    bot.reply(message, slackEncoder.encode(encoded))
  })

  controller.hears([/decode url (.*)$/i,], ['direct_message','direct_mention'], (bot, message) => {
    let encoded = decodeURIComponent(slackEncoder.decode(message.match[1]))
    bot.reply(message, slackEncoder.encode(encoded))
  })

  logger.info('Loaded slack-users skill')
}
{'fraction_non_alphanumeric': 0.19583567810917277, 'fraction_numerical': 0.013505908835115363, 'mean_word_length': 5.304964539007092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3786879', 'n_tokens_mistral': 582, 'n_tokens_neox': 557, 'n_words': 93}