slack.commands - Commands

class slack.commands.Command(raw_command: MutableMapping[KT, VT], verification_token: Optional[str] = None, team_id: Optional[str] = None)[source]

MutableMapping representing a slack slash command.

Parameters:raw_command – Decoded body of the webhook HTTP request
Raises:slack.exceptions.FailedVerification – when verification_token or team_id does not match the incoming command’s
class slack.commands.Router[source]

When creating slash command for your applications each one can have a custom webhook url. For ease of configuration this class provide a routing mechanisms based on the command so that each command can define the same webhook url.

dispatch(command: slack.commands.Command) → Iterator[Any][source]

Yields handlers matching the incoming slack.actions.Command.

Parameters:commandslack.actions.Command
Yields:handler
register(command: str, handler: Any)[source]

Register a new handler for a specific slash command

Parameters:
  • command – Slash command
  • handler – Callback