Deprecate old constructor

This commit is contained in:
Grig Alex 2020-10-24 00:04:33 +03:00
parent 5ea6fc9f09
commit cdef29f1ba
No known key found for this signature in database
GPG Key ID: 7176EDB56B1B35CB
1 changed files with 5 additions and 0 deletions

View File

@ -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) {