Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.regex.*;
- import org.jibble.pircbot.*;
- import java.lang.System;
- public class MyBot extends PircBot {
- String message = null;
- String currentIP = null;
- Integer draftStatus = 0;
- Pattern pailCommand = Pattern.compile("(+.) is (+.)");
- public MyBot() {
- this.setName("Pail");
- }
- public void onMessage(String channel, String sender,
- String login, String hostname, String message) {
- if (message.equalsIgnoreCase("time")) {
- String time = new java.util.Date().toString();
- sendMessage(channel, sender + ": The time is now " + time);
- }
- if (message.equalsIgnoreCase("nammfoodle's hosting")) {
- currentIP = "99.3.174.67";
- draftStatus = 1;
- sendMessage(channel, "Best. Host. Evar.");
- }
- if (message.equalsIgnoreCase("full")) {
- draftStatus = 0;
- sendMessage(channel, "No more seats.");
- }
- if (message.equalsIgnoreCase("drafts?")||message.equalsIgnoreCase("ip?")||message.equalsIgnoreCase("draft?")||message.equalsIgnoreCase("any drafts?")) {
- if (draftStatus==1){
- sendMessage(channel, currentIP);
- }
- }
- if (message.equalsIgnoreCase("pail: go away")) {
- sendMessage(channel, "I know when I'm not wanted.");
- disconnect();
- System.exit(0);
- }
- if (message.equalsIgnoreCase("Newbie Pack")) {
- sendMessage(channel, ": New To Netdraft -- netdraft.wikispaces.com/newbie New To Hosting -- netdraft.wikispaces.com/hosting");
- }
- if(message.indexOf("Pail: My IP is ")==0){
- draftStatus = 1;
- currentIP = message.substring(15,message.length());
- sendMessage(channel, "Cool, I'll advertise for you.");
- }
- if(message.indexOf("Pail: ")==0){
- message = message.substring(6,message.length());
- Matcher m = pailCommand.matcher(message);
- boolean b = m.matches();
- if(b==true){
- sendMessage(channel, "success!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement