symphony.bdk.core.activity.registry.ActivityRegistry#

class symphony.bdk.core.activity.registry.ActivityRegistry(session_service: symphony.bdk.core.service.session.session_service.SessionService)#

Bases: symphony.bdk.core.service.datafeed.real_time_event_listener.RealTimeEventListener

This class allows to bind an py:class::AbstractActivity to the Real Time Events source, or Datafeed. It also maintains the list of registered activities.

__init__(session_service: symphony.bdk.core.service.session.session_service.SessionService)#

Methods

__init__(session_service)

fetch_bot_info()

Fetches the bot display name if not already done.

is_accepting_event(event, bot_info)

Checks if the event is accepted to be handled.

on_connection_accepted(initiator, event)

param initiator

Event initiator.

on_connection_requested(initiator, event)

param initiator

Event initiator.

on_instant_message_created(initiator, event)

Called when a ROOMCREATED event is received.

on_message_sent(**kwargs)

Called when a MESSAGESENT event is received.

on_message_suppressed(initiator, event)

param initiator

Event initiator.

on_room_created(initiator, event)

param initiator

Event initiator.

on_room_deactivated(initiator, event)

param initiator

Event initiator.

on_room_demoted_from_owner(initiator, event)

param initiator

Event initiator.

on_room_member_promoted_to_owner(initiator, ...)

param initiator

Event initiator.

on_room_reactivated(initiator, event)

param initiator

Event initiator.

on_room_updated(initiator, event)

param initiator

Event initiator.

on_shared_post(initiator, event)

Called when an INSTANTMESSAGECREATED event is received.

on_symphony_elements_action(**kwargs)

param initiator

Event initiator.

on_user_joined_room(**kwargs)

param initiator

Event initiator.

on_user_left_room(initiator, event)

param initiator

Event initiator.

on_user_requested_to_join_room(initiator, event)

param initiator

Event initiator.

register(activity)

Registers an activity.

slash(command[, mention_bot, description])

Decorator around a listener callback coroutine which takes a CommandContext as single parameter and returns nothing.

Attributes

activity_list

async fetch_bot_info()#

Fetches the bot display name if not already done.

Returns

None

async static is_accepting_event(event: symphony.bdk.gen.agent_model.v4_event.V4Event, bot_info: symphony.bdk.gen.pod_model.user_v2.UserV2) bool#

Checks if the event is accepted to be handled.

By default, all the events that is created by the bot itself will not be accepted to be handled by the listener. If you want to handle the self-created events or you want to apply your own filters for the events, you should override this method.

Parameters
  • event – Event to be verified.

  • bot_info – the UserV2 object containing the bot service account information

Returns

True if the event is accepted, False otherwise

async on_connection_accepted(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_connection_accepted.V4ConnectionAccepted)#
Parameters
  • initiator – Event initiator.

  • event – Connection Accepted payload.

async on_connection_requested(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_connection_requested.V4ConnectionRequested)#
Parameters
  • initiator – Event initiator.

  • event – Connection Requested payload.

async on_instant_message_created(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_instant_message_created.V4InstantMessageCreated)#

Called when a ROOMCREATED event is received.

Parameters
  • initiator – Event initiator.

  • event – Instant Message Created payload.

async on_message_sent(**kwargs)#

Called when a MESSAGESENT event is received.

Parameters
  • initiator – Event initiator.

  • event – Message sent payload.

async on_message_suppressed(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_message_suppressed.V4MessageSuppressed)#
Parameters
  • initiator – Event initiator.

  • event – Message Suppressed payload.

async on_room_created(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_created.V4RoomCreated)#
Parameters
  • initiator – Event initiator.

  • event – Room Created payload.

async on_room_deactivated(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_deactivated.V4RoomDeactivated)#
Parameters
  • initiator – Event initiator.

  • event – Room Deactivated payload.

async on_room_demoted_from_owner(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_member_demoted_from_owner.V4RoomMemberDemotedFromOwner)#
Parameters
  • initiator – Event initiator.

  • event – Room Member Demoted From Owner payload.

async on_room_member_promoted_to_owner(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_member_promoted_to_owner.V4RoomMemberPromotedToOwner)#
Parameters
  • initiator – Event initiator.

  • event – Room Member Promoted To Owner payload.

async on_room_reactivated(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_reactivated.V4RoomReactivated)#
Parameters
  • initiator – Event initiator.

  • event – Room Reactivated payload.

async on_room_updated(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_room_updated.V4RoomUpdated)#
Parameters
  • initiator – Event initiator.

  • event – Room Updated payload.

async on_shared_post(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_shared_post.V4SharedPost)#

Called when an INSTANTMESSAGECREATED event is received.

Parameters
  • initiator – Event initiator.

  • event – Shared post payload.

async on_symphony_elements_action(**kwargs)#
Parameters
  • initiator – Event initiator.

  • event – Symphony Elements Action payload.

async on_user_joined_room(**kwargs)#
Parameters
  • initiator – Event initiator.

  • event – User Joined Room payload.

async on_user_left_room(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_user_left_room.V4UserLeftRoom)#
Parameters
  • initiator – Event initiator.

  • event – User Left Room payload.

async on_user_requested_to_join_room(initiator: symphony.bdk.gen.agent_model.v4_initiator.V4Initiator, event: symphony.bdk.gen.agent_model.v4_user_requested_to_join_room.V4UserRequestedToJoinRoom)#
Parameters
  • initiator – Event initiator.

  • event – User Requested To Join Room payload.

register(activity: symphony.bdk.core.activity.api.AbstractActivity)#

Registers an activity.

Parameters

activity – any object inheriting from base AbstractActivity

slash(command: str, mention_bot: bool = True, description: str = '')#

Decorator around a listener callback coroutine which takes a CommandContext as single parameter and returns nothing. This registers a new SlashCommandActivity which executes the decorated coroutine if a message is matching.

Parameters
  • command – the command name e.g. “/hello”

  • mention_bot – if user should mention the bot to trigger the slash command

  • description – command description

Returns

None