<commit_before>package com.serebit.autotitan.modules

import com.serebit.autotitan.api.Module
import com.serebit.autotitan.api.meta.annotations.Command
import net.dv8tion.jda.core.events.message.MessageReceivedEvent
import java.util.*

class Entertainment : Module(isOptional = true) {
    private val deterministicRandom = Random()
    private val random = Random()
    private val eightBallResponses = listOf(
            "It is certain.",
            "It is decidedly so.",
            "Without a doubt.",
            "Yes, definitely.",
            "You may rely on it.",
            "As I see it, yes.",
            "Most likely.",
            "Outlook good.",
            "Yes.",
            "Signs point to yes.",
            "Don't count on it.",
            "My reply is no.",
            "My sources say no.",
            "Outlook not so good.",
            "Very doubtful."
    )

    @Command(
            name = "magic8",
            description = "A deterministic version of the 8-ball command.",
            hidden = true,
            splitLastParameter = false
    )
    fun deterministicEightBall(evt: MessageReceivedEvent, question: String) {
        deterministicRandom.setSeed(question
                .toLowerCase()
                .replace("\\s".toRegex(), "")
                .removeSuffix("?")
                .hashCode()
                .toLong()
        )
        val responseIndex = deterministicRandom.nextInt(eightBallResponses.size - 1)
        evt.channel.sendMessage(eightBallResponses[responseIndex]).complete()
    }

    @Command(name = "8", description = "Answers questions in 8-ball fashion.", splitLastParameter = false)
    fun eightBall(evt: MessageReceivedEvent, question: String) {
        val responseIndex = random.nextInt(eightBallResponses.size - 1)
        evt.channel.sendMessage(eightBallResponses[responseIndex]).complete()
    }
}<commit_msg>Added rate command to Entertainment<commit_after>package com.serebit.autotitan.modules

import com.serebit.autotitan.api.Module
import com.serebit.autotitan.api.meta.annotations.Command
import net.dv8tion.jda.core.events.message.MessageReceivedEvent
import java.util.*

class Entertainment : Module(isOptional = true) {
    private val deterministicRandom = Random()
    private val random = Random()
    private val eightBallResponses = listOf(
            "It is certain.",
            "It is decidedly so.",
            "Without a doubt.",
            "Yes, definitely.",
            "You may rely on it.",
            "As I see it, yes.",
            "Most likely.",
            "Outlook good.",
            "Yes.",
            "Signs point to yes.",
            "Don't count on it.",
            "My reply is no.",
            "My sources say no.",
            "Outlook not so good.",
            "Very doubtful."
    )

    @Command(
            name = "magic8",
            description = "A deterministic version of the 8-ball command.",
            hidden = true,
            splitLastParameter = false
    )
    fun deterministicEightBall(evt: MessageReceivedEvent, question: String) {
        deterministicRandom.setSeed(question.normalize()
                .removeSuffix("?")
                .hashCode()
                .toLong()
        )
        val responseIndex = deterministicRandom.nextInt(eightBallResponses.size - 1)
        evt.channel.sendMessage(eightBallResponses[responseIndex]).complete()
    }

    @Command(name = "8", description = "Answers questions in 8-ball fashion.", splitLastParameter = false)
    fun eightBall(evt: MessageReceivedEvent, question: String) {
        val responseIndex = random.nextInt(eightBallResponses.size - 1)
        evt.channel.sendMessage(eightBallResponses[responseIndex]).complete()
    }

    @Command(description = "Rates the given thing on a scale of 0 to 10.", splitLastParameter = false)
    fun rate(evt: MessageReceivedEvent, thingToRate: String) {
        deterministicRandom.setSeed(thingToRate.normalize().hashCode().toLong())
        val rating = deterministicRandom.nextInt(10)
        evt.channel.sendMessage("I'd give $thingToRate a `$rating/10`.").complete()
    }

    private fun String.normalize(): String = this
            .toLowerCase()
            .replace("\\s".toRegex(), "")
}
{'fraction_non_alphanumeric': 0.11048425011753643, 'fraction_numerical': 0.004936530324400564, 'mean_word_length': 2.2161753590325017, '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': '2013756', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1130, 'n_words': 289}