@API(status=EXPERIMENTAL) public class SlashCommand extends PatternCommandActivity<CommandContext>
Modifier and Type | Method and Description |
---|---|
protected CommandContext |
createContextInstance(V4Initiator initiator,
V4MessageSent event) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
protected ActivityInfo |
info()
Build activity info.
|
void |
onActivity(CommandContext context)
Contain the activity business logic.
|
java.util.regex.Pattern |
pattern() |
static SlashCommand |
slash(java.lang.String slashCommandName,
boolean requiresBotMention,
java.util.function.Consumer<CommandContext> callback)
Returns a new
SlashCommand instance. |
static SlashCommand |
slash(java.lang.String slashCommandName,
boolean requiresBotMention,
java.util.function.Consumer<CommandContext> callback,
java.lang.String description)
Returns a new
SlashCommand instance. |
static SlashCommand |
slash(java.lang.String slashCommandName,
java.util.function.Consumer<CommandContext> callback)
Returns a new
SlashCommand instance. |
static SlashCommand |
slash(java.lang.String slashCommandName,
java.util.function.Consumer<CommandContext> callback,
java.lang.String description)
Returns a new
SlashCommand instance. |
beforeMatcher, matcher, prepareContext
bindToRealTimeEventsSource
getInfo, processEvent
public static SlashCommand slash(@Nonnull java.lang.String slashCommandName, @Nonnull java.util.function.Consumer<CommandContext> callback)
SlashCommand
instance.slashCommandName
- Identifier of the command (ex: '/gif' or 'gif').callback
- Callback to be processed when command is detected.public static SlashCommand slash(@Nonnull java.lang.String slashCommandName, boolean requiresBotMention, @Nonnull java.util.function.Consumer<CommandContext> callback)
SlashCommand
instance.slashCommandName
- Identifier of the command (ex: '/gif' or 'gif').requiresBotMention
- Indicates whether the bot has to be mentioned in order to trigger the command.callback
- Callback to be processed when command is detected.java.lang.IllegalArgumentException
- if command name if empty.public static SlashCommand slash(@Nonnull java.lang.String slashCommandName, @Nonnull java.util.function.Consumer<CommandContext> callback, java.lang.String description)
SlashCommand
instance.slashCommandName
- Identifier of the command (ex: '/gif' or 'gif').callback
- Callback to be processed when command is detected.description
- The summary of the command.SlashCommand
instance.public static SlashCommand slash(@Nonnull java.lang.String slashCommandName, boolean requiresBotMention, @Nonnull java.util.function.Consumer<CommandContext> callback, java.lang.String description)
SlashCommand
instance.slashCommandName
- Identifier of the command (ex: '/gif' or 'gif').requiresBotMention
- Indicates whether the bot has to be mentioned in order to trigger the command.callback
- Callback to be processed when command is detected.description
- The summary of the command.SlashCommand
instance.public java.util.regex.Pattern pattern()
pattern
in class PatternCommandActivity<CommandContext>
public void onActivity(CommandContext context)
AbstractActivity
ActivityMatcher.matches(ActivityContext)
returned
a true value.onActivity
in class AbstractActivity<V4MessageSent,CommandContext>
context
- The activity context object.protected ActivityInfo info()
AbstractActivity
info
in class AbstractActivity<V4MessageSent,CommandContext>
protected CommandContext createContextInstance(V4Initiator initiator, V4MessageSent event)
createContextInstance
in class AbstractActivity<V4MessageSent,CommandContext>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object