Help me with my bot

If the login fails, the writer stream will be null.

The easiest way to debug this yourself is to use visual studio’s code stepper, set a break point on the first entry point to your code, and use step into until you reach the exception. You can also use try{}catch(Exception ex) {Console.WriteLine(ex.ToString())} to find the method that is causing the issue.

My guess is that your password is incorrect, and the login is failing, you aren’t handling the error and instead try to get the stream for the reader/writer, and that’s failing and throwing the error. Your GetStream object shouldn’t be null, and the reader should immediately return the new server message with GL HF or w/e it is.

    public void sendChatMessage(string message)
    {
        sendIrcMessage(":" + userName + "!" + userName  + "@" + userName + ".tmi.twitch.tv PRIVMSG#"  + channel + " :" + message);

    }

I assume this is just a test message? This is not a valid format for a twitch IRC message. You only send PRIVMSG #channel :message

You also don’t show the local classes ‘userName’, depending on how you set it up, that could also be part of the issue.