tmijs / tmi.js

đź’¬ Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 215 forks source link

client.join() returning No response from Twitch. #342

Closed luandunas closed 5 years ago

luandunas commented 5 years ago

My code

var channels = ['xqcow' ,'sattelizergames' ,'summit1g' ,'gaules' ,'jovirone' ,'elded' ,'scarra' ...]
var client = tmi.client({
    options: {debug: false},
    connection: {reconnect: true, secure: true},
    channels: ['dunaaas'],
    identity: {username: "username",password: "oauth"}
});

client.on('connected', function(address, port) {
    console.log("Address: " + address + " Port: " + port);
    console.log(`connected channels: ${client.getOptions().channels.length}`);
    b();
});

function b(){
    if(channels[0] != undefined){
    client.join(channels[0]).then(function(data) {
          console.log(data);
          channels.shift();
          b();
        }).catch(function(err) {console.log(err)});
    }
    else{

    }
}

Actual behaviour: Returning error when try connect in many channels using client.join()

Expected behaviour: Don't return No response from Twitch.

Error

No response from Twitch.

Server configuration

AlcaDesign commented 5 years ago

You're probably joining too many channels in the allotted time. (20 commands per 30 seconds for normal accounts) Why not just use the auto-joiner? You already have 1 channel in the client option's channels array.

var client = tmi.client({
    ...
    channels: [
        'dunaaas','xqcow' ,'sattelizergames' ,'summit1g' ,'gaules' ,
        'jovirone' ,'elded' ,'scarra', ...
    ],
    ...
});
luandunas commented 5 years ago

In this case i can't use auto-joiner. I tried use Settimeout with 5 seconds, but still return "No response from Twitch."

instafluff commented 5 years ago

Seeing this same issue here as well. It successfully joins the first several channels and then gets the "No response from Twitch" error for all others indefinitely.

pierregoutheraud commented 3 years ago

This comes from the fact that the join channel promise races against a delay https://github.com/tmijs/tmi.js/blob/5925310c925f14a9c08f2f5c6b61974214a5c9ff/lib/commands.js#L263-L269

(which is often set to 600ms) and when you join a lot of channels, the join command sometimes take more than 600ms so you get that "No response from Twitch" error.

hey24sheep commented 3 years ago

I am facing the same issue. I don't think this is fixed.

OikoumE commented 2 years ago

i am suddenly facing this issue aswell when joining 20 channels

FlockersDesign commented 2 years ago

got the same problem and just joing one channel

const tmi = require('tmi.js'); const { channel } = require('tmi.js/lib/utils'); require('dotenv').config();

const options = { options: { debug: true,}, connection: { reconnect: true, secure: true, }, identity: { username: process.env.USER_TOKEN, password: process.env.AUTH_TOKEN }, channels: [ process.env.CHANNEL_TOKEN ] };

const client = new tmi.client(options); client.connect();

MidKnightXI commented 2 years ago

So I'm getting the same error error: No response from Twitch. after the Executing command: JOIN #[channel] with only one twitch channel (mine).

Here's my config:

import { client } from 'tmi.js';

const opts = {
  identity: {
    username: process.env.BOT_USERNAME,
    password: process.env.BOT_OAUTH_TOKEN
  },
  channels: [
    process.env.CHANNEL_NAME
  ]
}

const cli = new client(opts);

cli.connect();

I've no clue of why it's not working so just gonna check the future comments of the issue

FlockersDesign commented 2 years ago

So I'm getting the same error error: No response from Twitch. after the Executing command: JOIN #[channel] with only one twitch channel (mine).

Here's my config:

import { client } from 'tmi.js';

const opts = {
  identity: {
    username: process.env.BOT_USERNAME,
    password: process.env.BOT_OAUTH_TOKEN
  },
  channels: [
    process.env.CHANNEL_NAME
  ]
}

const cli = new client(opts);

cli.connect();

I've no clue of why it's not working so just gonna check the future comments of the issue

change cli.connect(); to client.connect();

MidKnightXI commented 2 years ago

should I open a new issue for it ?

DennisMinn commented 11 months ago

This comes from the fact that the join channel promise races against a delay

https://github.com/tmijs/tmi.js/blob/5925310c925f14a9c08f2f5c6b61974214a5c9ff/lib/commands.js#L263-L269

(which is often set to 600ms) and when you join a lot of channels, the join command sometimes take more than 600ms so you get that "No response from Twitch" error.

Is there a way to increase or remove the delay if we have a verified account? The auto-joiner isn't a good fit for my application because it is only scanning for live channels. https://dev.twitch.tv/docs/irc/ Limit Description
20 messages per 30 seconds If the user isn’t the channel’s broadcaster or moderator, the bot may send a maximum of 20 messages per 30 seconds.
100 messages per 30 seconds If the user is the channel’s broadcaster or moderator, the bot may send a maximum of 100 messages per 30 seconds.
7,500 messages per 30 seconds The bot is limited to sending 7,500 messages per 30 seconds across all channels. This means that the bot could send 10 messages per 30 seconds to 750 different channels. However, it couldn’t, for example, send 7,500 messages per 30 seconds to a single channel because it would exceed the 20 messages per 30 second limit.