errbot.backends.irc module

class errbot.backends.irc.IRCBackend(config)[source]

Bases: errbot.core.ErrBot

__init__(config)[source]
aclpattern = '{nick}!{user}@{host}'
build_identifier(txtrep)[source]
build_message(text)[source]
build_reply(msg, text=None, private=False, threaded=False)[source]
change_presence(status: str = 'online', message: str = '') → None[source]
connect()[source]
mode
prefix_groupchat_reply(message, identifier)[source]
query_room(room)[source]

Query a room for information.

Parameters:room -- The channel name to query for.
Returns:An instance of IRCMUCRoom.
rooms()[source]

Return a list of rooms the bot is currently in.

Returns:A list of IRCMUCRoom instances.
send_message(msg)[source]
send_stream_request(identifier, fsource, name=None, size=None, stream_type=None)[source]
serve_forever()[source]
shutdown()[source]
class errbot.backends.irc.IRCConnection(bot, nickname, server, port=6667, ssl=False, bind_address=None, ipv6=False, password=None, username=None, nickserv_password=None, private_rate=1, channel_rate=1, reconnect_on_kick=5, reconnect_on_disconnect=5)[source]

Bases: irc.bot.SingleServerIRCBot

__init__(bot, nickname, server, port=6667, ssl=False, bind_address=None, ipv6=False, password=None, username=None, nickserv_password=None, private_rate=1, channel_rate=1, reconnect_on_kick=5, reconnect_on_disconnect=5)[source]
away(message='')[source]

Extend the original implementation to support AWAY. To set an away message, set message to something. To cancel an away message, leave message at empty string.

connect(*args, **kwargs)[source]
on_currenttopic(connection, event)[source]

When you Join a room with a topic set this event fires up to with the topic information. If the room that you join don't have a topic set, nothing happens. Here is NOT the place to fire the callback_room_topic() event for that case exist on_topic.

Parameters:
  • connection -- Is an 'irc.client.ServerConnection' object
  • event -- Is an 'irc.client.Event' object The event.arguments[0] contains the room name The event.arguments[1] contains the topic of the room.
on_dcc_connect(dcc, event)[source]
on_dcc_disconnect(dcc, event)[source]
on_dccmsg(dcc, event)[source]
on_disconnect(connection, event)[source]
on_endofnames(connection, event)[source]

Handler of the enfofnames IRC message/event.

The endofnames message is sent to the client when the server finish to send the list of names of the room ocuppants. This usually happens when you join to the room. So in this case, we use this event to determine that our bot is finally joined to the room.

Parameters:
  • connection -- Is an 'irc.client.ServerConnection' object
  • event -- Is an 'irc.client.Event' object the event.arguments[0] contains the channel name
on_join(connection, event)[source]

Handler of the join IRC message/event. Is in response of a /JOIN client message.

Parameters:
  • connection -- Is an 'irc.client.ServerConnection' object
  • event -- Is an 'irc.client.Event' object the event.target contains the channel name
on_kick(_, e)[source]
on_notopic(connection, event)[source]

This event fires ip when there is no topic set on a room

Parameters:
  • connection -- Is an 'irc.client.ServerConnection' object
  • event -- Is an 'irc.client.Event' object The event.arguments[0] contains the room name
on_part(connection, event)[source]

Handler of the part IRC Message/event.

The part message is sent to the client as a confirmation of a /PART command sent by someone in the room/channel. If the event.source contains the bot nickname then we need to fire the callback_room_left() event on the bot.

Parameters:
  • connection -- Is an 'irc.client.ServerConnection' object
  • event -- Is an 'irc.client.Event' object The event.source contains the nickmask of the user that leave the room The event.target contains the channel name
on_privmsg(_, e)[source]
on_privnotice(_, e)[source]
on_pubmsg(_, e)[source]
on_pubnotice(_, e)[source]
on_topic(connection, event)[source]

On response to the /TOPIC command if the room have a topic. If the room don't have a topic the event fired is on_notopic :param connection: Is an 'irc.client.ServerConnection' object

Parameters:event -- Is an 'irc.client.Event' object The event.target contains the room name. The event.arguments[0] contains the topic name
on_welcome(_, e)[source]
static send_chunk(stream, dcc)[source]
send_private_message(to, line)[source]
send_public_message(to, line)[source]
send_stream_request(identifier, fsource, name=None, size=None, stream_type=None)[source]
class errbot.backends.irc.IRCPerson(mask)[source]

Bases: errbot.backends.base.Person

__init__(mask)[source]
aclattr
client
fullname
host
nick
person
user
class errbot.backends.irc.IRCRoom(room, bot)[source]

Bases: errbot.backends.base.Room

Represent the specifics of a IRC Room/Channel.

This lifecycle of this object is:
  • Created in IRCConnection.on_join
  • The joined status change in IRCConnection on_join/on_part
  • Deleted/destroyed in IRCConnection.on_disconnect
__init__(room, bot)[source]
cb_set_topic(current_topic)[source]

Store the current topic for this room.

This method is called by the IRC backend when a currenttopic, topic or notopic IRC event is received to store the topic set for this channel.

This function is not meant to be executed by regular plugins. To get or set

create()[source]

Not supported on this back-end. Will join the room to ensure it exists, instead.

destroy()[source]

Not supported on IRC, will raise RoomError.

exists

Boolean indicating whether this room already exists or not.

Getter:Returns True if the room exists, False otherwise.
invite(*args)[source]

Invite one or more people into the room.

*argsargs:One or more nicks to invite into the room.
join(username=None, password=None)[source]

Join the room.

If the room does not exist yet, this will automatically call create() on it first.

joined

Boolean indicating whether this room has already been joined.

Getter:Returns True if the room has been joined, False otherwise.
leave(reason=None)[source]

Leave the room.

Parameters:reason -- An optional string explaining the reason for leaving the room
occupants

The room's occupants.

Getter:Returns a list of occupants. :raises: MUCNotJoinedError if the room has not yet been joined.
topic

The room topic.

Getter:Returns the topic (a string) if one is set, None if no topic has been set at all.
class errbot.backends.irc.IRCRoomOccupant(mask, room)[source]

Bases: errbot.backends.irc.IRCPerson, errbot.backends.base.RoomOccupant

__init__(mask, room)[source]
room
errbot.backends.irc.irc_md()[source]

This makes a converter from markdown to mirc color format.