【问题标题】:Twitch PRIVMSG not being sent to other channelsTwitch PRIVMSG 未发送到其他频道
【发布时间】:2018-03-30 23:25:24
【问题描述】:

IMG

Conosle.WriteLine("它成功了!") 它正在所有 Twitch.tv/channels 上执行

但是……

PRIVMSG #Twitch.tv/channel 仅适用于我自己的频道,即 twitch.tv/traps_are_not_gay_baka

我的意思是我可以从我放入频道字符串的任何频道中读取消息,但 PRIVMSG 仅适用于我自己的频道,当我将其切换到 Twitch.tv/bakoni 之类的东西时,这是我发现并用于测试 PRIVMSG 的随机频道只是不要到达。

为什么会这样?

编辑:(代码)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text;
using System.Net.Sockets;
using System.IO;
namespace chatrig
{
    class chatrig
    {
        static String ip = "irc.twitch.tv";
        static Int32 port = 6667;

        static String username = "traps_are_not_gay_baka";
        static String password = "oauth:hokzuz***********ebkv5gnb";

        static String clientID = "2lubvv5***********3f2m8orz24c";

        static String channel = "bakoni";

        static TcpClient tcpClient = new TcpClient(ip, port);

        static StreamReader reader = new StreamReader(tcpClient.GetStream());
        static StreamWriter writer = new StreamWriter(tcpClient.GetStream());

        static void Main(string[] args)
        {

            writer.WriteLine("PASS " + password);

            writer.Flush();

            writer.WriteLine("NICK " + username);

            writer.Flush();

            writer.WriteLine("USER " + username + " 8 * :" + username);

            writer.Flush();

            writer.WriteLine("JOIN #" + channel);

            writer.Flush();

            while (true)
            {
                var message = reader.ReadLine();
                Console.WriteLine(message);

                if (message.Contains("yandYo"))
                {
                    writer.WriteLine("PRIVMSG #" + channel + " :" + "w" + "\r\n");

                    writer.Flush();

                    Console.WriteLine("It worked!");
                }
            }
        }

    }

}

【问题讨论】:

标签: c# bots streamwriter irc twitch


【解决方案1】:

除了不等待来自 IRC 服务器的正确响应之外,传出消息的格式是

writer.WriteLine( string.Format( ":{0}!{0}@{0}.tmi.twitch.tv PRIVMSG #{1} :{2}", username, channel, message ) );

【讨论】:

  • 感谢您提供我刚刚与您的代码切换的信息,但结果仍然是:link
  • 您是否正在加入要发送到的频道?您只能向已加入的频道发送消息。
  • 是的,我使用以下行:“ writer.WriteLine("JOIN #" + channel); "
  • 嗯,一切正常
  • 我不知道为什么它不适用于我以外的渠道
猜你喜欢
  • 2021-09-18
  • 2015-05-26
  • 1970-01-01
  • 2022-01-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多