symphony.bdk.core.activity.command.SlashCommandActivity#

class symphony.bdk.core.activity.command.SlashCommandActivity(name, requires_mention_bot, callback, description='')#

Bases: symphony.bdk.core.activity.command.CommandActivity

A slash command is a particular CommandActivity with three parameters:
  • the command name

  • if we should mention the bot

  • the callback function

The Slash command is triggered if we receive a MESSAGESENT event with message text:
  • “@{bot_display name} {name}” if requires_mention_bot is True

  • “{name}” otherwise

__init__(name, requires_mention_bot, callback, description='')#
Parameters
  • name – the command name

  • requires_mention_bot – if the command requires the bot mention to trigger the slash command

  • callback – the coroutine to be executed if message text matches

Methods

__init__(name, requires_mention_bot, callback)

param name

the command name

before_matcher(context)

This callback can be used to prepare ActivityContext before actually processing the matches method.

build_command_description()

matches(context)

Matches the ActivityContext to decide whether an AbstractActivity can be executed or not.

on_activity(context)

Contains the activity business logic.

Attributes

bot_user_id

name

before_matcher(context: symphony.bdk.core.activity.api.C)#

This callback can be used to prepare ActivityContext before actually processing the matches method.

Parameters

context – an instance of ActivityContext

matches(context: symphony.bdk.core.activity.command.CommandContext) bool#

Matches the ActivityContext to decide whether an AbstractActivity can be executed or not.

Parameters

context – an instance of ActivityContext

Returns

True if activity has to be triggered, False otherwise.

async on_activity(context: symphony.bdk.core.activity.command.CommandContext)#

Contains the activity business logic. Executed only if the matches method returned a true value.

Parameters

context – an instance of ActivityContext