<commit_before>#! /usr/bin/env node
"use strict";

const login = require("facebook-chat-api");
const giphy = require("giphy-api")();
const confg = require("./config");

login({email: confg.EMAIL, password: confg.PASS}, function callback(err, api) {
  if (err) return console.error(err);

  api.listen(function callback(err, message) {
    var msg = message.body.toLowerCase();

    if (msg.includes("/kick")) {
      if (msg.includes("swar"))
        api.removeUserFromGroup(confg.SWAR, message.threadID);
      else if (msg.includes("kaartikey"))
        api.removeUserFromGroup(confg.KAARTIKEY, message.threadID);
      else if (msg.includes("anuj"))
        api.removeUserFromGroup(confg.ANUJ, message.threadID);
    }

    if (msg === "/say hi")
      api.sendMessage("Hello!", message.threadID);

    if (msg === "/stop") {
      api.sendMessage("Goodbye!", message.threadID); 
      return stopListening();
    }

    if (msg.match(/\/giphy (.+)/)) {
      var search = msg.replace("/giphy", "")
      giphy.search(search).then(function(res) {
        api.sendMessage(res.data[0].embed_url, message.threadID)
      });
    }
  });
});<commit_msg>Choose random gif instead of 0th (giphy search order !rand)<commit_after>#! /usr/bin/env node
"use strict";

const login = require("facebook-chat-api");
const giphy = require("giphy-api")();
const confg = require("./config");

login({email: confg.EMAIL, password: confg.PASS}, function callback(err, api) {
  if (err) return console.error(err);

  api.listen(function callback(err, message) {
    var msg = message.body.toLowerCase();

    if (msg.includes("/kick")) {
      if (msg.includes("swar"))
        api.removeUserFromGroup(confg.SWAR, message.threadID);
      else if (msg.includes("kaartikey"))
        api.removeUserFromGroup(confg.KAARTIKEY, message.threadID);
      else if (msg.includes("anuj"))
        api.removeUserFromGroup(confg.ANUJ, message.threadID);
    }

    if (msg === "/say hi")
      api.sendMessage("Hello!", message.threadID);

    if (msg === "/stop") {
      api.sendMessage("Goodbye!", message.threadID); 
      return stopListening();
    }

    if (msg.match(/\/giphy (.+)/)) {
      var search = msg.replace("/giphy", "")
      giphy.search(search).then(function(res) {
        var gif = res.data[Math.floor(Math.random() * res.data.length)].images.downsized.url;
        api.sendMessage(gif, message.threadID)
      });
    }
  });
});
{'fraction_non_alphanumeric': 0.17889530090684255, 'fraction_numerical': 0.0008244023083264633, 'mean_word_length': 3.2879858657243815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1473273', 'n_tokens_mistral': 826, 'n_tokens_neox': 807, 'n_words': 149}