updated datagram sockets, had managed to fuck up the port
This commit is contained in:
parent
eb7ed76d2e
commit
10eedf6529
@ -93,7 +93,7 @@ public class DataMapper {
|
|||||||
ResultSet resultSet = l_pStatement.executeQuery();
|
ResultSet resultSet = l_pStatement.executeQuery();
|
||||||
if (resultSet.next()) {
|
if (resultSet.next()) {
|
||||||
int count = resultSet.getInt(1);
|
int count = resultSet.getInt(1);
|
||||||
if (count > 35000) {
|
if (count > 13000) {
|
||||||
//System.out.println("cleaning strings: " + l_sSQL);
|
//System.out.println("cleaning strings: " + l_sSQL);
|
||||||
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
||||||
l_pStatement.executeUpdate();
|
l_pStatement.executeUpdate();
|
||||||
|
@ -8,16 +8,14 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
|
||||||
public class ThreadClient {
|
public class ThreadClient {
|
||||||
|
|
||||||
|
|
||||||
public ThreadClient(int port, Datahandler datahandler, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) {
|
public ThreadClient(int port, Datahandler datahandler, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) {
|
||||||
String hostIP = new settings().getHostIP();
|
String hostIP = new settings().getHostIP();
|
||||||
if (port == new settings().getHostport() || port == new settings().getHostport2()) {
|
if (port == new settings().getHostport() || port == new settings().getHostport2()) {
|
||||||
hostIP = new settings().getHostIP2();
|
hostIP = new settings().getHostIP2();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
InetAddress ipAddress = InetAddress.getByName(hostIP);//used ip'
|
InetAddress ipAddress = InetAddress.getByName(hostIP);//used ip's
|
||||||
try (DatagramSocket serverSocket = new DatagramSocket()) {
|
try (DatagramSocket serverSocket = new DatagramSocket(port)) {
|
||||||
while (true) {
|
while (true) {
|
||||||
receiveAndSendPacket(serverSocket, ipAddress, port, datahandler, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
receiveAndSendPacket(serverSocket, ipAddress, port, datahandler, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
||||||
}
|
}
|
||||||
@ -30,7 +28,7 @@ public class ThreadClient {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void receiveAndSendPacket(DatagramSocket serverSocket, InetAddress ipAddress, int port,
|
private static void receiveAndSendPacket(DatagramSocket serverSocket, InetAddress ipAddress, int port,
|
||||||
Datahandler datahandler, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) throws
|
Datahandler datahandler, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) throws
|
||||||
@ -42,7 +40,6 @@ public class ThreadClient {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
new Thread(() -> {
|
|
||||||
String sentence = new String(receivePacket.getData(), 0,
|
String sentence = new String(receivePacket.getData(), 0,
|
||||||
receivePacket.getLength());
|
receivePacket.getLength());
|
||||||
sentence = sentence.replace("clientmessage:", "");
|
sentence = sentence.replace("clientmessage:", "");
|
||||||
@ -75,6 +72,5 @@ public class ThreadClient {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,14 +44,18 @@ public class DiscordHandler extends ListenerAdapter {
|
|||||||
stanfordCoreNLPSentiment = datahandler.shiftReduceParserInitiate();
|
stanfordCoreNLPSentiment = datahandler.shiftReduceParserInitiate();
|
||||||
|
|
||||||
System.out.println("FINISHED ALL ANNOTATIONS");
|
System.out.println("FINISHED ALL ANNOTATIONS");
|
||||||
System.out.println("updatedstring cache");
|
|
||||||
String strF = datahandler.trimString("abcdef");
|
String strF = datahandler.trimString("abcdef");
|
||||||
datahandler.getResponseFutures(strF, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
datahandler.getResponseFutures(strF, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
||||||
String token = new settings().getDiscordToken();
|
String token = new settings().getDiscordToken();
|
||||||
|
|
||||||
|
try {
|
||||||
JDABuilder.createLight(token, GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
JDABuilder.createLight(token, GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
||||||
.addEventListeners(new DiscordHandler())
|
.addEventListeners(new DiscordHandler())
|
||||||
.setActivity(Activity.playing("Being the autism bot"))
|
.setActivity(Activity.playing("Being the autism bot"))
|
||||||
.build();
|
.build();
|
||||||
|
} catch (LoginException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<Integer> ports = new ArrayList<Integer>();
|
ArrayList<Integer> ports = new ArrayList<Integer>();
|
||||||
ports.add(48475);
|
ports.add(48475);
|
||||||
@ -59,10 +63,13 @@ public class DiscordHandler extends ListenerAdapter {
|
|||||||
ports.add(48477);
|
ports.add(48477);
|
||||||
ports.add(48478);
|
ports.add(48478);
|
||||||
for (Integer port : ports) {
|
for (Integer port : ports) {
|
||||||
|
new Thread(() -> {
|
||||||
new ThreadClient(port, datahandler, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
new ThreadClient(port, datahandler, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageReceivedEvent event) {
|
public void onMessageReceived(MessageReceivedEvent event) {
|
||||||
String content = event.getMessage().getContentRaw();
|
String content = event.getMessage().getContentRaw();
|
||||||
|
Loading…
Reference in New Issue
Block a user