Correct SM and suicide crash
This commit is contained in:
parent
a1b8c4761c
commit
be84a0a1ad
@ -20,11 +20,12 @@ public class SM implements Commande {
|
|||||||
Redirection redirect= new Redirection();
|
Redirection redirect= new Redirection();
|
||||||
try {
|
try {
|
||||||
String redirectUrl = redirect.get("https://bonjourfetish.tumblr.com/random");
|
String redirectUrl = redirect.get("https://bonjourfetish.tumblr.com/random");
|
||||||
|
logger.debug(redirectUrl);
|
||||||
String img = FindContentOnWebPage.doYourJob(redirectUrl, "article-picture center", "img");
|
String img = FindContentOnWebPage.doYourJob(redirectUrl, "article-picture center", "img");
|
||||||
event.getTextChannel().sendMessage(img).queue();
|
event.getTextChannel().sendMessage(img).queue();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Erreur de redirection.");
|
logger.warn("Redirection fail.");
|
||||||
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: **__Redirection fail (5 attempt), Try again__**:warning: ").queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class FindContentOnWebPage {
|
|||||||
public static String getSourceUrl(String url) throws IOException {
|
public static String getSourceUrl(String url) throws IOException {
|
||||||
URL urlC = new URL(url);
|
URL urlC = new URL(url);
|
||||||
URLConnection yc = urlC.openConnection();
|
URLConnection yc = urlC.openConnection();
|
||||||
yc.setRequestProperty("User-Agent","Googlebot");
|
yc.setRequestProperty("User-Agent","Googlebot/2.1 (+http://www.googlebot.com/bot.html)");
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(
|
BufferedReader in = new BufferedReader(new InputStreamReader(
|
||||||
yc.getInputStream(), "UTF-8"));
|
yc.getInputStream(), "UTF-8"));
|
||||||
String inputLine;
|
String inputLine;
|
||||||
|
@ -24,7 +24,7 @@ public class Redirection {
|
|||||||
public String get(String urlString) throws IOException {
|
public String get(String urlString) throws IOException {
|
||||||
System.setProperty("http.agent","Googlebot");
|
System.setProperty("http.agent","Googlebot");
|
||||||
URLConnection con = new URL(urlString).openConnection();
|
URLConnection con = new URL(urlString).openConnection();
|
||||||
con.setRequestProperty("User-Agent","Googlebot");
|
con.setRequestProperty("User-Agent","Googlebot/2.1 (+http://www.googlebot.com/bot.html)");
|
||||||
//System.out.println( "orignal url: " + con.getURL() );
|
//System.out.println( "orignal url: " + con.getURL() );
|
||||||
con.connect();
|
con.connect();
|
||||||
//System.out.println( "connected url: " + con.getURL() );
|
//System.out.println( "connected url: " + con.getURL() );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
||||||
<meta name="description" content="Claptrap discord bot at your service! Me and beautiful web interface are ready to serve you! Music control, config, news, you can do anything whit my web page!"/>
|
<meta name="description" content="Claptrap discord bot at your service! Add me to your discord server and my beautiful web interface will be there for you ! Music control, config, news, you can do anything with my web page!"/>
|
||||||
<title>Claptrap Bot</title>
|
<title>Claptrap Bot</title>
|
||||||
<link rel="icon"
|
<link rel="icon"
|
||||||
type="image/x-icon"
|
type="image/x-icon"
|
||||||
|
Loading…
Reference in New Issue
Block a user