Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (42 sloc) 1.91 KB


.. automodule:: ircutils.client


.. autoclass:: SimpleClient
   :members: connect, execute, identify, join_channel, part_channel, disconnect,
             send_action, send_ctcp, send_ctcp_reply, send_message, send_notice,
             set_nickname, register_listener, start

   .. attribute:: nickname

         The nickname bound to the client. To set a new nickname, use the
         :func:`ircutils.client.SimpleClient.set_nickname` method.

   .. attribute:: filter_formatting

         By default, ``filter_formatting`` is set to true. This means that any
         messages received that contain formatting tags will have those tags

   .. attribute:: channels

         A dict of channels which the bot has joined. The keys are the channel
         names and the values are :class:`ircutils.protocol.Channel` instances.

   .. attribute:: real_name

         Shows up when ``WHOIS`` data is queried. It is set to the web
         address to ``ircutils`` by default.

   .. attribute:: user

             The user ID. Typically this is set to the nickname; however, you
             explicitly set it before connecting.


Here is a simple script that works with the IRC client in order to print messages:

from ircutils import client

def message_printer(client, event):
    print "<{0}/{1}> {2}".format(event.source,, event.message)

def notice_printer(client, event):
    print "(NOTICE) {0}".format(event.message)

# Create a SimpleClient instance
my_client = client.SimpleClient(nick="client_name")

# Add the event handlers

# Finish setting up the client
my_client.connect("", channel="#ircutils")