package com.techcavern.wavetact.ircCommands.fun; import com.techcavern.wavetact.annot.IRCCMD; import com.techcavern.wavetact.objects.IRCCommand; import com.techcavern.wavetact.utils.GeneralUtils; import com.techcavern.wavetact.utils.IRCUtils; import com.techcavern.wavetact.utils.Registry; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import org.pircbotx.Channel; import org.pircbotx.PircBotX; import org.pircbotx.User; @IRCCMD public class FMyLife extends IRCCommand { public FMyLife() { super(GeneralUtils.toArray("fmylife fml"), 1, "fmylife", "Sends random fml", false); } @Override public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel, boolean isPrivate, int userPermLevel, String... args) throws Exception { Document doc = Jsoup.connect("http://m.fmylife.com/random").userAgent(Registry.USER_AGENT).get(); Elements FML = doc.select(".post"); String fmylife = GeneralUtils.stripHTML(FML.get(0).select(".content").toString()); IRCUtils.sendMessage(user, network, channel, fmylife, prefix); } }