Skip to content
This repository was archived by the owner on Sep 16, 2019. It is now read-only.

Latest commit

 

History

History
39 lines (29 loc) · 822 Bytes

File metadata and controls

39 lines (29 loc) · 822 Bytes

IRC_Library

Simple Object-oriented C# IRC Client Library. Can be used for both bots and clients.

Simple Client

Create simple IRC client. This code works like telnet (after connecting to server) so you have to write full IRC commands but it is useful for testing.

Code

Console.WriteLine("Starting...");

IRC irc = new IRC("<server>", 6667);

irc.RawMessageReceived += Console.WriteLine;

Console.CancelKeyPress += (sender, e) =>
{
    if (irc.Connected)
        irc.Quit();
    Environment.Exit(1);
};

Console.WriteLine("Connecting...");

irc.Connect("<nick>", "<username>", "<real_name>");

Console.WriteLine("Connected");

while (true)
{
    string line = Console.ReadLine();
    if (string.IsNullOrWhiteSpace(line))
        break;
    irc.SendRawMessage(line);
}

if (irc.Connected)
    irc.Close();