Chat Bot IRC USERSTATE

Im trying to make an irc chat bot and it works good, but USERSTATE is not working, im not receiving any information from the server, its my first time working on this, i know i have to CAP REQ, but should i request it just 1 time? or in a cycle. My objective is saying hello to a new viewer joining the chat

public class IrcClient
{
public string userName;
private string channel;

    private TcpClient _tcpClient;
    private StreamReader _inputStream;
    private StreamWriter _outputStream;

    public IrcClient(string ip, int port, string userName, string password, string channel)
    {
        try
        {
            this.userName = userName;
            this.channel = channel;

            _tcpClient = new TcpClient(ip, port);
            _inputStream = new StreamReader(_tcpClient.GetStream());
            _outputStream = new StreamWriter(_tcpClient.GetStream());

            // Try to join the room
            _outputStream.WriteLine("PASS " + password);
            _outputStream.WriteLine("NICK " + userName);
            _outputStream.WriteLine("USER " + userName + " 8 * :" + userName);
            _outputStream.WriteLine("JOIN #" + channel);
            _outputStream.WriteLine("CAP REQ :twitch.tv/tags");
            _outputStream.WriteLine("CAP REQ :twitch.tv/membership");
            _outputStream.WriteLine("CAP REQ :twitch.tv/commands");
            _outputStream.Flush();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }

    public void SendIrcMessage(string message)
    {
        try
        {
            _outputStream.WriteLine(message);
            _outputStream.Flush();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }

    public void SendPublicChatMessage(string message)
    {
        try
        {
            SendIrcMessage(":" + userName + "!" + userName + "@" + userName + ".tmi.twitch.tv PRIVMSG #" + channel + " :" + message);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }

    public string ReadMessage()
    {
        try
        {
            string message = _inputStream.ReadLine();
            return message;
        }
        catch (Exception ex)
        {
            return "Error receiving message: " + ex.Message;
        }
    }

}

}

CAP REQ, should be sent before you joining any rooms

So you go

  • Connet
  • pass
  • nick
  • caps
  • join

Without seeing your code, can’t spot any issues

Should I put part of the code here?
thanks for the response

Yup forum has code stuff for wrapping/displaying code nicely, or a gist, pastebin whatever works

its C#. that’s the class for the bot, the main program its just a cycle receiving constantly info from twitch server, do i have to ask the server for te command? or when a user joins it should send me automatically the info?
sorry if my english is bad

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