<commit_before>var bb8 = require('../libs/bb8-instance')();
var WeatherFactory = require('../libs/open-weather-factory');

module.exports = function (bb8, options) {

    if (process.env.WEATHER_KEY || options.accessToken) {
        var weatherRequester = WeatherFactory({
            accessToken: options.accessToken || process.env.WEATHER_KEY,
            city: options.city || 'manchester',
            country: options.country || 'uk'
        });

        var WEATHER_ID = process.env.WEATHER_KEY;

        console.log('Connected to ' + config.BB8_LOCAL_NAME);
        console.log('Rain Rain go away, come back another day!');

        // Every 10 seconds, lets poll the weather
        setInterval(function () {

            weatherRequester(function (error, weatherData) {

                if (!error && weatherData) {

                    if (weatherData.main.temp >= 8) {
                        bb8.color('yellow');
                    } else if (weatherData.main.temp >= 20) {
                        bb8.color('orange');
                    } else if (weatherData.main.temp >= 25) {
                        bb8.color('red');
                    } else {
                        bb8.color('blue');
                    }

                }
            });

        }, 10000);

    } else {
        console.log('BB8 Config isnt set or the WEATHER_KEY env for openweather is not present');
    }

};
<commit_msg>more weathering<commit_after>var WeatherFactory = require('../libs/open-weather-factory');

module.exports = function (bb8, options) {

    if (process.env.WEATHER_KEY || options.accessToken) {
        var weatherRequester = WeatherFactory({
            accessToken: options.accessToken || process.env.WEATHER_KEY,
            city: options.city || 'manchester',
            country: options.country || 'uk'
        });

        var WEATHER_ID = process.env.WEATHER_KEY;

        console.log('Rain Rain go away, come back another day!');

        // Every 10 seconds, lets poll the weather
        setInterval(function () {

            weatherRequester(function (error, weatherData) {

                if (!error && weatherData) {

                    if (weatherData.main.temp >= 8) {
                        bb8.color('yellow');
                    } else if (weatherData.main.temp >= 20) {
                        bb8.color('orange');
                    } else if (weatherData.main.temp >= 25) {
                        bb8.color('red');
                    } else {
                        bb8.color('blue');
                    }

                }
            });

        }, 10000);

    } else {
        console.log('WEATHER_KEY env for openweather is not present');
    }

};

{'fraction_non_alphanumeric': 0.12158167036215817, 'fraction_numerical': 0.014042867701404288, 'mean_word_length': 1.5537735849056604, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7348359', 'n_tokens_mistral': 793, 'n_tokens_neox': 698, 'n_words': 157}