I am attempting to write a bot for my twitch channel in C#.NET and it connects successfully, but when I send a message in the public chat I get the following:
:connorwrightkappa!connorwrightkappa@connorwrightkappa.tmi.twitch.tv PRIVMSG #connorwrightkappa :test
Connection code:
tcpClient = new TcpClient("irc.chat.twitch.tv", 6667);
reader = new StreamReader(tcpClient.GetStream());
writer = new StreamWriter(tcpClient.GetStream());
writer.WriteLine("PASS " + password + Environment.NewLine
+ "NICK " + username + Environment.NewLine +
"USER " + username + " 8 * :" + username);
writer.Flush();
writer.WriteLine("JOIN #" + channelName);
writer.Flush();
username is the username of the bot
password is the oauth token for the bot
channelName is the name of the channel that the bot should join
Timer1 Tick:
if (!tcpClient.Connected)
{
Reconnect();
}
if (tcpClient.Available > 0 || reader.Peek() >= 0)
{
var message = reader.ReadLine();
aLabel.Text += $"\r\n{message}";
}
PRIVMSG is a public chat message on twitch. Don't ask me why, but it is...