Merge pull request #114 from dartwata/dev

get registered command by commandIdentifier
This commit is contained in:
Ruben Bermudez 2016-07-21 20:59:15 +02:00 committed by GitHub
commit 333dd0939b
3 changed files with 16 additions and 0 deletions

View File

@ -88,6 +88,11 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
commandRegistry.registerDefaultAction(defaultConsumer);
}
@Override
public final BotCommand getRegisteredCommand(String commandIdentifier) {
return commandRegistry.getRegisteredCommand(commandIdentifier);
}
/**
* Process all updates, that are not commands.
* @warning Commands that have valid syntax but are not registered on this bot,

View File

@ -65,6 +65,11 @@ public final class CommandRegistry implements ICommandRegistry {
return commandRegistryMap.values();
}
@Override
public final BotCommand getRegisteredCommand(String commandIdentifier) {
return commandRegistryMap.get(commandIdentifier);
}
/**
* Executes a command action if the command is registered.
*

View File

@ -62,4 +62,10 @@ public interface ICommandRegistry {
*/
Collection<BotCommand> getRegisteredCommands();
/**
* get registered command
*
* @return registered command if exists or null if not
*/
BotCommand getRegisteredCommand(String commandIdentifier);
}