errbot.core module¶
- class errbot.core.ErrBot(bot_config)[source]¶
Bases:
Backend
,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". '¶
- property all_commands: dict¶
Return both commands and re_commands together.
- callback_mention(msg: Message, people: List[Identifier]) None [source]¶
- callback_message(msg: Message) None [source]¶
Processes for commands and dispatches the message to all the plugins.
- 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: Room, identifier: Identifier | None = None, invited_by: Identifier | None = None) None [source]¶
Triggered when a user has joined a MUC.
- Parameters:
room (
Room
) – An instance ofMUCRoom
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: Room, identifier: Identifier | None = None, kicked_by: Identifier | None = None) None [source]¶
Triggered when a user has left a MUC.
- Parameters:
room (
Room
) – An instance ofMUCRoom
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: Room) None [source]¶
Triggered when the topic in a MUC changes.
- Parameters:
room (
Room
) – An instance ofMUCRoom
representing the room for which the topic changed.
- property message_size_limit: int¶
- prefix_groupchat_reply(message: Message, identifier: Identifier) None [source]¶
Patches message with the conventional prefix to ping the specific contact For example: @gbin, you forgot the milk !
- process_message(msg: 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.
- send(identifier: Identifier, text: str, in_reply_to: Message | None = 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 messagein_reply_to – the original message the bot is answering from
text (
str
) – the markdown text you want to sendgroupchat_nick_reply (
bool
) – authorized the prefixing with the nick form the user
- send_card(card: 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: 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: 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: Identifier, template_name, template_parameters, in_reply_to: Message | None = 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.
- startup_time = datetime.datetime(2024, 1, 1, 22, 12, 22, 260313)¶