Fixed Bot API methods

## AnswerCallbackQuery
`setCacheTime(...)`  now returns `AnswerCallbackQuery`

## EditMessageLiveLocation
`setLongitud(...)`  corrected requireNonNull check
`setLatitude(...)`  corrected requireNonNull check

## Suggestion
Removed `Objects.requireNonNull(chatId)` check from methods which can have `inline_message_id` instead of `chat_id`
This commit is contained in:
gekoramy 2018-02-15 15:19:34 +01:00
parent 6db6c4bf0d
commit 2bc7ebc055
7 changed files with 4 additions and 8 deletions

View File

@ -97,8 +97,9 @@ public class AnswerCallbackQuery extends BotApiMethod<Boolean> {
return cacheTime;
}
public void setCacheTime(Integer cacheTime) {
public AnswerCallbackQuery setCacheTime(Integer cacheTime) {
this.cacheTime = cacheTime;
return this;
}
@Override

View File

@ -60,7 +60,6 @@ public class StopMessageLiveLocation extends BotApiMethod<Serializable> {
}
public StopMessageLiveLocation setChatId(Long chatId) {
Objects.requireNonNull(chatId);
this.chatId = chatId.toString();
return this;
}

View File

@ -86,7 +86,6 @@ public class GetGameHighScores extends BotApiMethod<ArrayList<GameHighScore>> {
}
public GetGameHighScores setChatId(Long chatId) {
Objects.requireNonNull(chatId);
this.chatId = chatId.toString();
return this;
}

View File

@ -104,7 +104,6 @@ public class SetGameScore extends BotApiMethod<Serializable> {
}
public SetGameScore setChatId(Long chatId) {
Objects.requireNonNull(chatId);
this.chatId = chatId.toString();
return this;
}

View File

@ -104,7 +104,7 @@ public class EditMessageLiveLocation extends BotApiMethod<Serializable> {
}
public EditMessageLiveLocation setLatitude(Float latitude) {
Objects.requireNonNull(chatId);
Objects.requireNonNull(latitude);
this.latitude = latitude;
return this;
}
@ -114,7 +114,7 @@ public class EditMessageLiveLocation extends BotApiMethod<Serializable> {
}
public EditMessageLiveLocation setLongitud(Float longitud) {
Objects.requireNonNull(chatId);
Objects.requireNonNull(longitud);
this.longitud = longitud;
return this;
}

View File

@ -63,7 +63,6 @@ public class EditMessageReplyMarkup extends BotApiMethod<Serializable> {
}
public EditMessageReplyMarkup setChatId(Long chatId) {
Objects.requireNonNull(chatId);
this.chatId = chatId.toString();
return this;
}

View File

@ -79,7 +79,6 @@ public class EditMessageText extends BotApiMethod<Serializable> {
}
public EditMessageText setChatId(Long chatId) {
Objects.requireNonNull(chatId);
this.chatId = chatId.toString();
return this;
}