<commit_before>part of irc;

class CommandBot {
    Client _client;

    Map<String, StreamController<MessageEvent>> commands = {
    };

    String prefix;

    CommandBot(BotConfig config, {this.prefix: "!"}) {
        _client = new Client(config);
        _registerHandlers();
    }

    Client client() => _client;

    void connect() => _client.connect();

    void disconnect() => _client.disconnect();

    Stream<MessageEvent> command(String name) {
        return commands.putIfAbsent(name, () {
            return new StreamController.broadcast();
        }).stream;
    }

    void _registerHandlers() {
        client().on(Events.Message).listen((MessageEvent event) {
            String message = event.message;

            if (message.startsWith(prefix)) {
                List<String> split = message.split(" ");
                String command = split[0].substring(1);

                if (commands.containsKey(command)) {
                    commands[command].add(event);
                }
            }
        });
    }

    StreamSubscription<ReadyEvent> ready(Function handler) {
        return on(Events.Ready).listen(handler);
    }

    Stream<Event> on(EventType<Event> type) => client().on(type);
}<commit_msg>Cooler looking Code<commit_after>part of irc;

class CommandBot {
    Client _client;

    Map<String, StreamController<MessageEvent>> commands = {
    };

    String prefix;

    CommandBot(BotConfig config, {this.prefix: "!"}) {
        _client = new Client(config);
        _registerHandlers();
    }

    Client client() => _client;

    void connect() => _client.connect();

    void disconnect() => _client.disconnect();

    Stream<MessageEvent> command(String name) {
        return commands.putIfAbsent(name, () => new StreamController.broadcast()).stream;
    }

    void _registerHandlers() {
        client().on(Events.Message).listen((MessageEvent event) {
            String message = event.message;

            if (message.startsWith(prefix)) {
                List<String> split = message.split(" ");
                String command = split[0].substring(1);

                if (commands.containsKey(command)) {
                    commands[command].add(event);
                }
            }
        });
    }

    StreamSubscription<ReadyEvent> ready(Function handler) {
        return on(Events.Ready).listen(handler);
    }

    Stream<Event> on(EventType<Event> type) => client().on(type);
}
{'fraction_non_alphanumeric': 0.13107390771743568, 'fraction_numerical': 0.0016333197223356473, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 26, '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': '3466397', 'n_tokens_mistral': 683, 'n_tokens_neox': 648, 'n_words': 128}