Correct redirection Bug

Correct redirection bug on SM commande and implement multi rediction
attempt
This commit is contained in:
BrokenFire 2017-02-03 14:00:47 +01:00
parent 69355fb123
commit 475c968a94
2 changed files with 22 additions and 7 deletions

View File

@ -23,13 +23,28 @@ public class Madame implements Commande{
public void action(String[] args, MessageReceivedEvent event) { public void action(String[] args, MessageReceivedEvent event) {
if(!event.getTextChannel().getName().equals("le_cours")) { if(!event.getTextChannel().getName().equals("le_cours")) {
Redirection redirect = new Redirection(); Redirection redirect = new Redirection();
boolean success=false;
boolean error=false;
int errorCp=0;
while(!success&&!error)
{
try { try {
event.getTextChannel().sendMessage(redirect.get("http://dites.bonjourmadame.fr/random")).queue(); event.getTextChannel().sendMessage(redirect.get("http://dites.bonjourmadame.fr/random")).queue();
success=true;
} catch (IOException e) { } catch (IOException e) {
System.out.println(entete.get("ERREUR", "Madame") + "Erreur de redirection."); errorCp++;
System.out.println(entete.get("WARN", "Madame") + "Erreur de redirection. (Essais n°"+errorCp+")");
if(errorCp>5)
{
System.out.println(entete.get("WARN", "Madame") + "5 Erreur de redirection.");
error=true;
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue();
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection, Réessayez__**:warning: ").queue();
} }
}
}
} }
else else
{ {

View File

@ -25,9 +25,9 @@ public class SM implements Commande {
if(event.getTextChannel().getName().equals("over18")) if(event.getTextChannel().getName().equals("over18"))
{ {
try { try {
event.getTextChannel().sendMessage(redirect.get("http://bonjourfetish.tumblr.com/random")).queue(); event.getTextChannel().sendMessage(redirect.get("https://bonjourfetish.tumblr.com/random")).queue();
} catch (IOException e) { } catch (IOException e) {
System.out.println(entete.get("ERREUR","Pipe")+"Erreur de redirection."); System.out.println(entete.get("ERREUR","SM")+"Erreur de redirection.");
} }
} }
else else