<commit_before>'use strict';

var request = require('request');

function spotify(bot, controller, message) {
  var msg = '';
  var url = 'https://api.spotify.com/v1/search?q=';
  url += message.match[1] + '&type=track';
  request.get(url, function(err, res, body) {
    if (!err && res.statusCode === 200) {
      var response = JSON.parse(body);
      var gifs = response.data.length;
      var urls = response.data[0].images.fixed_height.url;
      if (gifs > 0 && urls !== null) {
        bot.reply(message, urls);
      } else {
        msg = 'Huh... I couldn\'t find `' + message.match[1] + '` on Giphy.';
        bot.reply(message, msg);
      }
    } else {
      msg = 'Huh... I couldn\'t find `' + message.match[1] + '` on Giphy.';
      bot.reply(message, msg);
    }
  });
}

module.exports = {
  name: 'giphy me',
  author: '<NAME> (deibytb)',
  //patterns: ['giphy me (.*)'],
  types: ['direct_message', 'direct_mention'],
  description: 'Search for a gif on Giphy',
  command: giphy,
};<commit_msg>Fix function call and api url<commit_after>'use strict';

var request = require('request');

function giphy(bot, controller, message) {
  var msg = '';
  var url = 'http://api.giphy.com/v1/gifs/search?q=';
  url += message.match[1] + '&api_key=dc6zaTOxFJmzC';
  request.get(url, function(err, res, body) {
    if (!err && res.statusCode === 200) {
      var response = JSON.parse(body);
      var gifs = response.data.length;
      var urls = response.data[0].images.fixed_height.url;
      if (gifs > 0 && urls !== null) {
        bot.reply(message, urls);
      } else {
        msg = 'Huh... I couldn\'t find `' + message.match[1] + '` on Giphy.';
        bot.reply(message, msg);
      }
    } else {
      msg = 'Huh... I couldn\'t find `' + message.match[1] + '` on Giphy.';
      bot.reply(message, msg);
    }
  });
}

module.exports = {
  name: 'giphy me',
  author: '<NAME> (deibytb)',
  patterns: ['giphy me (.*)'],
  types: ['direct_message', 'direct_mention'],
  description: 'Search for a gif on Giphy',
  command: giphy,
};
{'fraction_non_alphanumeric': 0.19063871282301317, 'fraction_numerical': 0.009263773768893223, 'mean_word_length': 2.7929759704251387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '2308325', 'n_tokens_mistral': 761, 'n_tokens_neox': 747, 'n_words': 175}