Somme code refractor

This commit is contained in:
Sebastien 2018-11-22 15:31:26 +02:00
parent 40a4efe714
commit c3ff5a9ad1
3 changed files with 9 additions and 30 deletions

View File

@ -34,7 +34,7 @@ public class Init {
* @param dev dev Mode or not * @param dev dev Mode or not
* @return JDA object * @return JDA object
*/ */
static JDA initJda(String token, boolean dev){ static JDA initJda(String token){
JDA jda = null; JDA jda = null;
logger.debug("-------------------INITIALISATION-------------------"); logger.debug("-------------------INITIALISATION-------------------");

View File

@ -53,25 +53,12 @@ public class MainBot {
logger.info("--------------Starting Bot-------------"); logger.info("--------------Starting Bot-------------");
logger.info("======================================="); logger.info("=======================================");
if(System.getenv("DEV")!= null){
dev = Boolean.parseBoolean(System.getenv("DEV"));
}
String token = System.getenv("TOKEN");
String token = null; jda = Init.initJda(token);
int i = 0;
for(String aArg: args){
logger.debug(aArg);
if(aArg.startsWith("--") || aArg.startsWith("-")){
aArg = aArg.replaceAll("-","");
if(aArg.equals("dev") || aArg.equals("d")){
dev = true;
}
}
i++;
}
token = System.getenv("TOKEN");
jda = Init.initJda(token, dev);
if(System.getenv("dev")!= null){
dev = true;
}
ConfigurableApplicationContext ctx = SpringApplication.run(MainBot.class, args); ConfigurableApplicationContext ctx = SpringApplication.run(MainBot.class, args);
@ -85,14 +72,6 @@ public class MainBot {
Init.polish(jda); Init.polish(jda);
ready = true; ready = true;
} }
/** /**

View File

@ -40,7 +40,7 @@ public class LimitChecker {
} }
number-=400; number-=400;
redirected = false; redirected = false;
logger.trace("First pass: "+number); logger.debug("First pass: "+number);
while(!redirected ) while(!redirected )
{ {
String origin = baseURL+number+"-2/"; String origin = baseURL+number+"-2/";
@ -53,7 +53,7 @@ public class LimitChecker {
} }
number-=90; number-=90;
redirected = false; redirected = false;
logger.trace("Second pass: "+number); logger.debug("Second pass: "+number);
while(!redirected ) while(!redirected )
{ {
String origin = baseURL+number+"-2/"; String origin = baseURL+number+"-2/";
@ -66,7 +66,7 @@ public class LimitChecker {
} }
number-=9; number-=9;
redirected = false; redirected = false;
logger.trace("Third pass: "+number); logger.debug("Third pass: "+number);
while(!redirected ) while(!redirected )
{ {
String origin = baseURL+number+"-2/"; String origin = baseURL+number+"-2/";
@ -78,7 +78,7 @@ public class LimitChecker {
redirected = true; redirected = true;
} }
number-=1; number-=1;
logger.trace("Final pass: "+number); logger.debug("Final pass: "+number);
return number; return number;