Home arrow Python arrow Page 4 - Basic IRC Tasks

User Related Tasks - Python

Following up on an earlier DevShed article covering the basics of Python and Internet Relay Chat, this article takes some common IRC tasks, such as listing the users in a given channel or manipulating a channel's modes, and shows how to turn them into Pyton code.

TABLE OF CONTENTS:
  1. Basic IRC Tasks
  2. Communication Tasks
  3. Channel Related Tasks
  4. User Related Tasks
  5. Processing Information
By: Peyton McCullough
Rating: starstarstarstarstar / 4
April 18, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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 )



 
 
>>> 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: