Twitch Bot not working in Twitch Chat but works in console (Node.js) (Tmi.js)

Hi! I have recently started a coding project where my bot does a countdown in the channels chat when the command is given. This bot used to work perfectly, but then literally stopped working. I have seen a few similar posts about this. The bot is connected to the channels chat because in PowerShell its shows that its connected. But nothing happens in the actual chat. Then if I proceed to input the command in the chat, then in my console everything happens (like it should), but for some reason no response on the actual chat.

I then (from curiosity) tried connected the bot to its own channel. And… it worked. And I am completely confused on why it’s not working on my main channel and how it only works on it’s own channel.

Similar Post: Bot can receive messages, but sent messages do not show up in chat

index.js:

const tmi = require('tmi.js');
const channel = 'yashk_'
const options = {
options: {
    debug: true, 
},
connection: {
    cluster: 'aws',
    reconnect: true, 
},
identity: {
username: 'countdownscrimbot',
password: 
},
channels: [channel],
},

client = new tmi.client(options);
function sleep(ms){
    return new Promise(resolve=>{
        setTimeout(resolve,ms)
    })
}
 async function countdown() {
    client.action(channel, 'READY UP ON THE WORDS "GO"');
    await sleep(3000);
    client.action(channel, 'GAME STARTING IN...');
     await sleep(1050);
    client.action(channel, '10');
    await sleep(1050);
    client.action(channel, '9');
    await sleep(1050);
    client.action(channel, '8');
    await sleep(1050);
    client.action(channel, '7');
    await sleep(1050);
    client.action(channel, '6');
    await sleep(1050);
    client.action(channel, '5');
    await sleep(1050);
    client.action(channel, '4');
    await sleep(1050);
    client.action(channel, '3');
    await sleep(1050);
    client.action(channel, '2');
    await sleep(1050);
    client.action(channel, '1');
    await sleep(1050);
    client.action(channel, 'GO');

}
client.connect();

client.on('connected', (address, port)=> {
client.action(channel, 'Server Status: NAE Online');
});

client.on('chat', (channel, user, message, self) => {
    if (message === '!startgame') {
countdown();

    }

});

[![chatproblem|193x499](upload://5EPAcSUpgO6QQnrO4cIUtffQlPu.png) ](http://)
![psproblem|690x469](upload://mbD2VGNhPhOQ181ktbWRdAaP33x.png)

First off, you’ve just exposed your OAuth token. Please revoke that token immediately. OAuth tokens are private information, and as per the Developer Agreement you have a responsibility to keep them private.

Secondly, you’re not listening for any error messages you may be getting. If sending isn’t successful it could be because your attempting to send messages in a channel that is in sub mode, or maybe it has a requirement for you to be following the channel, both of which would explain why it works when the bot is in its own channel but not in the other channel.

Also, I think whatever documentation you have been working off must be quite old because the cluster param hasn’t been needed for like a year or two.

I am sorry, first project on Twitch, and first post here. I used this video to start a basis https://www.youtube.com/watch?v=ijl3GUHvKIw.

So I am not sure about the cluster.

I will check about the following situation, but the bot worked perfectly like an hour ago, but it just stopped working. That is why I am confused.
@Dist

Just checked, I don’t need to follow my main channel in order to chat. So I do not know what to do now.

The guide you used is outdated.

Cluster was removed from TMI ages ago when Twitch itself dropped it

You need to monitor for error messages, or failing that check all the RAW messages to see whats going on.

Could you please give me some sample code on how I would display the errors? @BarryCarlyon

I don’t use TMI.js so I’m unfamiliar with how to do that

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.