Basic IRC Tasks - User Related Tasks
(Page 4 of 5 )
The “WHO” command matches a pattern against users on a network:
WHO pattern
For example, let's say you wanted to search for everyone whose username began with “K”:
WHO K*
Let's create a method that queries the server with the “WHO” command:
def who ( self, pattern ):
self.send ( 'WHO ' + pattern )
We can also request information on an indivudal using the “WHOIS” command:
WHOIS user
Creating a Python method that uses this command is, of course, easy:
def whois ( self, nick ):
self.send ( 'WHOIS ' + nick )
Lastly, we can look up information on a user that has changed his or her nickname or has left the network using “WHOWAS”:
WHOWAS user
And here's the Python method:
def whowas ( self, nick ):
self.send ( 'WHOWAS ' + nick )
Next: Processing Information >>
More Python Articles
More By Peyton McCullough