<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import hljs from 'highlight.js';
import Modal from './modal';

import discordnet from '../snippets/discordnet';
import discordpy from '../snippets/discordpy';
import discordie from '../snippets/discordie';
import discordjs from '../snippets/discordjs';
import discordio from '../snippets/discordio';
import restcord from '../snippets/restcord';
import eris from '../snippets/eris';
import discordrb from '../snippets/discordrb';
import jda from '../snippets/jda';


const languages = {
  'dotnet_discord-net': discordnet,
  'python_discord-py': discordpy,
  'js_discordie': discordie,
  'js_discordjs': discordjs,
  'js_discordio': discordio,
  'js_eris': eris,
  'php_restcord': restcord,
  'ruby_discordrb': discordrb,
  'java_jda': jda
};

// TODO: check for localStorage availability?
// are we ever going to run into a browser that supports flexbox but not localStorage?

const CodeModal = React.createClass({
  getInitialState() {
    const keys = Object.keys(languages);
    let initial = keys[Math.floor(Math.random() * keys.length)];

    const stored = localStorage.getItem('codegen_lang');
    if (stored) {
      initial = stored;
    } else {
      localStorage.setItem('codegen_lang', initial);
    }

    return { language: initial };
  },

  componentDidMount() {
    this.highlightCode();
  },

  componentDidUpdate() {
    this.highlightCode();
  },<commit_msg>update codemodal.jsx with discord4j generator<commit_after>import React from 'react';
import ReactDOM from 'react-dom';
import hljs from 'highlight.js';
import Modal from './modal';

import discord4j from '../snippets/discord4j';
import discordnet from '../snippets/discordnet';
import discordpy from '../snippets/discordpy';
import discordie from '../snippets/discordie';
import discordjs from '../snippets/discordjs';
import discordio from '../snippets/discordio';
import restcord from '../snippets/restcord';
import eris from '../snippets/eris';
import discordrb from '../snippets/discordrb';
import jda from '../snippets/jda';


const languages = {
  'dotnet_discord-net': discordnet,
  'python_discord-py': discordpy,
  'js_discordie': discordie,
  'js_discordjs': discordjs,
  'js_discordio': discordio,
  'js_eris': eris,
  'php_restcord': restcord,
  'ruby_discordrb': discordrb,
  'java_discord4j': discord4j,
  'java_jda': jda,
};

// TODO: check for localStorage availability?
// are we ever going to run into a browser that supports flexbox but not localStorage?

const CodeModal = React.createClass({
  getInitialState() {
    const keys = Object.keys(languages);
    let initial = keys[Math.floor(Math.random() * keys.length)];

    const stored = localStorage.getItem('codegen_lang');
    if (stored) {
      initial = stored;
    } else {
      localStorage.setItem('codegen_lang', initial);
    }

    return { language: initial };
  },

  componentDidMount() {
    this.highlightCode();
  },

  componentDidUpdate() {
    this.highlightCode();
  },
{'fraction_non_alphanumeric': 0.13670969877523997, 'fraction_numerical': 0.0016550810989738498, 'mean_word_length': 4.156996587030717, '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': '6618662', 'n_tokens_mistral': 1007, 'n_tokens_neox': 945, 'n_words': 250}