symphony.bdk.core.activity.command.CommandActivity#
- class symphony.bdk.core.activity.command.CommandActivity#
Bases:
symphony.bdk.core.activity.api.AbstractActivity
[symphony.bdk.core.activity.command.CommandContext
]A command activity corresponds to any message sent in a chat where the bot is part of.
- __init__()#
Methods
__init__
()before_matcher
(context)This callback can be used to prepare
ActivityContext
before actually processing the matches method.matches
(context)Matches the
ActivityContext
to decide whether anAbstractActivity
can be executed or not.on_activity
(context)Contains the activity business logic.
Attributes
bot_user_id
- 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 anAbstractActivity
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