in src/dispatch/plugins/dispatch_slack/incident/interactive.py [0:0]
def configure(config):
"""Maps commands/events to their functions."""
incident_command_context_middleware = partial(
command_context_middleware,
expected_subject=SubjectNames.INCIDENT,
)
middleware = [
subject_middleware,
configuration_middleware,
]
# don't need an incident context
app.command(config.slack_command_report_incident, middleware=middleware)(
handle_report_incident_command
)
app.command(config.slack_command_list_incidents, middleware=middleware)(
handle_list_incidents_command
)
# non-sensitive-commands
middleware = [
subject_middleware,
configuration_middleware,
incident_command_context_middleware,
]
app.command(config.slack_command_list_tasks, middleware=middleware)(handle_list_tasks_command)
app.command(config.slack_command_list_my_tasks, middleware=middleware)(
handle_list_tasks_command
)
app.command(config.slack_command_list_participants, middleware=middleware)(
handle_list_participants_command
)
app.command(config.slack_command_update_participant, middleware=middleware)(
handle_update_participant_command
)
app.command(
config.slack_command_engage_oncall,
middleware=[message_context_middleware, subject_middleware, configuration_middleware],
)(handle_engage_oncall_command)
# sensitive commands
middleware = [
subject_middleware,
configuration_middleware,
incident_command_context_middleware,
user_middleware,
restricted_command_middleware,
]
app.command(config.slack_command_assign_role, middleware=middleware)(handle_assign_role_command)
app.command(config.slack_command_update_incident, middleware=middleware)(
handle_update_incident_command
)
app.command(config.slack_command_update_notifications_group, middleware=middleware)(
handle_update_notifications_group_command
)
app.command(config.slack_command_report_tactical, middleware=middleware)(
handle_report_tactical_command
)
app.command(config.slack_command_report_executive, middleware=middleware)(
handle_report_executive_command
)
app.command(config.slack_command_add_timeline_event, middleware=middleware)(
handle_add_timeline_event_command
)
app.command(config.slack_command_create_task, middleware=middleware)(handle_create_task_command)
app.event(
event="reaction_added",
matchers=[is_target_reaction(config.timeline_event_reaction)],
middleware=[reaction_context_middleware],
)(handle_timeline_added_event)
app.event(
event="reaction_added",
middleware=[reaction_context_middleware],
)(handle_not_configured_reaction_event)