Search code examples
c#botsirc

IRC Bot problems on UnrealIRCd


i have been working on bot in C# (using Amrykid.Web.IRC library - i know it's buggy but this is not related to it - i suppose) And i ran into small problem today.

When I try to join localhost IRC (unrealircd 4) it gives me this in log (user joins server but doesn't join channel)

:cisco.1337 NOTICE * :*** Looking up your hostname...
:cisco.1337 NOTICE * :*** Found your hostname
PING :9574792D
PONG :9574792D
:cisco.1337 451 MODE :You have not registered
:cisco.1337 451 JOIN :You have not registered
:cisco.1337 001 NoNameService :Welcome to the Cisco Localhost IRC Network NoNameService!NoNameServ@localhost

And when I try to join 'irc.freenode.net' it all goes through and user joins channel

:weber.freenode.net NOTICE * :*** Looking up your hostname...
:weber.freenode.net NOTICE * :*** Checking Ident
:weber.freenode.net NOTICE * :*** Found your hostname
:weber.freenode.net NOTICE * :*** Got Ident response
:weber.freenode.net 001 NoNameService :Welcome to the freenode Internet Relay Chat Network NoNameService

Here is my code I am using (just changing IRCServer string)

        #region Server Variables
        static string IRCServer = "irc.freenode.net";
        static int IRCPort = 6667;
        static string IRCChan = "#ciscobot";
        static string _password = "adminPassword";
        static string trigger = ".";
        #endregion

        static string nick = "NoNameService";
        static IRC _irc;
        static List<string> users = new List<string>();
        static void Main(string[] args)
        {
            _irc = new IRC(nick);
            _irc.Nick = nick;
            _irc.Connect(IRCServer, IRCPort);
            _irc.Logon(nick, nick);
            _irc.Join(IRCChan);
            _irc.IRCUserJoin += new IRC.IRCUserJoinHandler(_irc_IRCUserJoinHandler);
            _irc.IRCUserQuit += new IRC.IRCUserQuitHandler(_irc_IRCUserQuitHandler);
            _irc.IRCUserKick += new IRC.IRCUserKickHandler(_irc_IRCUserKickHandler);
            _irc.IRCPrivateMSGRecieved += new IRC.IRCPrivateMSGRecievedHandler(_irc_IRCPrivateMSGRecieved);
            while (true)
            {
                _irc.ProcessEvents(0);
            }
        }

I've been searching all day but i can't seem to find what is wrong...


Solution

  • You're sending commands too early. The "you have not registered" message means the server doesn't know who you are, but you're trying to set a MODE and JOIN a channel.