c++ - 使用我的 C++ irc​​ 机器人连接到 Twitch

标签 c++ bots irc twitch

我在将我的机器人连接到 irc.twitch.tv 时遇到一些问题。连接到 irc.ubuntu.com 是没有问题的......

连接到 ubuntu 时,我只发送 nick,然后发送 usr。通过 twitch,我发送 pass、nick,然后发送 usr。
我真的很困惑为什么这根本不起作用。通常我认为 twitch 应该告诉我任何事情,但在我的机器人告诉我没有发生特殊错误之后,根本就没有任何消息。所以我认为问题出在连接上,而不是我无法在 usr 和 nick 之前发送有效通行证。
因为我的代码有点长所以我把它贴在pastebin上希望你能理解和分析它:

http://pastebin.com/Win3CXbP

PS:  - My oauth PW should be correct it is not the string in the sample code.
     - I have the pw/usr/nick in the right order, nick/usr is wrong in code.
     - I want to say again, that I don't get any message from twitch or any errors.

PPS:  - I just tried using wireshark and when filtering for "irc" I got some data 
        with irc.ubuntu.com, but none with irc.twitch.tv. 
        Is the twitch adress wrong?
PPPS: - I am not completely into wireshark yet, but the only messages I am getting 
        on tcp port 6667 are 
                            "connection establish request"       
        and                 "connection establish acknowledge"

最佳答案

根据协议(protocol)文档,客户端连接协议(protocol)顺序是:

PASS

NICK

USER

而您的机器人似乎正在发送 passusernick

3.1 Connection Registration

The commands described here are used to register a connection with an IRC server as a user as well as to correctly disconnect.

A "PASS" command is not required for a client connection to be
registered, but it MUST precede the latter of the NICK/USER
combination (for a user connection) or the SERVICE command (for a
service connection). The RECOMMENDED order for a client to register
is as follows:

                       1. Pass message
       2. Nick message                 2. Service message
       3. User message

Upon success, the client will receive an RPL_WELCOME (for users) or RPL_YOURESERVICE (for services) message indicating that the
connection is now registered and known the to the entire IRC network. The reply message MUST contain the full client identifier upon which
it was registered.

编辑:

此外,即使协议(protocol)表明 PASS 是可选的,一些 服务器仍需要密码,即使不需要连接到网络也是如此。发送空白的 PASS 是不够的。对于那些服务器,我发送 PASS none。 (只要密码不为空,什么都可以)。

关于c++ - 使用我的 C++ irc​​ 机器人连接到 Twitch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27414105/

相关文章:

c++ - 如何修复 “Undefined symbols for architecture x86_64:” C++编译器错误?

c++ - 传递数组时从 'int' 到 'int*' [-fpermissive] 的无效转换

c# - 尝试编写一个 IRC 客户端,但很难找到有关代码和连接协议(protocol)的好资源

networking - IRCD-混合连接有限公司 4026

c++ - 通过可移动物体

python - 如何在python中将unsigned char类型的int字符串转换为int

python - 在使用 python 进行 GUI 自动化期间鼠标未单击

python - 如何以交互方式控制基于 Twisted 的 Python IRC 机器人?

javascript - Zapier - 切片不是一个有效的函数?

variables - IRC 变量剩余时间