Merge pull request #539 from aNNiMON/switchpmparameter-fix
Allow hyphen character in switchPmParameter
This commit is contained in:
commit
c71c2a3c29
@ -136,8 +136,8 @@ public class AnswerInlineQuery extends BotApiMethod<Boolean> {
|
|||||||
if (switchPmParameter.length() > 64) {
|
if (switchPmParameter.length() > 64) {
|
||||||
throw new TelegramApiValidationException("SwitchPmParameter can't be longer than 64 chars", this);
|
throw new TelegramApiValidationException("SwitchPmParameter can't be longer than 64 chars", this);
|
||||||
}
|
}
|
||||||
if (!Pattern.matches("[A-Za-z0-9_]+", switchPmParameter.trim() )) {
|
if (!Pattern.matches("[A-Za-z0-9_\\-]+", switchPmParameter.trim() )) {
|
||||||
throw new TelegramApiValidationException("SwitchPmParameter only allows A-Z, a-z, 0-9 and _ characters", this);
|
throw new TelegramApiValidationException("SwitchPmParameter only allows A-Z, a-z, 0-9, _ and - characters", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (InlineQueryResult result : results) {
|
for (InlineQueryResult result : results) {
|
||||||
|
@ -113,7 +113,7 @@ public class TestAnswerInlineQuery {
|
|||||||
try {
|
try {
|
||||||
answerInlineQuery.validate();
|
answerInlineQuery.validate();
|
||||||
} catch (TelegramApiValidationException e) {
|
} catch (TelegramApiValidationException e) {
|
||||||
Assert.assertEquals("SwitchPmParameter only allows A-Z, a-z, 0-9 and _ characters", e.getMessage());
|
Assert.assertEquals("SwitchPmParameter only allows A-Z, a-z, 0-9, _ and - characters", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user