<commit_before>'use strict';

var Pokeio = require('./poke.io');
var GoogleMapsAPI = require('googlemaps');
var Slack = require('slack-node');
var dateformat = require('dateformat');

//Set environment variables or replace placeholder text
var location = {
    type: 'name',
    name: '6095 <NAME>, OH 43016',
    coords: { // IBM Dublin Office Building 2
        latitude: 40.077216,
        longitude: -83.137707,
        altitude: 0
    }
};

var webhookUrl = process.env.SLACK_URL;

var username = process.env.PGO_USERNAME || 'USER';
var password = process.env.PGO_PASSWORD || '<PASSWORD>';
var provider = process.env.PGO_PROVIDER || 'google';

// Initialize Google Maps API
var googleConfig = {
    key: process.env.MAPS_API_KEY
}
var gmAPI = new GoogleMapsAPI(googleConfig);

// Initialize Slack API
var slack = new Slack();
slack.setWebhook(webhookUrl);

// Search for nearby Pokemon
Pokeio.init(username, password, location, provider, function(err) {
    if (err) throw err;

    console.log('[i] Current location: ' + Pokeio.playerInfo.locationName);
    console.log('[i] lat/long/alt: : ' + Pokeio.playerInfo.latitude + ' ' + Pokeio.playerInfo.longitude + ' ' + Pokeio.playerInfo.altitude);

    Pokeio.SetLocation(location, function(err, loc) {
        if (err) throw err;

        Pokeio.Heartbeat(function(err, hb) {
            if(err) console.log(err);

            for (var i = hb.cells.length - 1; i >= 0; i--) {
                if (hb.cells[i].WildPokemon[0]) {
                    var pokemon = Pokeio.pokemonlist[parseInt(hb.cells[i].WildPokemon[0].pokemon.PokemonId)-1]
                    var location = hb.cells[i].WildPokemon[0].Latitude + ',' + hb.cells[i].WildPokemon[0].Longitude
                    var ttl = hb.cells[i].WildPokemon[0].TimeTillHiddenMs;

                    console.log('[+] ' + pokemon.name + ' at  ' + location);

                    // Get Static Map of Pokemon Location
                    var params = {
                      center: location,
                      zoom: 17,
                      size: '500x400',
                      maptype: 'roadmap',
                      markers: [
                        {
                          location: location,
                          icon: pokemon.img,
                          scale: 2
                        }
                      ]
                    };
                    var mapUrl = gmAPI.staticMap(params);

                    // Post Results to Slack webhook
                    slack.webhook({
                        username: 'PokeBot',
                        text: 'I\'ve detected this ' + pokemon.name + ' nearby!',
                        icon_emoji: 'https://lh6.ggpht.com/YphYdqVDuLK4ZY-tCpdCdl3ZbES-hXfozgfamNQcYXmLZKLTA86Xe_2bhOCjc097fCA=w300',
                        attachments: [
                            {
                                fallback: 'Go to these coordinates: ' + location,
                                author_name: 'Disappears at ' + despawnTime(ttl),
                                image_url: mapUrl
                            }
                        ]
                    }, function(err, response) {
                        if (err) console.err(err);
                    });

                }
            }

        });

    });
});

function despawnTime(ttl) {
  var currentTime = new Date().getTime();
  return dateformat(new Date(currentTime + ttl), 'h:MM:ss TT');
}<commit_msg>Add support for multiple Pokemon in a single cell<commit_after>'use strict';

var Pokeio = require('./poke.io');
var GoogleMapsAPI = require('googlemaps');
var Slack = require('slack-node');
var dateformat = require('dateformat');

//Set environment variables or replace placeholder text
var location = {
    type: 'name',
    name: '6095 <NAME>, OH 43016',
    coords: { // IBM Dublin Office Building 2
        latitude: 40.077216,
        longitude: -83.137707,
        altitude: 0
    }
};

var webhookUrl = process.env.SLACK_URL;

var username = process.env.PGO_USERNAME || 'USER';
var password = process.env.PGO_PASSWORD || '<PASSWORD>';
var provider = process.env.PGO_PROVIDER || 'google';

// Initialize Google Maps API
var googleConfig = {
    key: process.env.MAPS_API_KEY
}
var gmAPI = new GoogleMapsAPI(googleConfig);

// Initialize Slack API
var slack = new Slack();
slack.setWebhook(webhookUrl);

// Search for nearby Pokemon
Pokeio.init(username, password, location, provider, function(err) {
    if (err) throw err;

    console.log('[i] Current location: ' + Pokeio.playerInfo.locationName);
    console.log('[i] lat/long/alt: : ' + Pokeio.playerInfo.latitude + ' ' + Pokeio.playerInfo.longitude + ' ' + Pokeio.playerInfo.altitude);

    Pokeio.SetLocation(location, function(err, loc) {
        if (err) throw err;

        Pokeio.Heartbeat(function(err, hb) {
            if(err) console.log(err);

            for (var i = hb.cells.length - 1; i >= 0; i--) {
                if (hb.cells[i].WildPokemon[0]) {
                  for (var j = hb.cells[i].WildPokemon.length - 1; j >= 0; j--) {
                    var pokemon = Pokeio.pokemonlist[parseInt(hb.cells[i].WildPokemon[j].pokemon.PokemonId)-1]
                    var location = hb.cells[i].WildPokemon[j].Latitude + ',' + hb.cells[i].WildPokemon[j].Longitude
                    var ttl = hb.cells[i].WildPokemon[j].TimeTillHiddenMs;

                    console.log('[+] ' + pokemon.name + ' at  ' + location);

                    // Get Static Map of Pokemon Location
                    var params = {
                      center: location,
                      zoom: 17,
                      size: '500x400',
                      maptype: 'roadmap',
                      markers: [
                        {
                          location: location,
                          icon: pokemon.img,
                          scale: 2
                        }
                      ]
                    };
                    var mapUrl = gmAPI.staticMap(params);

                    // Post Results to Slack webhook
                    slack.webhook({
                        username: 'PokeBot',
                        text: 'I\'ve detected this ' + pokemon.name + ' nearby!',
                        icon_emoji: 'https://lh6.ggpht.com/YphYdqVDuLK4ZY-tCpdCdl3ZbES-hXfozgfamNQcYXmLZKLTA86Xe_2bhOCjc097fCA=w300',
                        attachments: [
                            {
                                fallback: 'Go to these coordinates: ' + location,
                                pretext: 'Disappears at ' + despawnTime(ttl),
                                image_url: mapUrl
                            }
                        ]
                    }, function(err, response) {
                        if (err) console.err(err);
                    });
                  }
                }
            }

        });

    });
});

function despawnTime(ttl) {
  var currentTime = new Date().getTime();
  return dateformat(new Date(currentTime + ttl), 'h:MM:ss TT');
}
{'fraction_non_alphanumeric': 0.11835920809001567, 'fraction_numerical': 0.015667283862697622, 'mean_word_length': 1.5304504504504504, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '5781168', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2036, 'n_words': 428}