Table of contents Index

class SingleServerIRCBot - A single-server IRC bot class.

Declared in module ircbot

Inheritance hierarchy:

ircbot.SingleServerIRCBot
  irclib.SimpleIRCClient

Synopsis

class SingleServerIRCBot(SimpleIRCClient):
    def __init__(self, server_list, nickname, realname, reconnection_interval=60) # Constructor for SingleServerIRCBot objects.
    def _connect(self) # [Internal]
    def _connected_checker(self) # [Internal]
    def _on_disconnect(self, c, e) # [Internal]
    def _on_join(self, c, e) # [Internal]
    def _on_kick(self, c, e) # [Internal]
    def _on_mode(self, c, e) # [Internal]
    def _on_namreply(self, c, e) # [Internal]
    def _on_nick(self, c, e) # [Internal]
    def _on_part(self, c, e) # [Internal]
    def _on_quit(self, c, e) # [Internal]
    def die(self, msg='Bye, cruel world!') # Let the bot die.
    def disconnect(self, msg="I'll be back!") # Disconnect the bot.
    def get_version(self) # Returns the bot version.
    def jump_server(self) # Connect to a new server, possible disconnecting from the current.
    def on_ctcp(self, c, e) # Default handler for ctcp events.
    def start(self) # Start the bot.

    # Inherited from irclib.SimpleIRCClient
    def __init__(self)
    def _dispatcher(self, c, e) # [Internal]
    def connect(self, server, port, nickname, password=None, username=None, ircname=None) # Connect/reconnect to a server.
    def start(self) # Start the IRC client.

Description

The bot tries to reconnect if it is disconnected.

The bot keeps track of the channels it has joined, the other clients that are present in the channels and which of those that have operator or voice modes. The "database" is kept in the self.channels attribute, which is an IRCDict of Channels.

disconnect(self, msg="I'll be back!")

Disconnect the bot.

msg="I'll be back!"
Quit message.

The bot will try to reconnect after a while.

get_version(self)

Returns the bot version.

Used when answering a CTCP VERSION request.

jump_server(self)

Connect to a new server, possible disconnecting from the current.

The bot will skip to next server in the server_list each time jump_server is called.

on_ctcp(self, c, e)

Default handler for ctcp events.

Replies to VERSION and PING requests.

connect(self, server, port, nickname, password=None, username=None, ircname=None)

Connect/reconnect to a server.

server
Server name.
port
Port number.
nickname
The nickname.
password=None
Password (if any).
username=None
The username.
ircname=None
The IRC name.

This function can be called to reconnect a closed connection.


Valid HTML 4.0! Made with CSS