Esempio n. 1
0
 static boolean listAllInfo(String sourceNick) {
   try {
     System.err.println(" >>> Listing all known info");
     sendToIRC("PRIVMSG " + sourceNick + " :Here's a list of everything I have: \r\n");
     for (String s : openFile()) {
       sendToIRC("PRIVMSG " + sourceNick + " :" + s);
     }
     return true;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return false;
 }
Esempio n. 2
0
 static boolean privelegedExecute(
     String tempLine, String command, String sourceChan, String sourceNick) {
   System.err.println(" >>> Command is " + command);
   if (command.contains("quit")) {
     try {
       System.err.println(" >>> Quitting");
       sendToIRC("PRIVMSG " + sourceChan + " :bye!\r\n");
     } catch (Exception e) {
       System.err.println("Bad substring in &quit");
     }
     System.exit(0);
     return true;
   } else if (command.contains("restart")) {
     System.err.println(" >>> Restarting..");
     try {
       cs.close();
     } catch (Exception e) {
       e.printStackTrace();
     }
     startMe();
     return true;
   }
   unPrivedExec(tempLine, command, sourceChan, sourceNick);
   return false;
 }
Esempio n. 3
0
  static boolean replyFaggot(String tempLine) {
    System.err.print(" >>> F****t message ");
    try {
      String sourceChan =
          tempLine.substring(
              tempLine.indexOf("PRIVMSG ") + 8,
              tempLine.indexOf(' ', tempLine.indexOf("PRIVMSG ") + 10));
      String tnick = "";
      if (tempLine.indexOf('?', tempLine.indexOf("who is ")) > 0)
        tnick =
            tempLine.substring(
                tempLine.indexOf("who is ") + 7,
                tempLine.indexOf('?', tempLine.indexOf("who is ")));
      else if (tempLine.indexOf('!', tempLine.indexOf("who is ")) > 0)
        tnick =
            tempLine.substring(
                tempLine.indexOf("who is ") + 7,
                tempLine.indexOf('!', tempLine.indexOf("who is ")));
      else if (tempLine.indexOf(' ', tempLine.indexOf("who is ") + 8) > 0)
        tnick =
            tempLine.substring(
                tempLine.indexOf("who is ") + 7,
                tempLine.indexOf(' ', tempLine.indexOf("who is ") + 8));
      else tnick = tempLine.substring(tempLine.indexOf("who is ") + 7);

      System.err.print("to tnick: " + tnick + "\n");
      if (tnick.contains(NICK)) sendToIRC("PRIVMSG " + sourceChan + " :" + "I am a f****t.\r\n");
      else if (tnick.equals(OWNER))
        sendToIRC(
            "PRIVMSG "
                + sourceChan
                + " :"
                + "According to my tests, "
                + OWNER
                + " isn't a f****t.\r\n");
      else sendToIRC("PRIVMSG " + sourceChan + " :" + tnick + " is a f****t.\r\n");
      return true;
    } catch (Exception e) {
      System.err.println("Bad substring in replyFaggot");
    }
    return false;
  }
Esempio n. 4
0
 static boolean sendUsage(String sourceChan) {
   try {
     System.err.println(" >>> Printing usage to " + sourceChan);
     sendToIRC(
         "PRIVMSG "
             + sourceChan
             + " :I can do so many things! &quit, &restart, &version, &halp, &info show all, &info show [descriptor], &info add [descriptor] - [link].\r\n");
     return true;
   } catch (Exception e) {
     System.err.println("Problems in sendUsage");
   }
   return false;
 }
Esempio n. 5
0
  static boolean startMe() {
    try {
      cs = new Socket(SERVER, PORT);
      sout = new PrintWriter(cs.getOutputStream());
      sin = new Scanner(new BufferedInputStream(cs.getInputStream()));

      sendToIRC("NICK " + NICK + "\r\n");
      sendToIRC("USER " + USER + "\r\n");
      sendToIRC("PRIVMSG nickserv :identify whataFUCKINGfatOassOWodForthisBot\r\n");
      for (String s : CHANNELS) {
        sendToIRC("JOIN " + s + "\r\n");
      }
      sout.flush();
      while (true) {
        String tempLine = sin.nextLine();
        String sourceChan = "linkxs";
        String sourceNick = tempLine.substring(tempLine.indexOf(":"), tempLine.indexOf("!"));
        try {
          sourceChan =
              tempLine.substring(
                  tempLine.indexOf("PRIVMSG ") + 8, tempLine.indexOf(' ', tempLine.indexOf(" :")));
        } catch (Exception e) {
        }
        System.out.println(tempLine);
        if (tempLine.contains("PING")) {
          tempLine.replace("PING", "PONG");
          sendToIRC(tempLine + "\r\n");
        } else if (tempLine.contains("infobott :")) {
          if (tempLine.contains("infobott :VERSION") || tempLine.contains("infobott :version")) {
            sendVersion(tempLine.substring(1, tempLine.indexOf('!')));
          }
        } else if (tempLine.contains(" :&")) {
          if (tempLine.startsWith(":[email protected]")) {
            System.err.println(
                " >>> Obey the master! Outcome: "
                    + privelegedExecute(
                        tempLine,
                        tempLine.substring(tempLine.indexOf('&')),
                        sourceChan,
                        sourceNick));
          } else {
            System.err.println(
                " >>> Not the master! Outcome: "
                    + unPrivedExec(
                        tempLine,
                        tempLine.substring(tempLine.indexOf('&')),
                        sourceChan,
                        sourceNick));
            sendToIRC("PRIVMSG " + sourceChan + " :You're not my real mom!\r\n");
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return false;
  }
Esempio n. 6
0
 static boolean sendVersion(String sourceChan) {
   try {
     System.err.println(" >>> Reporting version");
     sendToIRC(
         "PRIVMSG "
             + sourceChan
             + " :I am versionless v"
             + VERSION
             + ", with debug on: "
             + DEBUG
             + "\r\n");
     return true;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return false;
 }