public final class CommandRegistry extends Object implements ICommandRegistry
| Constructor and Description |
|---|
CommandRegistry(boolean allowCommandsWithUsername,
String botUsername)
Creates a Command registry
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
deregister(BotCommand botCommand)
deregister a command
|
Map<BotCommand,Boolean> |
deregisterAll(BotCommand... botCommands)
deregister multiple commands
|
boolean |
executeCommand(AbsSender absSender,
Message message)
Executes a command action if the command is registered.
|
BotCommand |
getRegisteredCommand(String commandIdentifier)
get registered command
|
Collection<BotCommand> |
getRegisteredCommands()
get a collection of all registered commands
|
boolean |
register(BotCommand botCommand)
register a command
|
Map<BotCommand,Boolean> |
registerAll(BotCommand... botCommands)
register multiple commands
|
void |
registerDefaultAction(BiConsumer<AbsSender,Message> defaultConsumer)
Register a default action when there is no command register that match the message sent
|
public CommandRegistry(boolean allowCommandsWithUsername,
String botUsername)
allowCommandsWithUsername - True to allow commands with username, false otherwisebotUsername - Bot usernamepublic void registerDefaultAction(BiConsumer<AbsSender,Message> defaultConsumer)
ICommandRegistryregisterDefaultAction in interface ICommandRegistrydefaultConsumer - Consumer to evaluate the messagepublic final boolean register(BotCommand botCommand)
ICommandRegistryregister in interface ICommandRegistrybotCommand - the command to registerpublic final Map<BotCommand,Boolean> registerAll(BotCommand... botCommands)
ICommandRegistryregisterAll in interface ICommandRegistrybotCommands - commands to registerpublic final boolean deregister(BotCommand botCommand)
ICommandRegistryderegister in interface ICommandRegistrybotCommand - the command to deregisterpublic final Map<BotCommand,Boolean> deregisterAll(BotCommand... botCommands)
ICommandRegistryderegisterAll in interface ICommandRegistrybotCommands - commands to deregisterpublic final Collection<BotCommand> getRegisteredCommands()
ICommandRegistrygetRegisteredCommands in interface ICommandRegistrypublic final BotCommand getRegisteredCommand(String commandIdentifier)
ICommandRegistrygetRegisteredCommand in interface ICommandRegistryCopyright © 2017. All rights reserved.