Fixed bot username

Let the programmer of the bot decide where the username should come from
This commit is contained in:
j.r@wiuwiu.de 2019-06-27 20:58:16 +02:00
parent e616ebbddb
commit 01a7e7dc21

View File

@ -58,7 +58,7 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername, String botUsername) { public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername, String botUsername) {
super(options); super(options);
this.botUsername = botUsername; this.botUsername = botUsername;
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, botUsername); this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this.getBotUsername());
} }
@Override @Override
@ -143,9 +143,7 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
* @return Bot username * @return Bot username
*/ */
@Override @Override
public final String getBotUsername() { public abstract String getBotUsername();
return botUsername;
}
/** /**
* Process all updates, that are not commands. * Process all updates, that are not commands.