Home arrow Python arrow Page 4 - IRC on a Higher Level

All Supported Events - Python

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.

TABLE OF CONTENTS:
  1. IRC on a Higher Level
  2. Getting Started
  3. Events
  4. All Supported Events
By: Peyton McCullough
Rating: starstarstarstarstar / 10
October 05, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Earlier, I promised a list of events that you can respond to. Here is a list of numeric codes and their appropriate codes:

216 -> statskline
217 -> statsqline
214 -> statsnline
215 -> statsiline
212 -> statscommands
213 -> statscline
210 -> tracereconnect
211 -> statslinkinfo
218 -> statsyline
219 -> endofstats
491 -> nooperhost
492 -> noservicehost
407 -> toomanytargets
406 -> wasnosuchnick
346 -> invitelist
347 -> endofinvitelist
403 -> nosuchchannel
341 -> inviting
342 -> summoning
348 -> exceptlist
349 -> endofexceptlist
409 -> noorigin
263 -> tryagain
262 -> endoftrace
261 -> tracelog
266 -> n_global
265 -> n_local
442 -> notonchannel
423 -> noadmininfo
422 -> nomotd
424 -> fileerror
414 -> wildtoplevel
437 -> unavailresource
411 -> norecipient
412 -> notexttosend
413 -> notoplevel
371 -> info
373 -> infostart
372 -> motd
375 -> motdstart
374 -> endofinfo
377 -> motd2
376 -> endofmotd
319 -> whoischannels
318 -> endofwhois
313 -> whoisoperator
312 -> whoisserver
311 -> whoisuser
317 -> whoisidle
316 -> whoischanop
315 -> endofwho
314 -> whowasuser
393 -> users
392 -> usersstart
391 -> time
395 -> nousers
394 -> endofusers
443 -> useronchannel
368 -> endofbanlist
369 -> endofwhowas
366 -> endofnames
367 -> banlist
364 -> links
365 -> endoflinks
362 -> closing
363 -> closeend
361 -> killdone
300 -> none
301 -> away
302 -> userhost
303 -> ison
305 -> unaway
306 -> nowaway
444 -> nologin
244 -> statshline
382 -> rehashing
241 -> statslline
445 -> summondisabled
243 -> statsoline
242 -> statsuptime
381 -> youreoper
436 -> nickcollision
384 -> myportis
432 -> erroneusnickname
433 -> nicknameinuse
431 -> nonicknamegiven
451 -> notregistered
331 -> notopic
333 -> topicinfo
332 -> topic
258 -> adminloc2
259 -> adminemail
252 -> luserop
253 -> luserunknown
250 -> luserconns
251 -> luserclient
256 -> adminme
257 -> adminloc1
254 -> luserchannels
255 -> luserme
405 -> toomanychannels
404 -> cannotsendtochan
502 -> usersdontmatch
402 -> nosuchserver
401 -> nosuchnick
465 -> yourebannedcreep
464 -> passwdmismatch
467 -> keyset
466 -> youwillbebanned
461 -> needmoreparams
463 -> nopermforhost
462 -> alreadyregistered
221 -> umodeis
446 -> usersdisabled
501 -> umodeunknownflag
234 -> servlist
235 -> servlistend
231 -> serviceinfo
232 -> endofservices
233 -> service
441 -> usernotinchannel
322 -> list
323 -> listend
321 -> liststart
324 -> channelmodeis
476 -> badchanmask
329 -> channelcreate
477 -> nochanmodes
201 -> traceconnecting
200 -> tracelink
203 -> traceunknown
202 -> tracehandshake
205 -> traceuser
204 -> traceoperator
207 -> traceservice
206 -> traceserver
209 -> traceclass
208 -> tracenewtype
475 -> badchannelkey
003 -> created
002 -> yourhost
001 -> welcome
005 -> featurelist
004 -> myinfo
474 -> bannedfromchan
485 -> uniqopprivsneeded
484 -> restricted
483 -> cantkillserver
482 -> chanoprivsneeded
481 -> noprivileges
472 -> unknownmode
473 -> inviteonlychan
471 -> channelisfull
353 -> namreply
352 -> whoreply
351 -> version
421 -> unknowncommand
478 -> banlistfull

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.

A few more events are also defined:

dcc_connect
dcc_disconnect
dccmsg
disconnect
ctcp
ctcpreply
error
join
kick
mode
part
ping
privmsg
privnotice
pubmsg
pubnotice
quit

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.

Conclusion

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.



 
 
>>> More Python Articles          >>> More By Peyton McCullough
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: