Пример #1
0
        public IrcBot(IrcConfig config)
        {
            _config = config;

            try
            {
                _connection = new TcpClient(_config.Server, _config.Port);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                _ns = _connection.GetStream();
                _sr = new StreamReader(_ns);
                _sw = new StreamWriter(_ns);

                Send("USER", config.Nick + " irc.sysnirc.com " + " irc.synirc.com " + " :" + config.Name);
                Send("NICK", config.Nick);
                Send("JOIN", "#arkiv");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #2
0
        public void Start()
        {
            var config = new IrcConfig
                             {
                                 Name = "Arkiv[bot]",
                                 Nick = "Arkiv[bot]",
                                 Port = 6668,
                                 Server = "irc.synirc.com"
                             };

            var bot = new IrcBot(config);

            var thread = new Thread(bot.Work);
            thread.Start();
        }