package DataLayer;

import FunctionLayer.Datahandler;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import discord4j.core.event.domain.lifecycle.ReadyEvent;
import discord4j.core.event.domain.message.MessageCreateEvent;
import discord4j.core.object.entity.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;

import java.io.IOException;
import java.net.*;

public class RunnerClient {

    public RunnerClient(String contentF, boolean mentionedBot, String channelName, Datahandler datahandler,
                        StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment,
                        MessageReceivedEvent event, String username) {
        if (mentionedBot || channelName.contains("general-autism")) {
            String ResponseStr = datahandler.getResponseMsg(contentF, username,
                    stanfordCoreNLP, stanfordCoreNLPSentiment,
                    false);
            if (!ResponseStr.isEmpty()) {
                System.out.print("\nResponseStr3: " + ResponseStr + "\n");
                event.getMessage().getChannel().sendMessage(ResponseStr).queue();
            }
        } else {
            String strF = datahandler.trimString(contentF);
            datahandler.getResponseFutures(strF, stanfordCoreNLP, stanfordCoreNLPSentiment);
        }
    }
}
