package Tutorials.de;
import java.io.IOException;
import org.jibble.pircbot.*;
import javax.swing.*;
import java.awt.event.*;
public class Bot extends PircBot implements ActionListener{
private String server = null;
private String channel = null;
private String nick = null;
private String onJoin = null;
private Timer timer = null;
private int delay = 10000;
public void actionPerformed(ActionEvent evt) {
this.sendMessage(channel, "Another 10 Secs gone ...");
}
public Bot(String svr, String chan, String nick, String pw){
this.server = svr;
this.channel = chan;
this.nick = nick;
this.onJoin = pw;
}
public void connect(){
if(server != null && channel != null && nick != null ){
try {
this.setName(nick);
this.connect(server);
this.joinChannel(channel);
this.sendMessage(channel,onJoin);
} catch (NickAlreadyInUseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IrcException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
timer = new Timer(delay , this);
timer.start();
}
public void stopTask(){
timer.stop();
}
}