示例#1
0
        public IRCBot(Config config)
        {
            this.config = config;

            try {
                /* Basic Bot Setup */
                sock = new TcpClient (config.server, config.port);
                stm = sock.GetStream ();
                Writer = new StreamWriter (stm);
                Reader = new StreamReader (stm);
                SendData("USER", config.nick + "  8 * :" + config.name);
                SendData("NICK " + config.nick);
                if (config.nickserv == true){
                    ChanMessage ("nickserv", "id ", config.nickservUserName + config.password);
                }
                bool debug = config.debug;
                /* Kick off the Worker Process */
                IRCWork();
            }
            catch (Exception e) {
                Console.WriteLine(e);
            }
        }
示例#2
0
 public static void Main(string[] args)
 {
     Config conf = new Config();
     conf.name = "KusuBot";
     conf.nick = "KusuBot";
     conf.server = "chat.freenode.net";
     conf.port = 6667;
     conf.admin = ":kusuriya!";
     conf.debug = false;
     string[] channels = {"#kusu"};
     conf.channels = channels;
     new IRCBot(conf);
 }