again fixing chatting
This commit is contained in:
parent
28da2af22f
commit
868a75a040
@ -769,11 +769,7 @@ public class Datahandler {
|
|||||||
|
|
||||||
public void update_autismo_socket_msg() {
|
public void update_autismo_socket_msg() {
|
||||||
try {
|
try {
|
||||||
List<Integer> portlists = new ArrayList<>();
|
try (DatagramSocket serverSocket = new DatagramSocket(48477)) {
|
||||||
portlists.add(48477);
|
|
||||||
portlists.add(48478);
|
|
||||||
for (Integer port : portlists)
|
|
||||||
try (DatagramSocket serverSocket = new DatagramSocket(port)) {
|
|
||||||
byte[] receiveData = new byte[4096];
|
byte[] receiveData = new byte[4096];
|
||||||
InetAddress IPAddress = InetAddress.getByName("144.76.218.19");
|
InetAddress IPAddress = InetAddress.getByName("144.76.218.19");
|
||||||
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
||||||
@ -783,7 +779,34 @@ public class Datahandler {
|
|||||||
sentence = sentence.replace("clientmessage:", "");
|
sentence = sentence.replace("clientmessage:", "");
|
||||||
String getResponseMsg = getResponseMsg(sentence);
|
String getResponseMsg = getResponseMsg(sentence);
|
||||||
byte[] sendData = getResponseMsg.getBytes("UTF-8");
|
byte[] sendData = getResponseMsg.getBytes("UTF-8");
|
||||||
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
|
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 48477);
|
||||||
|
serverSocket.send(sendPacket);
|
||||||
|
}
|
||||||
|
} catch (CustomError ex) {
|
||||||
|
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
} catch (SocketException ex) {
|
||||||
|
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_autismo_socket_msg1() {
|
||||||
|
try {
|
||||||
|
try (DatagramSocket serverSocket = new DatagramSocket(48478)) {
|
||||||
|
byte[] receiveData = new byte[4096];
|
||||||
|
InetAddress IPAddress = InetAddress.getByName("144.76.218.19");
|
||||||
|
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
||||||
|
while (true) {
|
||||||
|
serverSocket.receive(receivePacket);
|
||||||
|
String sentence = new String(receivePacket.getData(), 0, receivePacket.getLength());
|
||||||
|
sentence = sentence.replace("clientmessage:", "");
|
||||||
|
String getResponseMsg = getResponseMsg(sentence);
|
||||||
|
byte[] sendData = getResponseMsg.getBytes("UTF-8");
|
||||||
|
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 48478);
|
||||||
serverSocket.send(sendPacket);
|
serverSocket.send(sendPacket);
|
||||||
}
|
}
|
||||||
} catch (CustomError ex) {
|
} catch (CustomError ex) {
|
||||||
@ -809,6 +832,8 @@ public class Datahandler {
|
|||||||
annotationsT.add(ann);
|
annotationsT.add(ann);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static ConcurrentMap<String, CoreDocument> getMultipleCoreDocumentsWaySuggestion(Collection<String> str, StanfordCoreNLP localNLP) {
|
public static ConcurrentMap<String, CoreDocument> getMultipleCoreDocumentsWaySuggestion(Collection<String> str, StanfordCoreNLP localNLP) {
|
||||||
AnnotationCollector<Annotation> annCollector = new AnnotationCollector();
|
AnnotationCollector<Annotation> annCollector = new AnnotationCollector();
|
||||||
|
@ -61,6 +61,9 @@ public class DiscordHandler {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Datahandler.instance.update_autismo_socket_msg();
|
Datahandler.instance.update_autismo_socket_msg();
|
||||||
}).start();
|
}).start();
|
||||||
|
new Thread(() -> {
|
||||||
|
Datahandler.instance.update_autismo_socket_msg1();
|
||||||
|
}).start();
|
||||||
gateway.on(MessageCreateEvent.class).subscribe(event -> {
|
gateway.on(MessageCreateEvent.class).subscribe(event -> {
|
||||||
if (!FunctionLayer.DoStuff.isOccupied()) {
|
if (!FunctionLayer.DoStuff.isOccupied()) {
|
||||||
FunctionLayer.DoStuff.doStuff(event, usernameBot);
|
FunctionLayer.DoStuff.doStuff(event, usernameBot);
|
||||||
|
Loading…
Reference in New Issue
Block a user