<commit_before>/*
 * nasa.js - Show NASA's Astronomy Picture of the Day
 * 
 * Contributed by Capuccino and Ovyerus
 */

const request = require('request');

exports.commands = [
    'apod'
];

exports.apod = {
    desc: "Shows NASA's [Astronomy Picture of the Day](http://apod.nasa.gov/apod/astropix.html) (APOD)",
    main(bot, ctx) {
        return new Promise((resolve, reject) => {
            if (!bot.config.nasaKey) {
                ctx.msg.channel.createMessage(localeManager.t('nasa-noKey', ctx.settings.locale)).then(resolve).catch(reject);
            } else {
                request(`https://api.nasa.gov/planetary/apod?api_key=${bot.config.nasaKey}`, (err, resp, body) => {
                    if (err) {
                        reject(err);
                    } else if (resp.statusCode !== 200) {
                        reject(new Error(`Invalid status code: ${resp.statusCode}`));
                    } else {
                        let data = JSON.parse(body);
                        ctx.msg.channel.createMessage({embed: {
                            title: data.title,
                            description: data.copyright ? localeManager.t('nasa-copyright', ctx.settings.locale, {copyright: data.copyright}) : '',
                            thumbnail: {url: 'https://api.nasa.gov/images/logo.png'},
                            color: 0xFD7BB5,
                            image: {url: data.url},
                            footer: {text: localeManager.t('nasa-date', ctx.settings.locale, {date: data.date})}
                        }}).then(resolve).catch(reject);
                    }
                });
            }
        });
    }
};<commit_msg>Move APOD command to Got<commit_after>/*
 * nasa.js - Show NASA's Astronomy Picture of the Day
 * 
 * Contributed by Capuccino and Ovyerus
 */

const got = require('got');

exports.commands = [
    'apod'
];

exports.apod = {
    desc: "Shows NASA's [Astronomy Picture of the Day](http://apod.nasa.gov/apod/astropix.html) (APOD)",
    main(bot, ctx) {
        return new Promise((resolve, reject) => {
            if (!bot.config.nasaKey) {
                ctx.msg.channel.createMessage(localeManager.t('nasa-noKey', ctx.settings.locale)).then(resolve).catch(reject);
            } else {
                got(`https://api.nasa.gov/planetary/apod?api_key=${bot.config.nasaKey}`).then(res => {
                    let data = JSON.parse(res.body);
                    return ctx.msg.channel.createMessage({embed: {
                        title: data.title,
                        description: data.copyright ? localeManager.t('nasa-copyright', ctx.settings.locale, {copyright: data.copyright}) : '',
                        thumbnail: {url: 'https://api.nasa.gov/images/logo.png'},
                        color: 0xFD7BB5,
                        image: {url: data.url},
                        footer: {text: localeManager.t('nasa-date', ctx.settings.locale, {date: data.date})}
                    }});
                }).then(resolve).catch(reject);
            }
        });
    }
};
{'fraction_non_alphanumeric': 0.14592833876221498, 'fraction_numerical': 0.0029315960912052116, 'mean_word_length': 1.6451335055986218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '4601812', 'n_tokens_mistral': 899, 'n_tokens_neox': 861, 'n_words': 157}