tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 214 forks source link

New Twitch feature "rooms", how can I join a certain room? #276

Closed Coding-Kiwi closed 6 years ago

Coding-Kiwi commented 6 years ago

Actual behaviour:

chatbot doesn't post messages in the chat

Expected behaviour:

chatbot does post messages in the chat

Server configuration

Guess the problem is the new "rooms" feature that twitch recently introduced. So how can I make tmi join the default room?

AlcaDesign commented 6 years ago

You just join #channel_name for the default room. Other rooms you need to join #chatrooms:channel_id:room_uuid:

Here's how to join Alca's (7676884) "subs" room (13cbfed0-ff5e-4714-a9e5-8cbaea38c1cd) client.join('chatrooms:7676884:13cbfed0-ff5e-4714-a9e5-8cbaea38c1cd');

When you receive a message, the channel parameter will be "#chatrooms:7676884:6677a069-0003-4c08-a77f-ae29660b795a". Currently the "room-id" property of the userstate will just be the channel ID as it normally would be. You'd have to parse the channel parameter to get the room UUID.

Twitch Docs

Coding-Kiwi commented 6 years ago

so thanks for the help, it worked for a long time but now everytime I want to join a channel with

client.join("#channel_name") or client.join("#chatrooms:7676884:13cbfed0-ff5e-4714-a9e5-8cbaea38c1cd")

I only get "No response from Twitch."

The bot is connected to IRC, it just cant join the room, I tried with and without the # sign

Coding-Kiwi commented 6 years ago

Additional info: if I specify a channel in the client options when I create the tmi-client it joins its just the join command that is not working

AlcaDesign commented 6 years ago

Does the account have permission to join that chat room the it's trying to join?

Coding-Kiwi commented 6 years ago

Yes, the stream-chat and a test-room I created both have permission "Everyone" and the bot is mod

AlcaDesign commented 6 years ago

Then I can only assume you're calling join too early. Could you share some example code?

This example works just fine:

const tmi = require('tmi.js');

let client = new tmi.client({
        identity: {
            username: 'alca',
            password: '...'
        },
        channels: [ 'chatrooms:7676884:13cbfed0-ff5e-4714-a9e5-8cbaea38c1cd' ],
        options: { debug: true }
    });

client.connect();
Coding-Kiwi commented 6 years ago

Thank you very much for the fast help! I resolved it by using the debug option I totally forgot about. (It was the missing user-id in the chatroom-id..)

I'm very sry ^^"