errbot.backends.hipchat module

class errbot.backends.hipchat.HipChatRoom(name, bot)[source]

Bases: errbot.backends.base.Room

This class represents a Multi-User Chatroom.

__init__(name, bot)[source]
Parameters:name – The name of the room
create(privacy='public', guest_access=False)[source]

Create the room.

Calling this on an already existing room is a no-op.

Parameters:
  • privacy (str) – Whether the room is available for access by other users or not. Valid values are “public” and “private”.
  • guest_access (bool) – Whether or not to enable guest access for this room.
destroy()[source]

Destroy the room.

Calling this on a non-existing room is a no-op.

domain
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.

Parameters:args – One or more people to invite into the room. May be the mention name (beginning with an @) or “FirstName LastName” of the user you wish to invite.
jid
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 or not.

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
name

The name of this room

node
notify(message, color=None, notify=False, message_format=None)[source]

Send a notification to a room.

See the HipChat API documentation for more info.

occupants

The room’s occupants.

Getter:Returns a list of HipChatMUCOccupant instances.
resource
room

Return room information from the HipChat API

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.hipchat.HipChatRoomOccupant(node=None, domain=None, resource=None, room=None, hipchat_user=None, aclattr=None)[source]

Bases: errbot.backends.xmpp.XMPPRoomOccupant

An occupant of a Multi-User Chatroom.

This class has all the attributes that are returned by a call to https://www.hipchat.com/docs/apiv2/method/get_all_participants with the link to self expanded.

__init__(node=None, domain=None, resource=None, room=None, hipchat_user=None, aclattr=None)[source]
Parameters:hipchat_user – A user object as returned by https://www.hipchat.com/docs/apiv2/method/get_all_participants with the link to self expanded.
aclattr
Returns:returns the unique identifier that will be used for ACL matches.
class errbot.backends.hipchat.HipchatBackend(config)[source]

Bases: errbot.backends.xmpp.XMPPBackend

__init__(config)[source]

Those arguments will be directly those put in BOT_IDENTITY

build_reply(msg, text=None, private=False, threaded=False)[source]

Should be implemented by the backend

callback_message(msg)[source]

Processes for commands and dispatches the message to all the plugins.

create_connection()[source]
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[source]

Query a room for information.

Parameters:room – The name (preferred) or XMPP JID of the room to query for.
Returns:An instance of HipChatRoom.
room_factory

alias of HipChatRoom

roomoccupant_factory

alias of HipChatRoomOccupant

rooms()[source]

Return a list of rooms the bot is currently in.

Returns:A list of HipChatRoom instances.
send_card(card)[source]

Sends a card, this can be overriden by the backends without a super() call.

Parameters:card – the card to send.
Returns:None
send_stream_request(identifier, fsource, name='file.txt', size=None, stream_type=None)[source]

Starts a file transfer. note, fsource used to make the stream needs to be in open/rb state

class errbot.backends.hipchat.HipchatClient(*args, **kwargs)[source]

Bases: errbot.backends.xmpp.XMPPConnection

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

users

A list of all the users.

See also: https://www.hipchat.com/docs/apiv2/method/get_all_users

class errbot.backends.hipchat.HipchatExtension(**kwargs)[source]

Bases: markdown.extensions.Extension

Removes the unsupported html tags from hipchat

extendMarkdown(md, md_globals)[source]

Add the various proccesors and patterns to the Markdown Instance.

This method must be overriden by every extension.

Keyword arguments:

  • md: The Markdown instance.
  • md_globals: Global variables in the markdown module namespace.
class errbot.backends.hipchat.HipchatTreeprocessor(md=None)[source]

Bases: markdown.treeprocessors.Treeprocessor

run(root)[source]

Subclasses of Treeprocessor should implement a run method, which takes a root ElementTree. This method can return another ElementTree object, and the existing root ElementTree will be replaced, or it can modify the current tree and return None.

errbot.backends.hipchat.hipchat_html()[source]