'Where are event listeners defined in npm packages?

I've been working on coding an IRC bot in nodejs as a learning project. I've been frequently coming across event listeners such as the following:

bot.addListener("message", function(from, to, text, message) {
.
.
.
});

Problem: I've been looking everywhere for an explanation of where this addListener is defined/explained. I can't find anything. It is from the irc package in npm, and even after searching every github file in the irc package source, I find no instance of the string addListener.

What's going on here? How do I figure out how this addListener is working, what the list of IRC events are (besides just "message"), and so forth?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source