tmijs / tmi.js

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

Listen for messages from specific channel #370

Closed polizinha closed 4 years ago

polizinha commented 4 years ago

Hello, I want to listen for messages from specific channel. With irc client I can do:

    client.addListener(`message${CHANNEL}`, (from, message) => {
        console.log('yey');
    });

There is a way to do it here? I tried to find it and I had no success.

AlcaDesign commented 4 years ago

You just have to join the channel(s) and then filter by the channel parameter.


const specificChannel = 'channel login';
client.on('message', (channel, tags, message, self) => {
    if(self) return;
    if(channel === specificChannel) {
        console.log('Message received from', specificChannel);
    }
});