martynsmith / node-irc

NodeJS IRC client library
GNU General Public License v3.0
1.32k stars 425 forks source link

Get in what channel the message was received. #467

Open itsfolf opened 8 years ago

itsfolf commented 8 years ago

How can I get in what channel a message was received in the "message" listener.

moshmage commented 8 years ago

As per the docs you can do it as

handleMessageEvent(nick, to, text) {
    if (to.indexOf('#') === 0) // it's a channel message, to has the channel name
    // ...
}
client.addListener('message', handleMessageEvent);