Merge pull request #307 from rubenlagus/revert-305-dschulz-patch-1

Revert "Use a regular expression to split parameters for BotCommands"
This commit is contained in:
Ruben Bermudez 2017-09-17 00:10:50 +02:00 committed by GitHub
commit d5c8a32361
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import org.telegram.telegrambots.bots.AbsSender;
*/
public abstract class BotCommand {
public final static String COMMAND_INIT_CHARACTER = "/";
public static final String COMMAND_PARAMETER_SEPARATOR_REGEXP = "\\s+";
public static final String COMMAND_PARAMETER_SEPARATOR = " ";
private final static int COMMAND_MAX_LENGTH = 32;
private final String commandIdentifier;

View File

@ -97,7 +97,7 @@ public final class CommandRegistry implements ICommandRegistry {
String text = message.getText();
if (text.startsWith(BotCommand.COMMAND_INIT_CHARACTER)) {
String commandMessage = text.substring(1);
String[] commandSplit = commandMessage.split(BotCommand.COMMAND_PARAMETER_SEPARATOR_REGEXP);
String[] commandSplit = commandMessage.split(BotCommand.COMMAND_PARAMETER_SEPARATOR);
String command = removeUsernameFromCommandIfNeeded(commandSplit[0]);