ClaptrapBot/src/main/java/net/Broken/Commandes/Over18/Pipe.java

58 lines
1.8 KiB
Java
Raw Normal View History

2017-03-20 21:01:49 +01:00
package net.Broken.Commandes.Over18;
2016-12-08 20:05:23 +01:00
2017-03-20 21:01:49 +01:00
import net.Broken.Commandes.NumberedCommande;
import org.apache.logging.log4j.LogManager;
2016-12-08 20:05:23 +01:00
/**
* Created by seb65 on 07/11/2016.
*/
2017-03-20 18:36:26 +01:00
public class Pipe extends NumberedCommande {
public Pipe() {
2017-05-10 21:43:44 +02:00
super(LogManager.getLogger(), "http://feelation.com/","featured-img","img");
2016-12-08 20:05:23 +01:00
}
2017-03-20 18:36:26 +01:00
/*
System.out.println("ok");
2017-02-08 23:53:50 +01:00
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();
2016-12-08 20:05:23 +01:00
event.getTextChannel().sendMessage(redirect.get("http://feelation.com/random")).queue();
2017-03-20 18:36:26 +01:00
*/
2017-03-20 21:01:49 +01:00
@Override
public String toString() {
return "Pipe";
}
2017-09-05 02:13:27 +02:00
@Override
public boolean isPrivateUsable() {
return false;
}
2016-12-08 20:05:23 +01:00
}