Class SlashCommandPattern

java.lang.Object
com.symphony.bdk.core.activity.parsing.SlashCommandPattern

@API(status=INTERNAL) public class SlashCommandPattern extends Object
Class representing the pattern of a SlashCommand. The string should be a list of tokens separated by whitespaces. Each token can be:
  • a regular static word like "/command". This will only match the same string
  • a string argument like "{argument}". This will match a single word (with no whitespaces)
  • a mention argument like "{@mention}. This will match a mention
  • a cashtag argument like "{$cashtag}" which will match a cashtag
  • a hashtag argument like "{#cashtag}" which will match a hashtag
  • Constructor Details

    • SlashCommandPattern

      public SlashCommandPattern(String pattern)
      Parameters:
      pattern - the slash command pattern
  • Method Details

    • getTokens

      public List<CommandToken> getTokens()
      Returns:
      the list of command tokens
    • prependToken

      public void prependToken(CommandToken token)
      Adds a specific token at the beginning of the slash command pattern
      Parameters:
      token - the command token to add
    • getArgumentDefinitions

      public Map<String,? extends Class<?>> getArgumentDefinitions()
      Returns:
      the map of key-value pairs (argument name, argument type)
    • getMatchResult

      public MatchResult getMatchResult(V4Message message)
      Parameters:
      message - the input message to be matched against the SlashCommandPattern
      Returns:
      the MatchResult object containing the status (matches or not) and the potential arguments.