<commit_before>Chance = require 'chance'
Giphy = require('request-promise').defaults {
  baseUrl: 'http://api.giphy.com/v1/gifs/'
  simple: true
}

class GiphyModule extends BotModule
  init: =>
    @chance = new Chance()

    @registerCommand 'giphy', { aliases: ['gif'], allowDM: true }, (msg, q)=>
      try
        { data } = await Giphy.get('search', { qs: { q, api_key: '<KEY>' } })
      return msg.reply 'No results' if not data.length
      msg.reply @chance.pickone(data).url

module.exports = GiphyModule<commit_msg>Final tweaks to Giphy module<commit_after>Chance = require 'chance'
Giphy = require('request-promise').defaults {
  baseUrl: 'http://api.giphy.com/v1/gifs/'
  simple: true
}

class GiphyModule extends BotModule
  init: =>
    @chance = new Chance()

    @registerCommand 'giphy', { aliases: ['gif'], allowDM: true }, (msg, q)=>
      try
        { data } = await Giphy.get('search', { json: true, qs: { q, api_key: '<KEY>' } })
      return msg.reply 'No results' if not data.length
      msg.reply @chance.pickone(data).bitly_url

module.exports = GiphyModule
{'fraction_non_alphanumeric': 0.15823367065317387, 'fraction_numerical': 0.0018399264029438822, 'mean_word_length': 3.477366255144033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '768980', 'n_tokens_mistral': 389, 'n_tokens_neox': 384, 'n_words': 93}