Added deprecated constructor with the old style
This commit is contained in:
parent
91508aeebb
commit
e526b9db14
@ -22,6 +22,7 @@ import java.util.function.BiConsumer;
|
|||||||
*/
|
*/
|
||||||
public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingBot implements ICommandRegistry {
|
public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingBot implements ICommandRegistry {
|
||||||
private final CommandRegistry commandRegistry;
|
private final CommandRegistry commandRegistry;
|
||||||
|
private String botUsername;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a TelegramLongPollingCommandBot using default options
|
* Creates a TelegramLongPollingCommandBot using default options
|
||||||
@ -32,6 +33,19 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
|||||||
this(ApiContext.getInstance(DefaultBotOptions.class));
|
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
|
* Creates a TelegramLongPollingCommandBot with custom options and allowing commands with
|
||||||
* usernames
|
* usernames
|
||||||
@ -138,7 +152,9 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
|
|||||||
* @return Bot username
|
* @return Bot username
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public abstract String getBotUsername();
|
public String getBotUsername(){
|
||||||
|
return this.botUsername;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process all updates, that are not commands.
|
* Process all updates, that are not commands.
|
||||||
|
Loading…
Reference in New Issue
Block a user