From cc0e0c977198a16b9768d33b6354cfdfc1dbb7df Mon Sep 17 00:00:00 2001 From: Lukas Prediger Date: Thu, 5 Mar 2020 17:01:06 +0100 Subject: [PATCH] Revert: Added deprecated constructor with the old style (e526b9db) This commit causes a bug if using the normal constructors without overriding getBotUsername and since it's no longer abstract it doesn't force you to implement the method, even though it is needed in any case aside from the deprecated one --- .../TelegramLongPollingCommandBot.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java index 1796b364..05de2c72 100644 --- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java +++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java @@ -22,7 +22,6 @@ import java.util.function.BiConsumer; */ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingBot implements ICommandRegistry { private final CommandRegistry commandRegistry; - private String botUsername; /** * Creates a TelegramLongPollingCommandBot using default options @@ -33,19 +32,6 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB this(ApiContext.getInstance(DefaultBotOptions.class)); } - /** - * Creates a TelegramLongPollingCommandBot using default options - * Use ICommandRegistry's methods on this bot to register commands - * - * @param botUsername Username of the bot - * @deprecated Overwrite {@link #getBotUsername() getBotUsername} instead - */ - @Deprecated - public TelegramLongPollingCommandBot(String botUsername){ - this(); - this.botUsername = botUsername; - } - /** * Creates a TelegramLongPollingCommandBot with custom options and allowing commands with * usernames @@ -152,9 +138,7 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB * @return Bot username */ @Override - public String getBotUsername(){ - return this.botUsername; - }; + public abstract String getBotUsername(); /** * Process all updates, that are not commands.