<commit_before>var nani = require('nani').init('hsiw-gt2fs', 't9C9EyoLpMsqvNRldKB9pK');
var getSeason = require('./../../utils/utils.js').getSeason;
var toTitleCase = require('./../../utils/utils.js').toTitleCase;
var getSeason = require('./../../utils/utils.js').getSeason;

var seasons = ['winter', 'spring', 'summer', 'fall'];
var url = `browse/anime?season=${seasons[getSeason()]}&full_page=true&type=Tv`
var currentAnime = null;

module.exports = {
    usage: "This bot dances around in the current channel using a random dance",
    delete: true,
    cooldown: 5,
    process: function(bot, msg, suffix) {
        if (currentAnime === null) {
            nani.get(url)
                .then(data => {
                    currentAnime = Object.keys(data).map(title => data[title].title_romaji).sort();
                    sendAnime(bot, msg, suffix)
                })
                .catch(error => {
                    console.log(error);
                });
        } else {
            sendAnime(bot, msg, suffix)
        }
    }
}

function sendAnime(bot, msg, suffix) {
    var pagedTitles = splitArray(currentAnime, 5);
    (/^[0-9]$/.test(suffix) && suffix < pagedTitles.length) ? page = suffix - 1 : page = 0;
    var msgString = `\`\`\`markdown\n### Anime for the ${toTitleCase(seasons[getSeason()])} Season: (Page #${page+1}) ###\n`;
    msgString += pagedTitles[page].map((value, position) => '[' + (position + 1 + (page * 5)) + ']: ' + value).join('\n');
    bot.createMessage(msg.channel.id, msgString + "```").catch(console.log);

}<commit_msg>Fixed a bug and added more things for testing<commit_after>var nani = require('nani').init('hsiw-gt2fs', 't9C9EyoLpMsqvNRldKB9pK');
var getSeason = require('./../../utils/utils.js').getSeason;
var toTitleCase = require('./../../utils/utils.js').toTitleCase;
var splitArray = require('./../../utils/utils.js').splitArray;

var seasons = ['winter', 'spring', 'summer', 'fall'];
var url = `browse/anime?season=${seasons[getSeason()]}&full_page=true&type=Tv&airing_data=true`
var currentAnime = null;

module.exports = {
    usage: "This bot dances around in the current channel using a random dance",
    delete: true,
    cooldown: 5,
    process: function(bot, msg, suffix) {
        if (currentAnime === null) {
            nani.get(url)
                .then(data => {
                	console.log(data)
                    currentAnime = Object.keys(data).map(title => data[title].title_romaji).sort();
                    sendAnime(bot, msg, suffix)
                })
                .catch(error => {
                    console.log(error);
                });
        } else {
            sendAnime(bot, msg, suffix)
        }
    }
}

function sendAnime(bot, msg, suffix) {
    var pagedTitles = splitArray(currentAnime, 10);
    (/^[0-9]$/.test(suffix) && suffix < pagedTitles.length) ? page = suffix - 1 : page = 0;
    var msgString = `\`\`\`markdown\n### Anime for the ${toTitleCase(seasons[getSeason()])} Season: (Page #${page+1}) ###\n`;
    msgString += pagedTitles[page].map((value, position) => '[' + (position + 1 + (page * 10)) + ']: ' + value).join('\n');
    bot.createMessage(msg.channel.id, msgString + "```").catch(console.log);

}
{'fraction_non_alphanumeric': 0.18664596273291925, 'fraction_numerical': 0.008695652173913044, 'mean_word_length': 2.6354401805869077, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '207281', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1049, 'n_words': 213}