diff --git a/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingCommandBot.java b/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingCommandBot.java index 4cb0c0a6..8ff78678 100644 --- a/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingCommandBot.java +++ b/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingCommandBot.java @@ -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, diff --git a/src/main/java/org/telegram/telegrambots/bots/commands/CommandRegistry.java b/src/main/java/org/telegram/telegrambots/bots/commands/CommandRegistry.java index 1cbafd7f..bdc75e6d 100644 --- a/src/main/java/org/telegram/telegrambots/bots/commands/CommandRegistry.java +++ b/src/main/java/org/telegram/telegrambots/bots/commands/CommandRegistry.java @@ -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. * diff --git a/src/main/java/org/telegram/telegrambots/bots/commands/ICommandRegistry.java b/src/main/java/org/telegram/telegrambots/bots/commands/ICommandRegistry.java index d6cd992c..56ae4c6c 100644 --- a/src/main/java/org/telegram/telegrambots/bots/commands/ICommandRegistry.java +++ b/src/main/java/org/telegram/telegrambots/bots/commands/ICommandRegistry.java @@ -62,4 +62,10 @@ public interface ICommandRegistry { */ Collection getRegisteredCommands(); + /** + * get registered command + * + * @return registered command if exists or null if not + */ + BotCommand getRegisteredCommand(String commandIdentifier); } \ No newline at end of file