Forget to check advertisement on daily madame
This commit is contained in:
parent
16ba70b650
commit
2d17b1c295
@ -32,7 +32,7 @@ public class Madame implements Commande{
|
||||
|
||||
String url = redirect.get("http://dites.bonjourmadame.fr/random");
|
||||
logger.debug("URL: "+url);
|
||||
if(scanPageForTipeee(url)){
|
||||
if(scanPageForTipeee(url, logger)){
|
||||
logger.debug("Advertisement detected! Retry! ("+url+")");
|
||||
}
|
||||
else{
|
||||
@ -82,7 +82,7 @@ public class Madame implements Commande{
|
||||
* @throws StringIndexOutOfBoundsException
|
||||
* @throws IOException
|
||||
*/
|
||||
private boolean scanPageForTipeee(String url) throws StringIndexOutOfBoundsException, IOException{
|
||||
public static boolean scanPageForTipeee(String url, Logger logger) throws StringIndexOutOfBoundsException, IOException{
|
||||
String content = FindContentOnWebPage.getSourceUrl(url);
|
||||
String imgClickLink = content.substring(content.indexOf("photo post"));
|
||||
imgClickLink = imgClickLink.substring(imgClickLink.indexOf("<a"));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Broken.Tools.DayListener.Listeners;
|
||||
|
||||
import net.Broken.Commands.Over18.Madame;
|
||||
import net.Broken.MainBot;
|
||||
import net.Broken.Tools.DayListener.NewDayListener;
|
||||
import net.Broken.Tools.Redirection;
|
||||
@ -24,8 +25,16 @@ public class DailyMadame implements NewDayListener{
|
||||
while(!success && !error)
|
||||
{
|
||||
try {
|
||||
|
||||
String url = redirect.get("http://dites.bonjourmadame.fr/random");
|
||||
logger.debug("URL: "+url);
|
||||
if(Madame.scanPageForTipeee(url, logger)){
|
||||
logger.debug("Advertisement detected! Retry! ("+url+")");
|
||||
}
|
||||
else{
|
||||
chanel.sendMessage("Le Daily Madame mes petits cochons :kissing_heart:\n" + redirect.get("http://dites.bonjourmadame.fr/random")).queue();
|
||||
success=true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
errorCp++;
|
||||
logger.warn("Erreur de redirection. (Essais n°"+errorCp+")");
|
||||
|
Loading…
Reference in New Issue
Block a user