Skip to content
fro_ozen edited this page Jul 25, 2015 · 3 revisions

All of the following are located in the modules pybot.irc

The Irc_event class

An Irc_event represents a line of the IRC protocol.

Attributes and methods
class Irc_event(object):
    # Attribtues
    self.name # Name of the origin(either nickname or server)
    self.user # User part of the origin(user@host)
    self.host # Host part of the origin
    self.type # Type of the event
    self.args # Arguments of the event
    self.signal # Signal string sent by Irc_server.send_event ()
Initialisation

An Irc_event can be created by:

1: Passing it a line of the IRC protocol, which will then be parsed:

event = irc.Irc_event(":name!user@host PRIVMS :Hello.")

2: Passing it a type and an arbitriary amount of arguments:

event = irc.Irc_event("PRIVMSG", "#python", "Hello.")

The Irc_server class

An Irc_server represents the connection to an IRC server.

Attributes and methods
class Irc_server(object):
    # Attributes
    self.port # The port it is connected to
    self.host # The hostname of the server it is connected to
    self.name # The identifier of the server
    self.nick # The nickname, the server is connected as

    self.shared_data # A Data_container object
    self.configuration # A Configuration_data_container object
    self.persistent_data # A Persistent_data_container object
    self.user_data # A User_data object

    # Methods
    def send_event(self, event) # Send an event over the connection
Initialisation

An Irc_server is created by passing it a Data_container object containing the following values:

name: Identifier
host: Address of the server
port: Port of ther server(optional
nick: Nickname the bot should connect as
channels: Channels to join upon connect(optional)