Saturday, December 24, 2005

SmartIrc4net - the C# IRC library - The Code Project - C# Programming: "using System; using System.Collections; using Meebey.SmartIrc4net; using Meebey.SmartIrc4net.Delegates; public class Test { public static IrcClient irc = new IrcClient(); public static void OnQueryMessage(Data ircdata) { switch (ircdata.MessageEx[0]) { case 'join': irc.Join(ircdata.MessageEx[1]); break; case 'part': irc.Part(ircdata.MessageEx[1]); break; case 'say': irc.Message(SendType.Message, MessageEx[1], MessageEx[2]); break; } } public static void Main(string[] args) { irc.SendDelay = 200; irc.AutoRetry = true; irc.ChannelSyncing = true; irc.OnQueryMessage += new MessageEventHandler(OnQueryMessage); string[] serverlist; serverlist = new string[] {'irc.ircnet.net'}; int port = 6667; if(irc.Connect(serverlist, port) == true) { irc.Login('SmartIRC', 'Stupid Bot'); irc.Join('#smartirc'); irc.Message(SendType.Message, '#smartirc', 'test message'); irc.Message(SendType.Action, '#smartirc', ' thinks this is cool'); irc.Message(SendType.Notice, '#smartirc', 'SmartIrc4net rocks!'); } irc.Listen(); irc.Disconnect(); } else { System.Console.WriteLine('couldn't connect!'); } } }"

0 Comments:

Post a Comment

<< Home