Need help with tmi.js errors

I am building my first bot and am trying to get it connected to my channel. My code says I am connected to chat. I can even console log the chat with no issue, but my bot does not appear in my chat list and I cannot send messages to my chat.

Edit: Here is my code and the console output

Please post your code that shows connected to and joining a channel.

I edited my original post and included a link to my code

Check out the TMI.js documentation here:
https://docs.tmijs.org/v1.2.1/Commands.html#say

twitchBot.say(twitchChannel, "message").then(function(data) {
    console.log(data);
}).catch(function(err) {
    console.log(err);
});

Also that say method might fire too early, before you client has successfully logged in.
Try placing it inside the connection event.

https://docs.tmijs.org/v1.2.1/Events.html#logon

Basically DBKynd is correct. You’re calling the action function before a connection had even been made.

I recommend after the connected event or the join event:

twitchBot.on('join', (channel, username, self) => {
    if(self) {
        twitchBot.action(channel, 'Joined.')
            .catch(err => console.log(err));
    }
});

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