Exemplo n.º 1
0
        public static int Connect(TwitchIRCConnection connection, bool extendedInformation)
        {
            if (connection.ConnectionStatus == 0)
            {
                int isConnected = connection.Connect();

                if (isConnected == 0)
                {
                    connection.Send("PASS oauth:" + connection.UserPassword);
                    connection.Send("NICK " + connection.Username);

                    if (extendedInformation)
                    {
                        connection.Send("CAP REQ :twitch.tv/membership");
                        connection.Send("CAP REQ :twitch.tv/commands");
                        connection.Send("CAP REQ :twitch.tv/tags");
                    }
                }
                else
                {
                    return(1);
                }
            }

            return(0);
        }
Exemplo n.º 2
0
        public static int Disconnect(TwitchIRCConnection connection)
        {
            if (connection.ConnectionStatus == 1)
            {
                connection.Disconnect();
            }

            return(0);
        }
Exemplo n.º 3
0
        public static String ReadMessage(TwitchIRCConnection connection)
        {
            String message = "";

            message = connection.Receive();

            if (message.ToLower().StartsWith("ping"))
            {
                TwitchIRCClient.SendServerMessage("PONG :tmi.twitch.tv", connection);
            }

            return(message);
        }
Exemplo n.º 4
0
        public static int Restart(TwitchIRCConnection connection, bool extendedInformation)
        {
            if (connection.ConnectionStatus == 0 || connection.ConnectionStatus == 2)
            {
                TwitchIRCClient.Connect(connection, extendedInformation);
            }

            if (connection.ConnectionStatus == 1)
            {
                TwitchIRCClient.Disconnect(connection);
                TwitchIRCClient.Connect(connection, extendedInformation);
            }

            return(0);
        }
Exemplo n.º 5
0
 public static int DepartChannel(String channelName, TwitchIRCConnection connection)
 {
     return(TwitchIRCClient.SendServerMessage("PART #" + channelName, connection));
 }
Exemplo n.º 6
0
 public static int JoinChannel(String channelName, TwitchIRCConnection connection)
 {
     return(TwitchIRCClient.SendServerMessage("JOIN #" + channelName, connection));
 }
Exemplo n.º 7
0
 public static int SendWisperMessage(String username, String message, TwitchIRCConnection connection)
 {
     return(TwitchIRCClient.SendServerMessage(".w " + username + " " + message, connection));
 }
Exemplo n.º 8
0
 public static int SendChannelMessage(String channelName, String message, TwitchIRCConnection connection)
 {
     return(TwitchIRCClient.SendServerMessage("PRIVMSG #" + channelName + " :" + message, connection));
 }
Exemplo n.º 9
0
 public static int SendServerMessage(String message, TwitchIRCConnection connection)
 {
     return(connection.Send(message));
 }
Exemplo n.º 10
0
 public void SetConnectionInformation(string username, string userPassword, bool extendedInformation, string serverAddress, int serverPort)
 {
     Connection          = new TwitchIRCConnection(username, userPassword, serverAddress, serverPort);
     ExtendedInformation = extendedInformation;
 }
Exemplo n.º 11
0
 public void SetConnectionInformation(string username, string userPassword, bool extendedInformation, bool useSSL)
 {
     Connection          = new TwitchIRCConnection(username, userPassword, useSSL);
     ExtendedInformation = extendedInformation;
 }