Personalities
Personalities describe behavior for a subset of signal_bot_framework.aliases.Context.
- class signal_bot_framework.personality.Personality(contexts=())
Bases:
PersonalityProto,ABCSpecific behavior for a subset of
signal_bot_framework.aliases.Context.- matches_context(context)
Whether or not a given Context is valid for this Personality.
- abstract handle_callback_exception(exception, cb)
Handle an exception that occured in a callback.
- stop_crons()
Stop any sleeping Cron callbacks.
- Return type:
None
- async personality_handle_message(signal, context, message)
Handle a single Signal message that has been approved for this Personality.
Determines if the message is handled by any of the existing hooks, and if so stops processing.
- Parameters:
- Return type:
bool- Returns:
Trueif the message was handled by a hook - otherwise the message will be sent to the next Personality in line.
- on_message(cb)
Register a callback to be called on any DataMessage.
- remove_message_callback(callback)
- on_prefix(prefix, cb)
Register a callback to be called on any DataMessage matching a given prefix (exact match).
- remove_prefix(prefix)
- on_keyword(keyword, cb, case_sensitive=False, whole_word=True)
Register a callback to be called when DataMessage contains a keyword.
- remove_keyword(key)
- on_mention(mention, cb)
Register a callback to be called when a given
AccountNumber/AccountUUIDis @-mentioned.- Parameters:
mention¶ (Union[
AccountNumber,AccountUUID]) – The Signal account to trigger on mentions of.
- remove_mention(mention)
- on_cron(schedule, cb)
Register a callback to be called on a Cron schedule.
- remove_cron(item)