Python
  Home arrow Python arrow Page 2 - Basic IRC Tasks
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
Moblin 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Basic IRC Tasks
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2005-04-18

    Table of Contents:
  • Basic IRC Tasks
  • Communication Tasks
  • Channel Related Tasks
  • User Related Tasks
  • Processing Information

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Basic IRC Tasks - Communication Tasks


    (Page 2 of 5 )

    All right. It's time to get into some actual tasks now that the basics of our module are completed. Let's start with communication, since it's pretty basic. “PRIVMSG” is the logical place to start. Recall the command from the last article:

    PRIVMSG destination :message

    This is easy to work into our class. We'll just create a method, privmsg, that accepts two arguments. The first argument is the destination, and the second argument is the message to be sent:

    def privmsg ( self, destination, message ):

       self.send ( 'PRIVMSG ' + destination + ' :' + message )

    The “PRIVMSG” command works with nicknames and channels both.

    The “NOTICE” command can also be used to send messages:

    def notice ( self, destination, message ):

       self.send ( 'NOTICE ' + destination + ' :' + message )

    As you can see, “NOTICE” works very similarly to “PRIVMSG.” The only difference is how the commands are intended to be handled. “NOTICE” must never be automatically replied to.

    More Python Articles
    More By Peyton McCullough


       · One thing though, your code does not take into account the IRC PING command, so your...
       · The source (...!...@...) on the beginning of the message is not mandatory. The first...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...

    Click Here




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway