Bases: object
Base class for IRC connections.
Must be overridden.
Bases: hanyuu.ircbot.irclib.connection.Event
Class representing an IRC event.
Bases: exceptions.Exception
Represents an IRC exception.
Bases: hanyuu.ircbot.irclib.connection.Connection
This class represents an IRC server connection.
Close the connection.
Warning
This method closes the connection permanently; after it has been called, the object is unusable.
Connect/reconnect to a server.
Parameters: |
|
---|
This function can be called to reconnect a closed connection.
Returns the ServerConnection object.
Get the (real) nick name.
This method returns the (real) nickname. The library keeps track of nick changes, so it might not be the nick name that was passed to the connect() method.
Get the (real) server name.
This method returns the (real) server name, or, more specifically, what the server calls itself.
Return the topic of a channel.
Note
You must be joined to the channel in order to get the topic.
Check if nick has any of the specified modes on a channel.
Check if a string is a channel name.
Returns True if the argument is a channel name, otherwise False.
Checks if a user has identified for their Nickname via NickServ returns boolean
Send a QUIT command.
Note
This is not the same as disconnect().
Note
Many IRC servers don’t use your quit message unless you’ve been connected for at least 5 minutes.
Bases: hanyuu.ircbot.irclib.connection.ServerConnectionError
Bases: hanyuu.ircbot.irclib.connection.Connection
This class represents a DCC connection.
DCCConnection objects are instantiated by calling session.Session.dcc().
For usage, see connect() and listen().
Connect/reconnect to a DCC peer.
Parameters: |
|
---|
Returns the DCCConnection object.
Hang up the connection and close the object.
Parameters: | message – Quit message. |
---|
Note
After calling this method, the object becomes unusable.
Wait for a connection/reconnection from a DCC peer.
Returns the DCCConnection object.
The local IP address and port are available as localaddress and localport. After connection from a peer, the peer address and port are available as peeraddress and peerport.
A high level session object to the lower level irclib.connection module.
Bases: object
A abstracted event of the IRC library.
Bases: object
A simple class that represents a nickname on IRC.
Contains information such as actual nickname, hostmask and more.
Class that handles one or several IRC server connections.
When a Session object has been instantiated, it can be used to create Connection objects that represent the IRC connections. The responsibility of the Session object is to provide a high-level event-driven framework for the connections and to keep the connections alive. It runs a select loop to poll each connection’s TCP socket and hands over the sockets with incoming data for processing by the corresponding connection. It then encapsulates the low level IRC events generated by the Connection objects into higher level versions.
Used to respond to CTCP SOURCE messages.
Used to respond to CTCP VERSION messages.
Creates and returns a dcc.DCCConnection object.
Parameters: | dcctype – “chat” for DCC CHAT connections or “raw” for DCC SEND (or other DCC types). If “chat”, incoming data will be split in newline-separated chunks. If “raw”, incoming data is not touched. |
---|
Disconnects all connections.
Parameters: | message – The quit message to send to servers. |
---|
Execute a function at a specified time.
Parameters: |
|
---|
Execute a function after a specified time.
Parameters: |
|
---|
Called when there is more data to read on connection sockets.
Parameters: | sockets – A list of socket objects to be processed. |
---|
Run an infinite loop, processing data from connections.
This method repeatedly calls process_once().
Parameters: | timeout – Parameter to pass to process_once. |
---|
Process data from connections once.
Parameters: | timeout – How long the select() call should wait if no data is available. |
---|
This method should be called periodically to check and process incoming and outgoing data, if there is any.
It calls process_data(), _send_once() and process_timeout().
It will also examine when we last received data from the server; if it exceeds a specified time limit, the Session assumes that we have lost connection to the server and will attempt to reconnect us.
If calling it manually seems boring, look at the process_forever() method.
This is called to process any delayed commands that are registered to the Session object.
See also
The decorator for high level event handlers. By decorating a function with this, the function is registered in the global Session event handler list, Session.handlers.
Parameters: |
|
---|
All the high level events that we can register to. Low level events that aren’t on this list can be registered to as well, but they will not be parsed.
Module that contains all the classes required to track channels, nicknames modes and other related stuff.
This class is used to track nicknames, channels, and the modes that are associated to nicknames on channels. It also tracks channel topics.
This tracker uses an internal Sqlite database to store its information.
Returns true if the nickname ‘nick’ has the modes ‘modes’ in the channel ‘chan’.
Based on the value of ‘operator’, the return value is different; if the operator is ‘and’, the nickname must have ALL of the specified modes. If the operator is ‘or’, the nickname must have ANY of the specified modes.
Convert an IP number as an integer given in ASCII representation (e.g. ‘3232235521’) to an IP address string (e.g. ‘192.168.0.1’).
Convert an IP address string (e.g. ‘192.168.0.1’) to an IP number as an integer given in ASCII representation (e.g. ‘3232235521’).
Returns a lowercased string.
The definition of lowercased comes from the IRC specification (RFC 1459).
Check if a nick matches a mask.
Returns True if the nick matches, otherwise False.
The characters that are permitted in IRC nicknames
Get the host part of a nickmask.
(The source of an connection.Event is a nickmask.)
Get the nick part of a nickmask.
(The source of an connection.Event is a nickmask.)