Adding redirection error message
This commit is contained in:
parent
e4287a2a33
commit
ef1a138717
@ -1,6 +1,6 @@
|
|||||||
package net.borken;
|
package net.borken;
|
||||||
|
|
||||||
import net.dv8tion.jda.*;
|
|
||||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@ public class Ass implements Commande{
|
|||||||
event.getTextChannel().sendMessage(redirect.get("http://les400culs.com/random")).queue();
|
event.getTextChannel().sendMessage(redirect.get("http://les400culs.com/random")).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Erreur de redirection.");
|
logger.warn("Erreur de redirection.");
|
||||||
|
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class Boobs implements Commande {
|
|||||||
event.getTextChannel().sendMessage(redirect.get("http://lesaintdesseins.fr/random")).queue();
|
event.getTextChannel().sendMessage(redirect.get("http://lesaintdesseins.fr/random")).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Erreur de redirection.");
|
logger.warn("Erreur de redirection.");
|
||||||
|
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -9,7 +9,6 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static net.borken.MainBot.entete;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by seb65 on 11/11/2016.
|
* Created by seb65 on 11/11/2016.
|
||||||
|
@ -6,7 +6,11 @@ import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by seb65 on 07/11/2016.
|
* Created by seb65 on 07/11/2016.
|
||||||
@ -21,14 +25,48 @@ public class Pipe implements Commande {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void action(String[] args, MessageReceivedEvent event) {
|
public void action(String[] args, MessageReceivedEvent event) {
|
||||||
|
|
||||||
Redirection redirect= new Redirection();
|
Redirection redirect= new Redirection();
|
||||||
if(event.getTextChannel().getName().equals("over18"))
|
if(event.getTextChannel().getName().equals("over18"))
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
System.out.println("ok");
|
||||||
|
String pipeLine=null;
|
||||||
|
URL pipeURL = new URL(redirect.get("http://feelation.com/random"));
|
||||||
|
URLConnection cc = pipeURL.openConnection();
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(cc.getInputStream(), "UTF-8"));
|
||||||
|
String inputLine;
|
||||||
|
|
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null)
|
||||||
|
{
|
||||||
|
System.out.println(inputLine);
|
||||||
|
if(inputLine.contains("class=\"post photo\""))
|
||||||
|
{
|
||||||
|
String[] splited = inputLine.split("<");
|
||||||
|
for(String aString:splited)
|
||||||
|
{
|
||||||
|
if(aString.startsWith("<img src"))
|
||||||
|
{
|
||||||
|
pipeLine=aString;
|
||||||
|
pipeLine=inputLine.replaceAll("<img src=\"","");
|
||||||
|
pipeLine=pipeLine.substring(0,pipeLine.indexOf("\""));
|
||||||
|
System.out.println(pipeLine);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
event.getTextChannel().sendMessage(redirect.get("http://feelation.com/random")).queue();
|
event.getTextChannel().sendMessage(redirect.get("http://feelation.com/random")).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Erreur de redirection.");
|
logger.warn("Erreur de redirection.");
|
||||||
|
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue();
|
||||||
|
System.out.println("erreur");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -28,6 +28,7 @@ public class SM implements Commande {
|
|||||||
event.getTextChannel().sendMessage(redirect.get("https://bonjourfetish.tumblr.com/random")).queue();
|
event.getTextChannel().sendMessage(redirect.get("https://bonjourfetish.tumblr.com/random")).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Erreur de redirection.");
|
logger.warn("Erreur de redirection.");
|
||||||
|
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user