using System; using System.Collections.Generic; using System.Text; using System.Threading; using Meebey.SmartIrc4net; namespace ConsoleApplication1 { public class ircbot { private IrcClient cl = new IrcClient(); public ircbot() { try { cl.SendDelay = 200; cl.ActiveChannelSyncing = true; cl.OnChannelAction += new ActionEventHandler(cl_OnChannelAction); cl.OnChannelMessage += new IrcEventHandler(cl_OnChannelMessage); cl.Connect("irc.vsi.ru", 6667); cl.Login("SmartIrc4NetClient", "Yagg"); cl.RfcJoin("#programming"); new Thread(new ThreadStart(this.BotThreadProc)).Start(); cl.Listen(); cl.Disconnect(); } catch (Exception e) { Console.WriteLine(e.Message); } } void cl_OnChannelMessage(object sender, IrcEventArgs e) { Console.WriteLine(e.Data.Nick+": "+ e.Data.Message); } void cl_OnChannelAction(object sender, ActionEventArgs e) { Console.WriteLine("* "+e.Data.Nick+e.Data.Message); } public void BotThreadProc() { while (true) { cl.WriteLine("PRIVMSG #programming :" + Console.ReadLine()); } } } class Program { static void Main(string[] args) { ircbot bot = new ircbot(); } } }