<commit_before>package fredboat.event;

import fredboat.FredBoat;
import java.util.HashMap;
import java.util.regex.Pattern;
import net.dv8tion.jda.events.ReadyEvent;
import net.dv8tion.jda.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.hooks.ListenerAdapter;

public abstract class AbstractScopedEventListener extends ListenerAdapter {

    public final int scope;
    public final String defaultPrefix;
    public final Pattern commandNamePrefix;
    private final HashMap<String, UserListener> userListener = new HashMap<>();

    public static int messagesReceived = 0;

    public AbstractScopedEventListener(int scope, String prefix) {
        this.scope = scope;
        this.defaultPrefix = prefix;
        this.commandNamePrefix = Pattern.compile("(\\w+)");
    }

    @Override
    public void onReady(ReadyEvent event) {
        FredBoat.init(event);
    }

    @Override
    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        UserListener listener = userListener.get(event.getAuthor().getId());
        if (listener != null) {
            listener.onGuildMessageReceived(event);
        }
    }

    public void putListener(String id, UserListener listener) {
        userListener.put(id, listener);
    }

    public void removeListener(String id) {
        userListener.remove(id);
    }
}<commit_msg>Added exception handling for akinator<commit_after>package fredboat.event;

import fredboat.FredBoat;
import fredboat.util.TextUtils;
import java.util.HashMap;
import java.util.regex.Pattern;
import net.dv8tion.jda.events.ReadyEvent;
import net.dv8tion.jda.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.hooks.ListenerAdapter;

public abstract class AbstractScopedEventListener extends ListenerAdapter {

    public final int scope;
    public final String defaultPrefix;
    public final Pattern commandNamePrefix;
    private final HashMap<String, UserListener> userListener = new HashMap<>();

    public static int messagesReceived = 0;

    public AbstractScopedEventListener(int scope, String prefix) {
        this.scope = scope;
        this.defaultPrefix = prefix;
        this.commandNamePrefix = Pattern.compile("(\\w+)");
    }

    @Override
    public void onReady(ReadyEvent event) {
        FredBoat.init(event);
    }

    @Override
    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        UserListener listener = userListener.get(event.getAuthor().getId());
        if (listener != null) {
            try{
            listener.onGuildMessageReceived(event);
            } catch(Exception ex){
                TextUtils.handleException(ex, event.getChannel(), event.getAuthor());
            }
        }
    }

    public void putListener(String id, UserListener listener) {
        userListener.put(id, listener);
    }

    public void removeListener(String id) {
        userListener.remove(id);
    }
}
{'fraction_non_alphanumeric': 0.09155888359428183, 'fraction_numerical': 0.002722940776038121, 'mean_word_length': 3.3605341246290803, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4668611', 'n_tokens_mistral': 812, 'n_tokens_neox': 790, 'n_words': 184}