Twitch IRC功能WebSocket(标签)

时间:2019-05-16 10:33:49

标签: javascript api websocket twitch twitch-api

当主持人取消聊天中用户的禁令时,我正在尝试获取一个事件,我发送了twitch.tv/tags的请求,但是当用户被禁或取消禁令时,我没有收到任何消息...

这是我的实际代码:

const WebSocket = require('ws');

const ws = new WebSocket('wss://irc-ws.chat.twitch.tv:443');

ws.onopen = function(event) {
  console.log('INFO: Socket Opened'); 
  ws.send('CAP REQ :twitch.tv/commands');
  ws.send('CAP REQ :twitch.tv/membership');
  ws.send('CAP REQ :twitch.tv/tags');
  ws.send('PASS oauth:...');
  ws.send('NICK zaekof_');
  ws.send('JOIN #zaekof_');
  ws.send('USER #zaekof_');
};
ws.onerror = function(error) {
  console.log('ERR: ', error);
};
ws.onclose = function() {
  console.log('INFO: Socket Closed');
}; 
ws.onmessage = function(event) {
  console.log('RECV: ', event.data);
};

当我通过irc聊天连接时,我收到以下消息:

RECV:  :tmi.twitch.tv CAP * ACK :twitch.tv/commands
RECV:  :tmi.twitch.tv CAP * ACK :twitch.tv/membership
RECV:  :tmi.twitch.tv CAP * ACK :twitch.tv/tags

RECV:  :tmi.twitch.tv 001 zaekof_ :Welcome, GLHF!
:tmi.twitch.tv 002 zaekof_ :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 zaekof_ :This server is rather new
:tmi.twitch.tv 004 zaekof_ :-
:tmi.twitch.tv 375 zaekof_ :-
:tmi.twitch.tv 372 zaekof_ :You are in a maze of twisty passages, all alike.:tmi.twitch.tv 376 zaekof_ :>

有人会帮我吗?

谢谢。

0 个答案:

没有答案