From 2cb51d6af99f9593f8271a222753c87d402e6511 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Sun, 17 Sep 2017 00:10:38 +0200 Subject: [PATCH] Revert "Use a regular expression to split parameters for BotCommands" --- .../telegrambots/bots/commandbot/commands/BotCommand.java | 4 ++-- .../bots/commandbot/commands/CommandRegistry.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/BotCommand.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/BotCommand.java index 00f490db..02da6ebd 100644 --- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/BotCommand.java +++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/BotCommand.java @@ -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; @@ -75,4 +75,4 @@ public abstract class BotCommand { * @param arguments passed arguments */ public abstract void execute(AbsSender absSender, User user, Chat chat, String[] arguments); -} +} \ No newline at end of file diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/CommandRegistry.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/CommandRegistry.java index 99858e3f..17da10d3 100644 --- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/CommandRegistry.java +++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/bots/commandbot/commands/CommandRegistry.java @@ -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]); @@ -126,4 +126,4 @@ public final class CommandRegistry implements ICommandRegistry { } return command; } -} +} \ No newline at end of file