SHARE
TWEET

Untitled

a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Socket s = new Socket("irc.rizon.net", 6667);
  2. PrintWriter pw = new PrintWriter(s.getOutputStream());
  3. BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
  4.  
  5. pw.println("NICK TestBot");
  6. pw.println("USER TestBot * * :Name\n");
  7. pw.println("JOIN #cafebabe");
  8. pw.flush();
  9.  
  10. String input;
  11. while((input = br.readLine()) != null) {
  12.     String[] parts = input.split(" ");
  13.     if(parts[1].equals("PRIVMSG") {
  14.         String from = parts[0].split("!")[0].substring(1);
  15.         pw.println("PRIVMSG #cafebabe :" + from + ": hello there");
  16.         pw.flush();
  17.     }
  18. }
RAW Paste Data
Pastebin PRO BLACK FRIDAY Special!
Get 60% OFF on Pastebin PRO accounts!
Top