我正在尝试在C#.NET中为我的抽搐频道编写机器人并且它成功连接,但是当我在公共聊天中发送消息时,我得到以下内容:
:connorwrightkappa!connorwrightkappa@connorwrightkappa.tmi.twitch.tv PRIVMSG #connorwrightkappa:test
连接代码:
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是机器人的用户名
密码是机器人的oauth令牌
channelName是机器人应加入的频道的名称
Timer1 Tick:
if (!tcpClient.Connected)
{
Reconnect();
}
if (tcpClient.Available > 0 || reader.Peek() >= 0)
{
var message = reader.ReadLine();
aLabel.Text += $"\r\n{message}";
}
答案 0 :(得分:1)
PRIVMSG是一个关于抽搐的公共聊天消息。不要问我为什么,但它是......