From cdef29f1ba915de2d609e8e069c5acbe62b8b5d4 Mon Sep 17 00:00:00 2001 From: Grig Alex Date: Sat, 24 Oct 2020 00:04:33 +0300 Subject: [PATCH] Deprecate old constructor --- .../extensions/bots/commandbot/commands/CommandRegistry.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java index b7e9d2a2..33fdfe17 100644 --- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java +++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/CommandRegistry.java @@ -29,7 +29,10 @@ public final class CommandRegistry implements ICommandRegistry { * * @param allowCommandsWithUsername True to allow commands with username, false otherwise * @param botUsername Bot username + * @throws java.lang.NullPointerException if {@code botUsername} is {@code null} + * @deprecated Use {@link #CommandRegistry(boolean, java.util.function.Supplier)} instead */ + @Deprecated public CommandRegistry(boolean allowCommandsWithUsername, String botUsername) { Objects.requireNonNull(botUsername, "Bot username must not be null"); this.allowCommandsWithUsername = allowCommandsWithUsername; @@ -134,6 +137,8 @@ public final class CommandRegistry implements ICommandRegistry { * the command * @param command Command to simplify * @return Simplified command + * @throws java.lang.NullPointerException if {@code allowCommandsWithUsername} is {@code true} + * and {@code botUsernameSupplier} returns {@code null} */ private String removeUsernameFromCommandIfNeeded(String command) { if (allowCommandsWithUsername) {