shoudl safe content again as data in the DB

This commit is contained in:
jenzuffer 2020-11-02 09:05:41 +01:00
parent 45e18c2a99
commit 7b1f95bcd5
6 changed files with 6 additions and 9 deletions

View File

@ -179,7 +179,7 @@ public class Datahandler {
public void updateStringCache() { public void updateStringCache() {
try { try {
checkIfUpdateStrings(true); checkIfUpdateStrings();
} catch (CustomError ex) { } catch (CustomError ex) {
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
} }
@ -413,7 +413,7 @@ public class Datahandler {
return stringIteratorComparator(strmap, strCacheLocal, localJMWEMap, localPipelineAnnotation, localPipelineSentimentAnnotation, localCoreDocumentMap); return stringIteratorComparator(strmap, strCacheLocal, localJMWEMap, localPipelineAnnotation, localPipelineSentimentAnnotation, localCoreDocumentMap);
} }
public synchronized void checkIfUpdateStrings(boolean hlStatsMsg) throws CustomError { public synchronized void checkIfUpdateStrings() throws CustomError {
if (stopwatch.elapsed(TimeUnit.SECONDS) >= EXPIRE_TIME_IN_SECONDS || !stopwatch.isRunning()) { if (stopwatch.elapsed(TimeUnit.SECONDS) >= EXPIRE_TIME_IN_SECONDS || !stopwatch.isRunning()) {
ConcurrentMap<Integer, String> str = MessageResponseHandler.getStr(); ConcurrentMap<Integer, String> str = MessageResponseHandler.getStr();
System.out.println("str size: " + str.size()); System.out.println("str size: " + str.size());

View File

@ -57,15 +57,13 @@ public class DoStuff {
} }
} }
List<User> blockLast = event.getMessage().getUserMentions().buffer().blockLast(); List<User> blockLast = event.getMessage().getUserMentions().buffer().blockLast();
if (!channelpermissionsDenied && blockLast != null) {
String content = event.getMessage().getContent(); String content = event.getMessage().getContent();
if (blockLast != null) { if (!channelpermissionsDenied && blockLast != null) {
for (User user : blockLast) { for (User user : blockLast) {
content = content.replace(user.getId().asString(), ""); content = content.replace(user.getId().asString(), "");
} }
} }
MessageResponseHandler.getMessage(content); MessageResponseHandler.getMessage(content);
}
boolean mentionedBot = false; boolean mentionedBot = false;
if (blockLast != null){ if (blockLast != null){
for (User user : blockLast) for (User user : blockLast)
@ -80,7 +78,6 @@ public class DoStuff {
if (mentionedBot || channelName.contains("general-autism")) { if (mentionedBot || channelName.contains("general-autism")) {
try { try {
String ResponseStr; String ResponseStr;
String content = event.getMessage().getContent();
ResponseStr = MessageResponseHandler.selectReponseMessage(content, username); ResponseStr = MessageResponseHandler.selectReponseMessage(content, username);
if (!ResponseStr.isEmpty()) { if (!ResponseStr.isEmpty()) {
System.out.print("\nResponseStr3: " + ResponseStr + "\n"); System.out.print("\nResponseStr3: " + ResponseStr + "\n");
@ -93,7 +90,7 @@ public class DoStuff {
} }
new Thread(() -> { new Thread(() -> {
try { try {
Datahandler.instance.checkIfUpdateStrings(false); Datahandler.instance.checkIfUpdateStrings();
} catch (CustomError ex) { } catch (CustomError ex) {
Logger.getLogger(DiscordHandler.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(DiscordHandler.class.getName()).log(Level.SEVERE, null, ex);
} }

View File

@ -1,5 +1,5 @@
#Generated by Maven #Generated by Maven
#Sun Nov 01 23:59:26 CET 2020 #Mon Nov 02 09:03:03 CET 2020
version=1.0 version=1.0
groupId=com.mycompany groupId=com.mycompany
artifactId=ArtificialAutism artifactId=ArtificialAutism