errbot.backends.xmpp module¶
- class errbot.backends.xmpp.XMPPBackend(config)[source]¶
Bases:
ErrBot
- build_identifier(txtrep: str) XMPPRoomOccupant | XMPPRoom | XMPPPerson [source]¶
- build_reply(msg: Message, text: str = None, private: bool = False, threaded: bool = False) Message [source]¶
Should be implemented by the backend
- change_presence(status: str = 'online', message: str = '') None [source]¶
Signal a presence change for the bot. Should be overridden by backends with a super().send_message() call.
- create_connection() XMPPConnection [source]¶
- property mode¶
- prefix_groupchat_reply(message: Message, identifier: Identifier)[source]¶
Patches message with the conventional prefix to ping the specific contact For example: @gbin, you forgot the milk !
- query_room(room) XMPPRoom [source]¶
Query a room for information.
- Parameters:
room – The JID/identifier of the room to query for.
- Returns:
An instance of
XMPPMUCRoom
.
- roomoccupant_factory¶
alias of
XMPPRoomOccupant
- rooms() List[XMPPRoom] [source]¶
Return a list of rooms the bot is currently in.
- Returns:
A list of
XMPPMUCRoom
instances.
- send_message(msg: Message) None [source]¶
This needs to be overridden by the backends with a super() call.
- Parameters:
msg – the message to send.
- Returns:
None
- serve_forever() None [source]¶
Connect the back-end to the server and serve forever.
Back-ends MAY choose to re-implement this method, in which case they are responsible for implementing reconnection logic themselves.
Back-ends SHOULD trigger
connect_callback()
anddisconnect_callback()
themselves after connection/disconnection.
- class errbot.backends.xmpp.XMPPConnection(jid, password, feature=None, keepalive=None, ca_cert=None, server=None, use_ipv6=None, bot=None, ssl_version=None)[source]¶
Bases:
object
- __init__(jid, password, feature=None, keepalive=None, ca_cert=None, server=None, use_ipv6=None, bot=None, ssl_version=None)[source]¶
- connect() XMPPConnection [source]¶
- class errbot.backends.xmpp.XMPPIdentifier(node, domain, resource)[source]¶
Bases:
Identifier
This class is the parent and the basic contract of all the ways the backends are identifying a person on their system.
- property client¶
- property domain: str¶
- property email¶
- property fullname: None¶
- property nick: str¶
- property node: str¶
- property person: str¶
- property resource: str¶
- class errbot.backends.xmpp.XMPPPerson(node, domain, resource)[source]¶
Bases:
XMPPIdentifier
,Person
- property aclattr: str¶
- Returns:
returns the unique identifier that will be used for ACL matches.
- class errbot.backends.xmpp.XMPPRoom(room_jid, bot: ErrBot)[source]¶
Bases:
XMPPIdentifier
,Room
- configure() None [source]¶
Configure the room.
Currently this simply sets the default room configuration as received by the server. May be extended in the future to set a custom room configuration instead.
- create() None [source]¶
Not supported on this back-end (Slixmpp doesn’t support it). Will join the room to ensure it exists, instead.
- property exists: bool¶
Boolean indicating whether this room already exists or not.
- Getter:
Returns True if the room exists, False otherwise.
- invite(*args) None [source]¶
Invite one or more people into the room.
- *argsargs:
One or more JID’s to invite into the room.
- join(username: str | None = None, password: str | None = None) None [source]¶
Join the room.
If the room does not exist yet, this will automatically call
create()
on it first.
- property joined: bool¶
Boolean indicating whether this room has already been joined.
- Getter:
Returns True if the room has been joined, False otherwise.
- leave(reason: str | None = None) None [source]¶
Leave the room.
- Parameters:
reason – An optional string explaining the reason for leaving the room
- property occupants: List[XMPPRoomOccupant]¶
The room’s occupants.
- Getter:
Returns a list of
MUCOccupant
instances.- Raises:
MUCNotJoinedError
if the room has not yet been joined.
- property topic: str | None¶
The room topic.
- Getter:
Returns the topic (a string) if one is set, None if no topic has been set at all.
- Raises:
RoomNotJoinedError
if the room has not yet been joined.
- class errbot.backends.xmpp.XMPPRoomOccupant(node, domain, resource, room)[source]¶
Bases:
XMPPPerson
,RoomOccupant
- property nick: str¶
- Returns:
a backend specific nick returning the nickname of this person if available.
- property person¶
- Returns:
a backend specific unique identifier representing the person you are talking to.
- property real_jid: str¶
The JID of the room occupant, they used to login. Will only work if the errbot is moderator in the MUC or it is not anonymous.