errbot.core module

class errbot.core.ErrBot(bot_config)[source]

Bases: errbot.backends.base.Backend, errbot.storage.StoreMixin

ErrBot is the layer taking care of commands management and dispatching.

MSG_ERROR_OCCURRED = 'Computer says nooo. See logs for details'
MSG_UNKNOWN_COMMAND = 'Unknown command: "%(command)s". '
__init__(bot_config)[source]

Those arguments will be directly those put in BOT_IDENTITY

all_commands

Return both commands and re_commands together.

attach_plugin_manager(plugin_manager) → None[source]
attach_repo_manager(repo_manager) → None[source]
attach_storage_plugin(storage_plugin) → None[source]
callback_mention(msg: errbot.backends.base.Message, people: List[errbot.backends.base.Identifier]) → None[source]
callback_message(msg: errbot.backends.base.Message) → None[source]

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

callback_presence(pres: errbot.backends.base.Presence) → None[source]

Implemented by errBot.

callback_reaction(reaction) → None[source]

Triggered when a reaction occurs.

Parameters:reaction – An instance of Reaction representing the reaction event data
callback_room_joined(room: errbot.backends.base.Room, identifier: Optional[errbot.backends.base.Identifier] = None, invited_by: Optional[errbot.backends.base.Identifier] = None) → None[source]

Triggered when a user has joined a MUC.

Parameters:
  • room (Room) – An instance of MUCRoom representing the room that was joined.
  • identifier – An instance of Identifier (Person). Defaults to bot
  • invited_by – An instance of Identifier (Person). Defaults to None
callback_room_left(room: errbot.backends.base.Room, identifier: Optional[errbot.backends.base.Identifier] = None, kicked_by: Optional[errbot.backends.base.Identifier] = None) → None[source]

Triggered when a user has left a MUC.

Parameters:
  • room (Room) – An instance of MUCRoom representing the room that was left.
  • identifier – An instance of Identifier (Person). Defaults to bot
  • kicked_by – An instance of Identifier (Person). Defaults to None
callback_room_topic(room: errbot.backends.base.Room) → None[source]

Triggered when the topic in a MUC changes.

Parameters:room (Room) – An instance of MUCRoom representing the room for which the topic changed.
callback_stream(stream) → None[source]
connect_callback() → None[source]
disconnect_callback() → None[source]
get_command_classes() → Tuple[Any][source]
get_doc(command: Callable) → str[source]

Get command documentation

static get_plugin_class_from_method(meth)[source]
initialize_backend_storage() → None[source]

Initialize storage for the backend to use.

inject_command_filters_from(instance_to_inject) → None[source]
inject_commands_from(instance_to_inject)[source]
inject_flows_from(instance_to_inject) → None[source]
message_size_limit
prefix_groupchat_reply(message: errbot.backends.base.Message, identifier: errbot.backends.base.Identifier) → None[source]

Patches message with the conventional prefix to ping the specific contact For example: @gbin, you forgot the milk !

process_message(msg: errbot.backends.base.Message) → bool[source]

Check if the given message is a command for the bot and act on it. It return True for triggering the callback_messages on the .callback_messages on the plugins.

Return type:bool
Parameters:msg (Message) – the incoming message.
static process_template(template_name, template_parameters)[source]
remove_command_filters_from(instance_to_inject) → None[source]
remove_commands_from(instance_to_inject) → None[source]
remove_flows_from(instance_to_inject) → None[source]
send(identifier: errbot.backends.base.Identifier, text: str, in_reply_to: Optional[errbot.backends.base.Message] = None, groupchat_nick_reply: bool = False) → None[source]

Sends a simple message to the specified user.

Parameters:
  • identifier (Identifier) – an identifier from build_identifier or from an incoming message
  • in_reply_to – the original message the bot is answering from
  • text (str) – the markdown text you want to send
  • groupchat_nick_reply (bool) – authorized the prefixing with the nick form the user
send_card(card: errbot.backends.base.Message) → None[source]

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

Parameters:card (Message) – the card to send.
Returns:None
send_message(msg: errbot.backends.base.Message) → None[source]

This needs to be overridden by the backends with a super() call.

Parameters:msg (Message) – the message to send.
Returns:None
send_simple_reply(msg: errbot.backends.base.Message, text: str, private: bool = False, threaded: bool = False) → None[source]

Send a simple response to a given incoming message

Parameters:
  • private (bool) – if True will force a response in private.
  • threaded (bool) – if True and if the backend supports it, sends the response in a threaded message.
  • text (str) – the markdown text of the message.
  • msg (Message) – the message you are replying to.
send_templated(identifier: errbot.backends.base.Identifier, template_name, template_parameters, in_reply_to: Optional[errbot.backends.base.Message] = None, groupchat_nick_reply: bool = False) → Callable[source]

Sends a simple message to the specified user using a template.

Parameters:
  • template_parameters – the parameters for the template.
  • template_name – the template name you want to use.
  • identifier (Identifier) – an identifier from build_identifier or from an incoming message, a room etc.
  • in_reply_to – the original message the bot is answering from
  • groupchat_nick_reply (bool) – authorized the prefixing with the nick form the user
set_message_size_limit(limit: int = 10000, hard_limit: int = 10000) → None[source]

Set backends message size limit and its maximum supported message size. The MESSAGE_SIZE_LIMIT can be overridden by setting it in the configuration file. A historical value of 10000 is used by default.

shutdown() → None[source]
signal_connect_to_all_plugins() → None[source]
split_and_send_message(msg: errbot.backends.base.Message) → None[source]
startup_time = datetime.datetime(2022, 6, 11, 13, 33, 12, 591128)
unknown_command(_, cmd: str, args: Optional[str]) → str[source]

Override the default unknown command behavior

warn_admins(warning: str) → None[source]

Send a warning to the administrators of the bot.

Parameters:warning (str) – The markdown-formatted text of the message to send.