Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. import java.util.regex.*;
  2. import org.jibble.pircbot.*;
  3. import java.lang.System;
  4.  
  5. public class MyBot extends PircBot {
  6.  
  7. String message = null;
  8. String currentIP = null;
  9. Integer draftStatus = 0;
  10. Pattern pailCommand = Pattern.compile("(+.) is (+.)");
  11. public MyBot() {
  12. this.setName("Pail");
  13. }
  14.  
  15. public void onMessage(String channel, String sender,
  16. String login, String hostname, String message) {
  17. if (message.equalsIgnoreCase("time")) {
  18. String time = new java.util.Date().toString();
  19. sendMessage(channel, sender + ": The time is now " + time);
  20. }
  21. if (message.equalsIgnoreCase("nammfoodle's hosting")) {
  22. currentIP = "99.3.174.67";
  23. draftStatus = 1;
  24. sendMessage(channel, "Best. Host. Evar.");
  25. }
  26. if (message.equalsIgnoreCase("full")) {
  27. draftStatus = 0;
  28. sendMessage(channel, "No more seats.");
  29. }
  30. if (message.equalsIgnoreCase("drafts?")||message.equalsIgnoreCase("ip?")||message.equalsIgnoreCase("draft?")||message.equalsIgnoreCase("any drafts?")) {
  31. if (draftStatus==1){
  32. sendMessage(channel, currentIP);
  33. }
  34. }
  35. if (message.equalsIgnoreCase("pail: go away")) {
  36. sendMessage(channel, "I know when I'm not wanted.");
  37. disconnect();
  38. System.exit(0);
  39. }
  40. if (message.equalsIgnoreCase("Newbie Pack")) {
  41. sendMessage(channel, ": New To Netdraft -- netdraft.wikispaces.com/newbie New To Hosting -- netdraft.wikispaces.com/hosting");
  42. }
  43. if(message.indexOf("Pail: My IP is ")==0){
  44. draftStatus = 1;
  45. currentIP = message.substring(15,message.length());
  46. sendMessage(channel, "Cool, I'll advertise for you.");
  47. }
  48. if(message.indexOf("Pail: ")==0){
  49. message = message.substring(6,message.length());
  50. Matcher m = pailCommand.matcher(message);
  51. boolean b = m.matches();
  52. if(b==true){
  53. sendMessage(channel, "success!");
  54. }
  55.  
  56. }
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement