Added deprecated constructor with the old style

This commit is contained in:
j.r@wiuwiu.de 2019-10-13 15:12:22 +02:00
parent 91508aeebb
commit e526b9db14

View File

@ -22,6 +22,7 @@ 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
@ -32,6 +33,19 @@ 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
@ -138,7 +152,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* @return Bot username
*/
@Override
public abstract String getBotUsername();
public String getBotUsername(){
return this.botUsername;
};
/**
* Process all updates, that are not commands.