Within this package you can create event listeners to listen to eventsub events.
Listening to events
By default, when you join to a channel you will listen only ChannelChatMessage event. To listen to the other events you will need to specify them when joining to a channel.
As you can see in the example above the chatbot is joining to a channel and then listening to the ChannelUpdate and ChannelFollow events.
You may notice that you can only subscribe to events at joining a channel, but, for your luck, you can subscribe to events whenever you want.
When you join to a channel a ChannelProfile class is created and stored in the profiles collection within the chatbot instance.
With this class you can either unlisten events or subscribe to one or more events.
Here is an example of how get that channel profile and manage its events:
Create your first event
Before creating our first event listener we must set our events directory in the paths option of ChatBotOptions, where all the events are going to be located.
Now that we have set up our events base directory we are going to create our first event with createEvent function to listen to streams which go online.