<commit_before>package net.twasi.core.interfaces.twitch;

import net.twasi.core.interfaces.api.CommunicationHandler;
import net.twasi.core.logger.TwasiLogger;
import net.twasi.core.models.Message.TwasiMessage;

import java.io.IOException;

public class TwitchCommunicationHandler extends CommunicationHandler {

    TwitchCommunicationHandler(TwitchInterface inf) {
        super(inf);
    }

    @Override
    public boolean sendMessage(String message) {
        return sendRawMessage("PRIVMSG " + getInterface().getStreamer().getUser().getTwitchAccount().getChannel() + " :" + message);
    }

    @Override
    public boolean sendRawMessage(String rawMessage) {
        try {
            TwasiLogger.log.trace("IRC OUT: " + rawMessage);
            TwitchInterface twitchInterface = (TwitchInterface) getInterface();
            twitchInterface.getWriter().write(rawMessage + "\n");
            twitchInterface.getWriter().flush();
            return true;
        } catch (IOException e) {
            TwasiLogger.log.error(e);
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public TwasiMessage readMessage() {
        TwitchInterface twitchInterface = (TwitchInterface) getInterface();

        try {
            String line = twitchInterface.getReader().readLine();
            TwasiLogger.log.trace("IRC IN: " + line);
            if (line == null) {<commit_msg>Update TwitchCommunicationHandler.java<commit_after>package net.twasi.core.interfaces.twitch;

import net.twasi.core.interfaces.api.CommunicationHandler;
import net.twasi.core.logger.TwasiLogger;
import net.twasi.core.models.Message.TwasiMessage;

import java.io.IOException;

public class TwitchCommunicationHandler extends CommunicationHandler {

    TwitchCommunicationHandler(TwitchInterface inf) {
        super(inf);
    }

    @Override
    public boolean sendMessage(String message) {
        return sendRawMessage("PRIVMSG " + getInterface().getStreamer().getUser().getTwitchAccount().getChannel() + " :" + message);
    }

    @Override
    public boolean sendRawMessage(String rawMessage) {
        try {
            TwasiLogger.log.trace("IRC OUT: " + rawMessage);
            TwitchInterface twitchInterface = (TwitchInterface) getInterface();
            twitchInterface.getWriter().write(rawMessage + "\r\n");
            twitchInterface.getWriter().flush();
            return true;
        } catch (IOException e) {
            TwasiLogger.log.error(e);
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public TwasiMessage readMessage() {
        TwitchInterface twitchInterface = (TwitchInterface) getInterface();

        try {
            String line = twitchInterface.getReader().readLine();
            TwasiLogger.log.trace("IRC IN: " + line);
            if (line == null) {
{'fraction_non_alphanumeric': 0.10842952081147254, 'fraction_numerical': 0.0, 'mean_word_length': 2.823529411764706, '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': '3023641', 'n_tokens_mistral': 783, 'n_tokens_neox': 785, 'n_words': 141}