Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.bbw2.ircBot;
- import java.io.IOException;
- /**
- * Created on 11/3/2015.
- */
- public class Main {
- public static void main(String[] args) {
- Server server;
- String serverName = "irc.FurNet.org",
- nick = "ArcticBot",
- login = nick,
- pass = null;
- String[] channelNames = {"#ArcticBotTest"};
- if (args.length>0){
- for (String arg : args) {
- if (arg.startsWith("server:"))
- serverName = arg.split(":")[1];
- if (arg.startsWith("nick:"))
- nick = arg.split(":")[1];
- if (arg.startsWith("pass:"))
- pass = arg.split(":")[1];
- if (arg.startsWith("channels:"))
- channelNames = arg.split(":")[1].split(",");
- }
- }
- Channel[] channels = new Channel[channelNames.length];
- for (int i = 0; i < channelNames.length; i++)
- channels[i] = new Channel(channelNames[i]);
- server = new Server(serverName, nick, login, pass, channels);
- try {
- server.init();
- if (server.start())
- server.joinChannels();
- } catch (IOException e) {
- try {
- System.out.println("Error");
- server.getWriter().write("PRIVMEG " + channelNames[0] + ": Error\r\n");
- server.getWriter().flush();
- } catch (IOException e1) {e1.printStackTrace();}
- System.err.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment