<commit_before>package rollBot;

import com.darichey.discord.CommandContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rollBot.model.*;

import java.util.List;
import java.util.function.Consumer;

public class RollCommand implements Consumer<CommandContext> {
    public static final String COMMAND_NAME = "roll";
    Logger logger = LoggerFactory.getLogger(RollCommand.class);

    @Override
    public void accept(CommandContext ctx) {
        List<String> arguments = ctx.getArgs();

        StringBuilder allArguments = new StringBuilder();

        boolean verboseResult = true;

        for (String a : arguments) {
            if(a.startsWith("-")) {
                a = a.replaceFirst("-", "");
                if (a.equals("t")) {
                    verboseResult = false;
                }
            }
            else {
                allArguments.append(a + " ");
            }
        }

        logger.info("Roll Command recieved w/ args: " + allArguments);

        DiceProvider diceProvider = new StringDiceProvider(allArguments.toString());

        DiceBag bag = new DiceBag(diceProvider);
        RollResult result = bag.roll();

        ctx.getChannel().sendMessage(String.format("Result: %s", result.getResultString(verboseResult)));<commit_msg>#6 Added check for output which exceeds Discord API standards.<commit_after>package rollBot;

import com.darichey.discord.CommandContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rollBot.model.*;

import java.util.List;
import java.util.function.Consumer;

public class RollCommand implements Consumer<CommandContext> {
    private static final int RESULT_LIMIT = 2000;
    public static final String COMMAND_NAME = "roll";
    Logger logger = LoggerFactory.getLogger(RollCommand.class);

    @Override
    public void accept(CommandContext ctx) {
        List<String> arguments = ctx.getArgs();

        StringBuilder allArguments = new StringBuilder();

        boolean verboseResult = true;

        for (String a : arguments) {
            if(a.startsWith("-")) {
                a = a.replaceFirst("-", "");
                if (a.equals("t")) {
                    verboseResult = false;
                }
            }
            else {
                allArguments.append(a + " ");
            }
        }

        logger.info("Roll Command recieved w/ args: " + allArguments);

        DiceProvider diceProvider = new StringDiceProvider(allArguments.toString());

        DiceBag bag = new DiceBag(diceProvider);
        RollResult result = bag.roll();
        String resultString = result.getResultString(verboseResult);

        if(resultString.length() > RESULT_LIMIT) {
            resultString = result.getResultString(false);
            resultString += " (Result was too large, terse output given instead)";
        }

        ctx.getChannel().sendMessage(String.format("Result: %s", resultString));
{'fraction_non_alphanumeric': 0.1075085324232082, 'fraction_numerical': 0.0030716723549488053, 'mean_word_length': 2.4892857142857143, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '5280789', 'n_tokens_mistral': 794, 'n_tokens_neox': 762, 'n_words': 182}