Python is very suitable for working with the Internet Relay Chat (IRC) protocol. But working directly with a protocol can be a bit messy. Fortunately, there is a library that can simplify this work: Python-IRCLib. This article, the first of three parts, takes a look at this library and what you can do with it, with a focus on event handling.
As you can see, it's quite a list. Specific information can be found in the IRC protocol's documentation, but you most likely won't want to respond to most of the events supported by Python-IRCLib. There is simply no need, unless your aim is to create a full IRC client.
The most recent events contain mostly events to which you will need to give some thought when building your application, such as private messages and notices.
In this article, we've taken a look at a very important concept in Python-IRCLib: catching and reacting to events. Any application of purpose that interacts through IRC will have to examine events, whether it simply saves statistics and logs of activity or does something a bit more complex, such as take commands from select users and behave appropriately.
It is not possible to cover all of the library's features in just one article, so don't worry if you feel left in the dark right now. An understanding of events is important before we continue to more of the library's features, such as the building of bots.
Experiment with event handling in Python-IRCLib. One helpful technique is to turn the DEBUG variable on and examine the incoming data. If anything pops up that you don't recognize, it might be worth taking a look at.