<commit_before>package com.tisawesomeness.minecord.bootstrap;

import com.tisawesomeness.minecord.Minecord;
import com.tisawesomeness.minecord.common.BootContext;
import com.tisawesomeness.minecord.common.Bot;
import com.tisawesomeness.minecord.common.HttpConfig;
import com.tisawesomeness.minecord.common.LoadingActivity;
import com.tisawesomeness.minecord.common.config.ConfigReader;
import com.tisawesomeness.minecord.common.config.InvalidConfigException;
import com.tisawesomeness.minecord.common.util.Either;
import com.tisawesomeness.minecord.common.util.IO;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.requests.restaction.MessageAction;
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
import net.dv8tion.jda.api.sharding.ShardManager;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import okhttp3.ConnectionPool;
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient.Builder;
import org.jetbrains.annotations.Nullable;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;

import javax.security.auth.login.LoginException;
import java.io.IOException;
import java.nio.file.Path;
import java.time.Instant;
import java.util.EnumSet;
import java.util.Objects;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeUnit;

/**
 * Starts the bot. See {@link Bot} for details on the boot process.
 */
@Slf4j
public final class Bootstrap {

    private static final String TOKEN_ENV_VAR = "MINECORD_TOKEN";

    private static final EnumSet<GatewayIntent> GATEWAYS = EnumSet.of(
            GatewayIntent.DIRECT_MESSAGES, GatewayIntent.DIRECT_MESSAGE_REACTIONS,
            GatewayIntent.GUILD_MESSAGES, GatewayIntent.GUILD_MESSAGE_REACTIONS);
    private static final EnumSet<CacheFlag> DISABLED_CACHE_FLAGS = EnumSet.of(
            CacheFlag.ACTIVITY, CacheFlag.CLIENT_STATUS, CacheFlag.EMOTE,
            CacheFlag.ONLINE_STATUS, CacheFlag.VOICE_STATE);
    private static final EnumSet<Message.MentionType> ALLOWED_MENTIONS = EnumSet.complementOf(EnumSet.of(
            Message.MentionType.EVERYONE, Message.MentionType.HERE,
            Message.MentionType.USER, Message.MentionType.ROLE));

    public static void main(String[] args) {
        log.debug("Program started");
        try {
            int exitCode = argsStage(args);
            if (exitCode != BootExitCodes.SUCCESS) {
                System.exit(exitCode);
            }
        } catch (Exception ex) {
            log.error("FATAL: A fatal exception occurred on startup", ex);
            System.exit(BootExitCodes.GENERAL_FAILURE);
        }
    }
<commit_msg>Fix bot not exiting on certain boot errors<commit_after>package com.tisawesomeness.minecord.bootstrap;

import com.tisawesomeness.minecord.Minecord;
import com.tisawesomeness.minecord.common.BootContext;
import com.tisawesomeness.minecord.common.Bot;
import com.tisawesomeness.minecord.common.HttpConfig;
import com.tisawesomeness.minecord.common.LoadingActivity;
import com.tisawesomeness.minecord.common.config.ConfigReader;
import com.tisawesomeness.minecord.common.config.InvalidConfigException;
import com.tisawesomeness.minecord.common.util.Either;
import com.tisawesomeness.minecord.common.util.IO;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.requests.restaction.MessageAction;
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
import net.dv8tion.jda.api.sharding.ShardManager;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import okhttp3.ConnectionPool;
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient.Builder;
import org.jetbrains.annotations.Nullable;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;

import javax.security.auth.login.LoginException;
import java.io.IOException;
import java.nio.file.Path;
import java.time.Instant;
import java.util.EnumSet;
import java.util.Objects;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeUnit;

/**
 * Starts the bot. See {@link Bot} for details on the boot process.
 */
@Slf4j
public final class Bootstrap {

    private static final String TOKEN_ENV_VAR = "MINECORD_TOKEN";

    private static final EnumSet<GatewayIntent> GATEWAYS = EnumSet.of(
            GatewayIntent.DIRECT_MESSAGES, GatewayIntent.DIRECT_MESSAGE_REACTIONS,
            GatewayIntent.GUILD_MESSAGES, GatewayIntent.GUILD_MESSAGE_REACTIONS);
    private static final EnumSet<CacheFlag> DISABLED_CACHE_FLAGS = EnumSet.of(
            CacheFlag.ACTIVITY, CacheFlag.CLIENT_STATUS, CacheFlag.EMOTE,
            CacheFlag.ONLINE_STATUS, CacheFlag.VOICE_STATE);
    private static final EnumSet<Message.MentionType> ALLOWED_MENTIONS = EnumSet.complementOf(EnumSet.of(
            Message.MentionType.EVERYONE, Message.MentionType.HERE,
            Message.MentionType.USER, Message.MentionType.ROLE));

    public static void main(String[] args) {
        log.debug("Program started");
        try {
            int exitCode = argsStage(args);
            if (exitCode != BootExitCodes.SUCCESS) {
                System.exit(exitCode);
            }
        } catch (Throwable ex) {
            log.error("FATAL: A fatal exception occurred on startup", ex);
            System.exit(BootExitCodes.GENERAL_FAILURE);
        }
    }

{'fraction_non_alphanumeric': 0.0968787310250725, 'fraction_numerical': 0.005457956677468873, 'mean_word_length': 4.330909090909091, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6348581', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1868, 'n_words': 313}