added config file to read from and moved autism bot over to backups/demos vm
This commit is contained in:
parent
f0fa8b0de1
commit
138e887a80
@ -5,8 +5,12 @@
|
||||
*/
|
||||
package DataLayer;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -21,10 +25,17 @@ public class DBCPDataSource {
|
||||
|
||||
static {
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
String fileName = "app.config";
|
||||
try (FileInputStream fis = new FileInputStream(fileName)) {
|
||||
prop.load(fis);
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
ds.setUrl(settings.url);
|
||||
ds.setUsername(settings.username);
|
||||
ds.setPassword(settings.password);
|
||||
ds.setUrl(prop.getProperty("app.url"));
|
||||
ds.setUsername(prop.getProperty("app.username"));
|
||||
ds.setPassword(prop.getProperty("app.password"));
|
||||
ds.setMaxTotal(-1);
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
|
@ -3,15 +3,27 @@ package DataLayer;
|
||||
import FunctionLayer.Datahandler;
|
||||
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class ThreadClient {
|
||||
public ThreadClient(int port, Datahandler datahandler, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) {
|
||||
String hostIP = new settings().getHostIP();
|
||||
if (port == new settings().getHostport() || port == new settings().getHostport2()) {
|
||||
hostIP = new settings().getHostIP2();
|
||||
Properties prop = new Properties();
|
||||
String fileName = "app.config";
|
||||
try (FileInputStream fis = new FileInputStream(fileName)) {
|
||||
prop.load(fis);
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
String hostIP = prop.getProperty("app.hostip");
|
||||
if (port == Integer.valueOf(prop.getProperty("app.hostport"))
|
||||
|| port == Integer.valueOf(prop.getProperty("app.hostport2"))) {
|
||||
hostIP = prop.getProperty("app.hostip2");
|
||||
}
|
||||
try {
|
||||
InetAddress ipAddress = InetAddress.getByName(hostIP);//used ip's
|
||||
|
@ -17,12 +17,15 @@ import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
||||
@ -46,7 +49,14 @@ public class DiscordHandler extends ListenerAdapter {
|
||||
System.out.println("FINISHED ALL ANNOTATIONS");
|
||||
String strF = datahandler.trimString("abcdef");
|
||||
datahandler.getResponseFutures(strF, stanfordCoreNLP, stanfordCoreNLPSentiment);
|
||||
String token = new settings().getDiscordToken();
|
||||
Properties prop = new Properties();
|
||||
String fileName = "app.config";
|
||||
try (FileInputStream fis = new FileInputStream(fileName)) {
|
||||
prop.load(fis);
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
String token = prop.getProperty("app.discordtoken");
|
||||
|
||||
try {
|
||||
JDABuilder.createLight(token, GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
||||
|
Loading…
Reference in New Issue
Block a user