Merge branch 'dev' into typo-fix
This commit is contained in:
commit
9a6682688e
@ -9,9 +9,11 @@ package org.telegram.telegrambots.meta.api.methods;
|
||||
public enum ActionType {
|
||||
TYPING("typing"),
|
||||
RECORDVIDEO("record_video"),
|
||||
RECORDVIDEONOTE("record_video_note"),
|
||||
RECORDAUDIO("record_audio"),
|
||||
UPLOADPHOTO("upload_photo"),
|
||||
UPLOADVIDEO("upload_video"),
|
||||
UPLOADVIDEONOTE("upload_video_note"),
|
||||
UPLOADAUDIO("upload_audio"),
|
||||
UPLOADDOCUMENT("upload_document"),
|
||||
FINDLOCATION("find_location");
|
||||
@ -36,12 +38,16 @@ public enum ActionType {
|
||||
return TYPING;
|
||||
case "record_video":
|
||||
return RECORDVIDEO;
|
||||
case "record_video_note":
|
||||
return RECORDVIDEONOTE;
|
||||
case "record_audio":
|
||||
return RECORDAUDIO;
|
||||
case "upload_photo":
|
||||
return UPLOADPHOTO;
|
||||
case "upload_video":
|
||||
return UPLOADVIDEO;
|
||||
case "upload_video_note":
|
||||
return UPLOADVIDEONOTE;
|
||||
case "upload_audio":
|
||||
return UPLOADAUDIO;
|
||||
case "upload_document":
|
||||
|
@ -136,8 +136,8 @@ public class AnswerInlineQuery extends BotApiMethod<Boolean> {
|
||||
if (switchPmParameter.length() > 64) {
|
||||
throw new TelegramApiValidationException("SwitchPmParameter can't be longer than 64 chars", this);
|
||||
}
|
||||
if (!Pattern.matches("[A-Za-z0-9_]+", switchPmParameter.trim() )) {
|
||||
throw new TelegramApiValidationException("SwitchPmParameter only allows A-Z, a-z, 0-9 and _ characters", this);
|
||||
if (!Pattern.matches("[A-Za-z0-9_\\-]+", switchPmParameter.trim() )) {
|
||||
throw new TelegramApiValidationException("SwitchPmParameter only allows A-Z, a-z, 0-9, _ and - characters", this);
|
||||
}
|
||||
}
|
||||
for (InlineQueryResult result : results) {
|
||||
|
@ -17,14 +17,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
|
||||
*/
|
||||
public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
||||
private static final String PATH = "getStickerSet";
|
||||
private static final String PATH = "setStickerPositionInSet";
|
||||
|
||||
private static final String STICKER_FIELD = "sticker";
|
||||
private static final String POSITION_FIELD = "position";
|
||||
|
||||
@JsonProperty(STICKER_FIELD)
|
||||
private String sticker; ///< File identifier of the sticker
|
||||
@JsonProperty(STICKER_FIELD)
|
||||
@JsonProperty(POSITION_FIELD)
|
||||
private Integer position; ///< New sticker position in the set, zero-based
|
||||
|
||||
public SetStickerPositionInSet(String sticker, Integer position) {
|
||||
@ -61,7 +61,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
||||
if (sticker == null || sticker.isEmpty()) {
|
||||
throw new TelegramApiValidationException("sticker can't be null", this);
|
||||
}
|
||||
if (position == null || position > 0) {
|
||||
if (position == null || position < 0) {
|
||||
throw new TelegramApiValidationException("position can't be null", this);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
||||
}
|
||||
|
||||
public SetStickerPositionInSet setSticker(String sticker) {
|
||||
this.sticker = sticker;
|
||||
this.sticker = checkNotNull(sticker);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
||||
}
|
||||
|
||||
public SetStickerPositionInSet setPosition(Integer position) {
|
||||
this.position = position;
|
||||
this.position = checkNotNull(position);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.stickers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@ -10,6 +11,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
* @version 3.2
|
||||
* This object describes the position on faces where a mask should be placed by default.
|
||||
*/
|
||||
@JsonTypeInfo(use=JsonTypeInfo.Id.NONE)
|
||||
public class MaskPosition implements InputBotApiObject, Validable {
|
||||
private static final String POINT_FIELD = "point";
|
||||
private static final String XSHIFT_FIELD = "x_shift";
|
||||
|
@ -36,7 +36,7 @@ public class Sticker implements BotApiObject {
|
||||
@JsonProperty(SETNAME_FIELD)
|
||||
private String setName; ///< Optional. Name of the sticker set to which the sticker belongs
|
||||
@JsonProperty(MASKPOSITON_FIELD)
|
||||
private String maskPosition; ///< Optional. For mask stickers, the position where the mask should be placed
|
||||
private MaskPosition maskPosition; ///< Optional. For mask stickers, the position where the mask should be placed
|
||||
|
||||
public Sticker() {
|
||||
super();
|
||||
@ -70,7 +70,7 @@ public class Sticker implements BotApiObject {
|
||||
return setName;
|
||||
}
|
||||
|
||||
public String getMaskPosition() {
|
||||
public MaskPosition getMaskPosition() {
|
||||
return maskPosition;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class Sticker implements BotApiObject {
|
||||
", fileSize=" + fileSize +
|
||||
", emoji='" + emoji + '\'' +
|
||||
", setName='" + setName + '\'' +
|
||||
", maskPosition='" + maskPosition + '\'' +
|
||||
", maskPosition=" + maskPosition +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class TestAnswerInlineQuery {
|
||||
try {
|
||||
answerInlineQuery.validate();
|
||||
} 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