Merge pull request #538 from aNNiMON/stickerpositioninset-fix
Fix setStickerPositionInSet
This commit is contained in:
commit
d420625e7b
@ -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.
|
* 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> {
|
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 STICKER_FIELD = "sticker";
|
||||||
private static final String POSITION_FIELD = "position";
|
private static final String POSITION_FIELD = "position";
|
||||||
|
|
||||||
@JsonProperty(STICKER_FIELD)
|
@JsonProperty(STICKER_FIELD)
|
||||||
private String sticker; ///< File identifier of the sticker
|
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
|
private Integer position; ///< New sticker position in the set, zero-based
|
||||||
|
|
||||||
public SetStickerPositionInSet(String sticker, Integer position) {
|
public SetStickerPositionInSet(String sticker, Integer position) {
|
||||||
@ -61,7 +61,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
|||||||
if (sticker == null || sticker.isEmpty()) {
|
if (sticker == null || sticker.isEmpty()) {
|
||||||
throw new TelegramApiValidationException("sticker can't be null", this);
|
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);
|
throw new TelegramApiValidationException("position can't be null", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SetStickerPositionInSet setSticker(String sticker) {
|
public SetStickerPositionInSet setSticker(String sticker) {
|
||||||
this.sticker = sticker;
|
this.sticker = checkNotNull(sticker);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SetStickerPositionInSet setPosition(Integer position) {
|
public SetStickerPositionInSet setPosition(Integer position) {
|
||||||
this.position = position;
|
this.position = checkNotNull(position);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user