Twitch IRC channel connection not responding after join command

I’m having trouble with my Twitch IRC bot. When I try to connect to the main server everything works fine and I get responses back. But when I send the command to join a specific channel, nothing happens. The server just stays silent and I don’t get any confirmation or error messages.

private void connectToChannel()
{
    networkStream.Writer.Write("JOIN #" + targetChannel.Trim().ToLower() + "\r\n");
    Console.WriteLine("Attempting to join: #" + targetChannel.Trim().ToLower());
    networkStream.Writer.Flush();

    // testing loop
    while (true)
    {
        while (networkStream.streamReader.Peek() >= 0)
        {
            String response = networkStream.streamReader.ReadLine();
            if (response.Contains("PING "))
            {
                networkStream.Writer.Write("PONG " + response.Substring(response.IndexOf("PING ") + 5) + "\r\n");
                networkStream.Writer.Flush();
            }
            Console.WriteLine(response);
        }
    }
}

Update: I noticed that Twitch uses PING instead of PING : format. Even after fixing this the channel join still doesn’t work properly. Really confused why the initial connection works but channel joining fails.

Check your targetChannel variable before trying to join. I’ve hit the same silent failures when channel names had weird characters or weren’t formatted right. Twitch IRC is super picky - channel names must be lowercase and match exactly. Also, make sure your connection’s still alive by watching for disconnection events between connecting and joining. I’ve seen connections drop silently after auth but before joining, which causes exactly what you’re describing - everything looks fine but commands get ignored. Add a quick connection status check right before your JOIN command to rule that out.

sounds like ur missing the CAP REQ command before joining. twitch needs that request for capability first or u wont get proper responses. try adding CAP REQ :twitch.tv/membership before ur join command - usually helps with the silent issue.

Had this exact problem with my first Twitch bot. You’re probably not authenticating before trying to join. Send the PASS command with your OAuth token and NICK command with your bot username BEFORE the JOIN command. Twitch IRC silently ignores join requests without proper auth. Also check your OAuth token has the right scopes - needs chat:read and chat:edit minimum. I spent hours on this just to find I’d completely missed the auth step. Connection works fine but channel stuff needs full authentication.

sounds like a timing issue. add a small delay after connectin but before sending the join command - twitch needs a moment to proces the auth handshake even when it looks connected. also make sure ur using the correct IRC server. wrong endpoints cause this exact behavior.

This happened to me when I was handling the network stream wrong. Your code looks fine, but you might not be seeing the JOIN response because it’s getting buried in other IRC messages. Twitch sends tons of background traffic that can hide the join confirmation. Try logging every response you get - you’ll probably find the join actually worked but the confirmation got lost in PING/PONG exchanges or other server messages. Also check if your networkStream.streamReader has the right encoding and buffer settings. Sometimes the stream looks connected but isn’t reading responses correctly because of buffering issues.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.