get registered command by commandIdentifier
This commit is contained in:
parent
d39f874ceb
commit
a24c147a17
@ -71,6 +71,11 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
|||||||
commandRegistry.registerDefaultAction(defaultConsumer);
|
commandRegistry.registerDefaultAction(defaultConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final BotCommand getRegisteredCommand(String commandIdentifier) {
|
||||||
|
return commandRegistry.getRegisteredCommand(commandIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process all updates, that are not commands.
|
* Process all updates, that are not commands.
|
||||||
* @warning Commands that have valid syntax but are not registered on this bot,
|
* @warning Commands that have valid syntax but are not registered on this bot,
|
||||||
|
@ -65,6 +65,11 @@ public final class CommandRegistry implements ICommandRegistry {
|
|||||||
return commandRegistryMap.values();
|
return commandRegistryMap.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final BotCommand getRegisteredCommand(String commandIdentifier) {
|
||||||
|
return commandRegistryMap.get(commandIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command action if the command is registered.
|
* Executes a command action if the command is registered.
|
||||||
*
|
*
|
||||||
|
@ -62,4 +62,10 @@ public interface ICommandRegistry {
|
|||||||
*/
|
*/
|
||||||
Collection<BotCommand> getRegisteredCommands();
|
Collection<BotCommand> getRegisteredCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get registered command
|
||||||
|
*
|
||||||
|
* @return registered command if exists or null if not
|
||||||
|
*/
|
||||||
|
BotCommand getRegisteredCommand(String commandIdentifier);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user