All pastes #396473 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-15 20:00 UTC
rendered paste body
import org.jibble.pircbot.*;
import java.util.Calendar;
import java.lang.System;


	import java.net.*;
import java.io.*;



public class MyBot extends PircBot {
	static int rnd;
	static String welcome = "Heya.";
	static int hour, minute, second;
	static int offset;
		private boolean okay = true;

	static long last_send = currentTimeMillis();
	Calendar rightNow = Calendar.getInstance();			

    public MyBot() {	
        this.setName("Rawbot");
	sendMessage("Q@CServe.quakenet.org", "AUTH Rawbits ZAWESOME");
    }


public class URLReader extends PircBot {
    public void main(String[] args) throws Exception {
	int Line;
	URL yahoo = new URL("http://www.fun-motion.com/forums/search.php?do=getnew");
	BufferedReader in = new BufferedReader(
				new InputStreamReader(
				yahoo.openStream()));

	String inputLine;

	while ((inputLine = in.readLine()) != null) {
		Line = inputLine.indexOf("http://www.fun-motion.com/forums/showthread.php");
	    if (Line > -1) {
			sendMessage("#fun-motion", "A new post on the forums!");
			sendMessage("#fun-motion", inputLine.substring(Line, 20));
	}
	}

	in.close();
    }
}
    
    public void onMessage(String channel, String sender, String login, String hostname, String message)
     {

	if (currentTimeMillis() - last_send > 5000) 
          { 
           if(message.equalsIgnoreCase("hey"))
            {
                    sendMessage(channel, "how are you");
                    last_send = System.currentTimeMillis;
             }

          }