errbot.backends.text module¶
-
class
errbot.backends.text.
TextBackend
(config)[source]¶ Bases:
errbot.core.ErrBot
-
build_reply
(msg, text=None, private=False, threaded=False)[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.
-
mode
¶
-
prefix_groupchat_reply
(message, identifier)[source]¶ Patches message with the conventional prefix to ping the specific contact For example: @gbin, you forgot the milk !
-
query_room
(room)[source]¶ Query a room for information.
Parameters: room – The room to query for. Returns: An instance of Room
.
-
send_message
(msg)[source]¶ This needs to be overridden by the backends with a super() call.
Parameters: msg – the message to send. Returns: None
-
serve_forever
()[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.text.
TextOccupant
(person, room)[source]¶ Bases:
errbot.backends.text.TextPerson
,errbot.backends.base.RoomOccupant
-
room
¶ Some backends have the full name of a user.
Returns: the fullname of this user if available.
-
-
class
errbot.backends.text.
TextPerson
(person, client=None, nick=None, fullname=None)[source]¶ Bases:
errbot.backends.base.Person
Simple Person implementation which represents users as simple text strings.
-
__init__
(person, client=None, nick=None, fullname=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
aclattr
¶ Returns: returns the unique identifier that will be used for ACL matches.
-
client
¶ Returns: a backend specific unique identifier representing the device or client the person is using to talk.
-
email
¶ Some backends have the email of a user.
Returns: the email of this user if available.
-
fullname
¶ Some backends have the full name of a user.
Returns: the fullname of this user if available.
-
nick
¶ Returns: a backend specific nick returning the nickname of this person if available.
-
person
¶ Returns: a backend specific unique identifier representing the person you are talking to.
-
-
class
errbot.backends.text.
TextRoom
(name, bot)[source]¶ Bases:
errbot.backends.base.Room
-
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 identifiers 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 occupant identities. 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.
Note
Back-ends may return an empty string rather than None when no topic has been set as a network may not differentiate between no topic and an empty topic.
Raises: MUCNotJoinedError
if the room has not yet been joined.
-