I have basic TCP client, connecting to twitch and srites to stream command from console.
using System.Net.Sockets;
using System.Text;
using TcpClient tcpClient = new();
try
{
await tcpClient.ConnectAsync("irc.chat.twitch.tv", 6667);
Console.WriteLine("Подключение установлено");
NetworkStream stream = tcpClient.GetStream();
Task.Run(() =>
{
var responseData = new byte[1024];
int bytes;
string response = "";
while (true)
{
bytes = stream.Read(responseData);
response = Encoding.UTF8.GetString(responseData, 0, bytes);
Console.WriteLine(response);
}
});
stream.Write(Encoding.UTF8.GetBytes("PASS oauth:totalynotasecrettoken\r\n"));
stream.Write(Encoding.UTF8.GetBytes("NICK nickname\r\n"));
while (true)
{
stream.Write(Encoding.UTF8.GetBytes(Console.ReadLine()+"\r\n"));
}
}
catch (SocketException ex)
{
Console.WriteLine(ex.Message);
}
I successfuly sent message with PRIVMSG with first token, that have “user_read” scope, but cant send message with same command, that have all scopes, including “user_read” scope.