diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index 2d36d23f..c3cc727d 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -258,6 +258,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
index e8297590..9a2eded7 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
@@ -1,12 +1,18 @@
package org.telegram.abilitybots.api.bot;
-import com.google.common.collect.*;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.telegram.abilitybots.api.db.DBContext;
-import org.telegram.abilitybots.api.objects.*;
+import org.telegram.abilitybots.api.objects.Ability;
+import org.telegram.abilitybots.api.objects.Locality;
+import org.telegram.abilitybots.api.objects.MessageContext;
+import org.telegram.abilitybots.api.objects.Privacy;
+import org.telegram.abilitybots.api.objects.Reply;
+import org.telegram.abilitybots.api.objects.ReplyCollection;
+import org.telegram.abilitybots.api.objects.Stats;
import org.telegram.abilitybots.api.sender.DefaultSender;
import org.telegram.abilitybots.api.sender.MessageSender;
import org.telegram.abilitybots.api.sender.SilentSender;
@@ -26,7 +32,12 @@ import org.telegram.telegrambots.meta.api.objects.chatmember.ChatMemberOwner;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -44,12 +55,25 @@ import static java.util.Optional.ofNullable;
import static java.util.regex.Pattern.CASE_INSENSITIVE;
import static java.util.regex.Pattern.compile;
import static java.util.stream.Collectors.toSet;
-import static org.telegram.abilitybots.api.objects.Locality.*;
+import static org.telegram.abilitybots.api.objects.Locality.ALL;
+import static org.telegram.abilitybots.api.objects.Locality.GROUP;
+import static org.telegram.abilitybots.api.objects.Locality.USER;
import static org.telegram.abilitybots.api.objects.MessageContext.newContext;
-import static org.telegram.abilitybots.api.objects.Privacy.*;
+import static org.telegram.abilitybots.api.objects.Privacy.ADMIN;
+import static org.telegram.abilitybots.api.objects.Privacy.CREATOR;
+import static org.telegram.abilitybots.api.objects.Privacy.GROUP_ADMIN;
+import static org.telegram.abilitybots.api.objects.Privacy.PUBLIC;
import static org.telegram.abilitybots.api.objects.Stats.createStats;
-import static org.telegram.abilitybots.api.util.AbilityMessageCodes.*;
-import static org.telegram.abilitybots.api.util.AbilityUtils.*;
+import static org.telegram.abilitybots.api.util.AbilityMessageCodes.CHECK_INPUT_FAIL;
+import static org.telegram.abilitybots.api.util.AbilityMessageCodes.CHECK_LOCALITY_FAIL;
+import static org.telegram.abilitybots.api.util.AbilityMessageCodes.CHECK_PRIVACY_FAIL;
+import static org.telegram.abilitybots.api.util.AbilityUtils.EMPTY_USER;
+import static org.telegram.abilitybots.api.util.AbilityUtils.getChatId;
+import static org.telegram.abilitybots.api.util.AbilityUtils.getLocalizedMessage;
+import static org.telegram.abilitybots.api.util.AbilityUtils.getUser;
+import static org.telegram.abilitybots.api.util.AbilityUtils.isGroupUpdate;
+import static org.telegram.abilitybots.api.util.AbilityUtils.isSuperGroupUpdate;
+import static org.telegram.abilitybots.api.util.AbilityUtils.isUserMessage;
/**
* The father of all ability bots. Bots that need to utilize abilities need to extend this bot.
@@ -260,7 +284,7 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability
}
public boolean isGroupAdmin(long chatId, long id) {
- GetChatAdministrators admins = GetChatAdministrators.builder().chatId(Long.toString(chatId)).build();
+ GetChatAdministrators admins = GetChatAdministrators.builder().chatId(chatId).build();
return silent.execute(admins)
.orElse(new ArrayList<>())
.stream()
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/DefaultAbilities.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/DefaultAbilities.java
index 33a211e8..2a05e3fb 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/DefaultAbilities.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/DefaultAbilities.java
@@ -224,7 +224,7 @@ public final class DefaultAbilities implements AbilityExtension {
printStream.print(bot.db.backup());
bot.sender.sendDocument(SendDocument.builder()
.document(new InputFile(backup))
- .chatId(ctx.chatId().toString())
+ .chatId(ctx.chatId())
.build()
);
} catch (FileNotFoundException e) {
diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
index 62eef398..48a51ed4 100644
--- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
+++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/SilentSender.java
@@ -38,7 +38,7 @@ public class SilentSender {
public Optional forceReply(String message, long id) {
SendMessage msg = new SendMessage();
msg.setText(message);
- msg.setChatId(Long.toString(id));
+ msg.setChatId(id);
ForceReplyKeyboard kb = new ForceReplyKeyboard();
kb.setForceReply(true);
kb.setSelective(true);
@@ -67,7 +67,7 @@ public class SilentSender {
private Optional doSendMessage(String txt, long groupId, boolean format) {
SendMessage smsg = new SendMessage();
- smsg.setChatId(Long.toString(groupId));
+ smsg.setChatId(groupId);
smsg.setText(txt);
smsg.enableMarkdown(format);
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index bd581e12..50c3214a 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -249,6 +249,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index cc5af0ae..7dc5641a 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -233,6 +233,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
diff --git a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
index 39f7c291..cddf610a 100644
--- a/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
+++ b/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/helpCommand/HelpCommand.java
@@ -1,11 +1,11 @@
package org.telegram.telegrambots.extensions.bots.commandbot.commands.helpCommand;
+import org.telegram.telegrambots.extensions.bots.commandbot.commands.IBotCommand;
+import org.telegram.telegrambots.extensions.bots.commandbot.commands.ICommandRegistry;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Chat;
import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.bots.AbsSender;
-import org.telegram.telegrambots.extensions.bots.commandbot.commands.IBotCommand;
-import org.telegram.telegrambots.extensions.bots.commandbot.commands.ICommandRegistry;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import java.util.Collection;
@@ -98,14 +98,14 @@ public class HelpCommand extends ManCommand {
IBotCommand command = registry.getRegisteredCommand(arguments[0]);
String reply = getManText(command);
try {
- absSender.execute(SendMessage.builder().chatId(chat.getId().toString()).text(reply).parseMode("HTML").build());
+ absSender.execute(SendMessage.builder().chatId(chat.getId()).text(reply).parseMode("HTML").build());
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else {
String reply = getHelpText(registry);
try {
- absSender.execute(SendMessage.builder().chatId(chat.getId().toString()).text(reply).parseMode("HTML").build());
+ absSender.execute(SendMessage.builder().chatId(chat.getId()).text(reply).parseMode("HTML").build());
} catch (TelegramApiException e) {
e.printStackTrace();
}
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index 53fc93d6..07a514d9 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -256,6 +256,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java
index 84dad6d6..a61e9978 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java
@@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.MessageEntity;
import org.telegram.telegrambots.meta.api.objects.MessageId;
@@ -89,6 +90,16 @@ public class CopyMessage extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
+ @Tolerate
+ public void setFromChatId(@NonNull Long fromChatId) {
+ this.fromChatId = fromChatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = null;
}
@@ -143,15 +154,9 @@ public class CopyMessage extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (fromChatId == null) {
- throw new TelegramApiValidationException("FromChatId parameter can't be empty", this);
- }
- if (messageId == null) {
- throw new TelegramApiValidationException("MessageId parameter can't be empty", this);
- }
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
@@ -160,4 +165,19 @@ public class CopyMessage extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class CopyMessageBuilder {
+
+ @Tolerate
+ public CopyMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+
+ @Tolerate
+ public CopyMessageBuilder fromChatId(@NonNull Long fromChatId) {
+ this.fromChatId = fromChatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java
index 78b17932..190e90fc 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -63,17 +64,24 @@ public class ForwardMessage extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
+ @Tolerate
+ public void setFromChatId(@NonNull Long fromChatId) {
+ this.fromChatId = fromChatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (fromChatId == null || fromChatId.isEmpty()) {
+ if (fromChatId.isEmpty()) {
throw new TelegramApiValidationException("FromChatId can't be empty", this);
}
- if (messageId == null) {
- throw new TelegramApiValidationException("MessageId can't be empty", this);
- }
}
@Override
@@ -95,4 +103,19 @@ public class ForwardMessage extends BotApiMethod {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
+
+ public static class ForwardMessageBuilder {
+
+ @Tolerate
+ public ForwardMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+
+ @Tolerate
+ public ForwardMessageBuilder fromChatId(@NonNull Long fromChatId) {
+ this.fromChatId = fromChatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/StopMessageLiveLocation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/StopMessageLiveLocation.java
index 0144b135..35f315ae 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/StopMessageLiveLocation.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/StopMessageLiveLocation.java
@@ -9,6 +9,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@@ -59,6 +60,11 @@ public class StopMessageLiveLocation extends BotApiMethod {
@JsonProperty(REPLYMARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. A JSON-serialized object for an inline keyboard.
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -111,4 +117,13 @@ public class StopMessageLiveLocation extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class StopMessageLiveLocationBuilder {
+
+ @Tolerate
+ public StopMessageLiveLocationBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/GetGameHighScores.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/GetGameHighScores.java
index 0d8e32d1..8028a8a2 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/GetGameHighScores.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/GetGameHighScores.java
@@ -18,7 +18,6 @@ package org.telegram.telegrambots.meta.api.methods.games;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
@@ -28,9 +27,10 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
-import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
+import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -76,6 +76,11 @@ public class GetGameHighScores extends BotApiMethod> {
@NonNull
private Long userId; ///> {
@Override
public void validate() throws TelegramApiValidationException {
- if (userId == null) {
- throw new TelegramApiValidationException("UserId parameter can't be empty", this);
- }
if (inlineMessageId == null) {
if (chatId == null || chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty if inlineMessageId is not present", this);
@@ -117,4 +119,13 @@ public class GetGameHighScores extends BotApiMethod> {
}
}
}
+
+ public static class GetGameHighScoresBuilder {
+
+ @Tolerate
+ public GetGameHighScoresBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/SetGameScore.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/SetGameScore.java
index d1733b4b..aa387641 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/SetGameScore.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/games/SetGameScore.java
@@ -19,7 +19,6 @@ package org.telegram.telegrambots.meta.api.methods.games;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
@@ -29,9 +28,10 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
-import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
+import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -84,6 +84,11 @@ public class SetGameScore extends BotApiMethod {
@JsonProperty(FORCE_FIELD)
private Boolean force; ///< Optional. Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -117,12 +122,6 @@ public class SetGameScore extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (userId == null) {
- throw new TelegramApiValidationException("UserId parameter can't be empty", this);
- }
- if (score == null) {
- throw new TelegramApiValidationException("Score parameter can't be empty", this);
- }
if (inlineMessageId == null) {
if (chatId == null || chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty if inlineMessageId is not present", this);
@@ -139,4 +138,13 @@ public class SetGameScore extends BotApiMethod {
}
}
}
+
+ public static class SetGameScoreBuilder {
+
+ @Tolerate
+ public SetGameScoreBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java
index 9972477c..6d48a90c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java
@@ -2,7 +2,15 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -37,6 +45,11 @@ public class ApproveChatJoinRequest extends BotApiMethod {
@NonNull
private Long userId; ///< Required. Unique identifier of the target user
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -66,4 +79,13 @@ public class ApproveChatJoinRequest extends BotApiMethod {
throw new TelegramApiValidationException("UserId can't be null or 0", this);
}
}
+
+ public static class ApproveChatJoinRequestBuilder {
+
+ @Tolerate
+ public ApproveChatJoinRequestBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMember.java
index 489d4ec2..8fbb964c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMember.java
@@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -69,6 +70,10 @@ public class BanChatMember extends BotApiMethod {
@JsonProperty(REVOKEMESSAGES_FIELD)
private Boolean revokeMessages;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
@JsonIgnore
public void setUntilDateInstant(Instant instant) {
@@ -107,11 +112,21 @@ public class BanChatMember extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (userId == null || userId == 0) {
+ if (userId == 0) {
throw new TelegramApiValidationException("UserId can't be null or 0", this);
}
}
+
+ public static class BanChatMemberBuilder {
+
+ @Tolerate
+ public BanChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatSenderChat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatSenderChat.java
index 14086714..c3236956 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatSenderChat.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatSenderChat.java
@@ -3,7 +3,16 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -51,6 +60,11 @@ public class BanChatSenderChat extends BotApiMethod {
@JsonProperty(UNTILDATE_FIELD)
private Integer untilDate;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@JsonIgnore
public void setUntilDateInstant(Instant instant) {
setUntilDate((int) instant.getEpochSecond());
@@ -95,4 +109,13 @@ public class BanChatSenderChat extends BotApiMethod {
throw new TelegramApiValidationException("SenderChatId can't be null or 0", this);
}
}
+
+ public static class BanChatSenderChatBuilder {
+
+ @Tolerate
+ public BanChatSenderChatBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/CreateChatInviteLink.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/CreateChatInviteLink.java
index 124e600a..c3b3e9a0 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/CreateChatInviteLink.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/CreateChatInviteLink.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
@@ -69,6 +70,10 @@ public class CreateChatInviteLink extends BotApiMethod {
@JsonProperty(CREATESJOINREQUEST_FIELD)
private Boolean createsJoinRequest;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
@Override
public String getMethod() {
@@ -105,4 +110,13 @@ public class CreateChatInviteLink extends BotApiMethod {
throw new TelegramApiValidationException("MemberLimit must be between 1 and 99999", this);
}
}
+
+ public static class CreateChatInviteLinkBuilder {
+
+ @Tolerate
+ public CreateChatInviteLinkBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java
index 97c47cbb..179df642 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java
@@ -2,7 +2,15 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -37,6 +45,11 @@ public class DeclineChatJoinRequest extends BotApiMethod {
@NonNull
private Long userId; ///< Required. Unique identifier of the target user
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -66,4 +79,13 @@ public class DeclineChatJoinRequest extends BotApiMethod {
throw new TelegramApiValidationException("UserId can't be null or 0", this);
}
}
+
+ public static class DeclineChatJoinRequestBuilder {
+
+ @Tolerate
+ public DeclineChatJoinRequestBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatPhoto.java
index c897b3ba..fcaef96b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatPhoto.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatPhoto.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -42,6 +43,11 @@ public class DeleteChatPhoto extends BotApiMethod {
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -64,8 +70,17 @@ public class DeleteChatPhoto extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be null", this);
}
}
+
+ public static class DeleteChatPhotoBuilder {
+
+ @Tolerate
+ public DeleteChatPhotoBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatStickerSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatStickerSet.java
index bcda48fd..90d25f70 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatStickerSet.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteChatStickerSet.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -41,6 +42,11 @@ public class DeleteChatStickerSet extends BotApiMethod {
@NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -63,8 +69,17 @@ public class DeleteChatStickerSet extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
}
+
+ public static class DeleteChatStickerSetBuilder {
+
+ @Tolerate
+ public DeleteChatStickerSetBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/EditChatInviteLink.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/EditChatInviteLink.java
index 014101df..bdb43cf3 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/EditChatInviteLink.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/EditChatInviteLink.java
@@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
@@ -74,6 +75,10 @@ public class EditChatInviteLink extends BotApiMethod {
@JsonProperty(CREATESJOINREQUEST_FIELD)
private Boolean createsJoinRequest;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
@Override
public String getMethod() {
@@ -113,4 +118,13 @@ public class EditChatInviteLink extends BotApiMethod {
throw new TelegramApiValidationException("MemberLimit must be between 1 and 99999", this);
}
}
+
+ public static class EditChatInviteLinkBuilder {
+
+ @Tolerate
+ public EditChatInviteLinkBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ExportChatInviteLink.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ExportChatInviteLink.java
index 231d1e61..d25d563a 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ExportChatInviteLink.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ExportChatInviteLink.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -47,6 +48,11 @@ public class ExportChatInviteLink extends BotApiMethod {
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -69,8 +75,17 @@ public class ExportChatInviteLink extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
}
+
+ public static class ExportChatInviteLinkBuilder {
+
+ @Tolerate
+ public ExportChatInviteLinkBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChat.java
index 7c746df2..b5c650bc 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChat.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChat.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Chat;
@@ -44,6 +45,11 @@ public class GetChat extends BotApiMethod {
return PATH;
}
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public Chat deserializeResponse(String answer) throws TelegramApiRequestException {
try {
@@ -61,8 +67,17 @@ public class GetChat extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
}
+
+ public static class GetChatBuilder {
+
+ @Tolerate
+ public GetChatBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatAdministrators.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatAdministrators.java
index 28ffacbf..ba8ec459 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatAdministrators.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatAdministrators.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.chatmember.ChatMember;
@@ -44,6 +45,11 @@ public class GetChatAdministrators extends BotApiMethod> {
@NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -66,8 +72,17 @@ public class GetChatAdministrators extends BotApiMethod> {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
}
+
+ public static class GetChatAdministratorsBuilder {
+
+ @Tolerate
+ public GetChatAdministratorsBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMember.java
index d8aefd2e..4d84c57c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMember.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.chatmember.ChatMember;
@@ -44,6 +45,11 @@ public class GetChatMember extends BotApiMethod {
@NonNull
private Long userId; ///< Unique identifier of the target user
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -66,11 +72,17 @@ public class GetChatMember extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (userId == null) {
- throw new TelegramApiValidationException("UserId can't be null", this);
+ }
+
+ public static class GetChatMemberBuilder {
+
+ @Tolerate
+ public GetChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java
index 09fc223c..353da833 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -38,6 +39,11 @@ public class GetChatMemberCount extends BotApiMethod {
@NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -60,8 +66,17 @@ public class GetChatMemberCount extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
}
+
+ public static class GetChatMemberCountBuilder {
+
+ @Tolerate
+ public GetChatMemberCountBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/LeaveChat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/LeaveChat.java
index b3ac05a8..882d3f40 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/LeaveChat.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/LeaveChat.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -38,6 +39,11 @@ public class LeaveChat extends BotApiMethod {
@NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -60,8 +66,17 @@ public class LeaveChat extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be null", this);
}
}
+
+ public static class LeaveChatBuilder {
+
+ @Tolerate
+ public LeaveChatBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMember.java
index 76b11cb2..98e327e4 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMember.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -92,6 +93,11 @@ public class PromoteChatMember extends BotApiMethod {
@JsonProperty(CANMANAGEVIDEOCHATS_FIELD)
private Boolean canManageVideoChats;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -122,4 +128,14 @@ public class PromoteChatMember extends BotApiMethod {
throw new TelegramApiValidationException("UserId can't be empty", this);
}
}
+
+ public static class PromoteChatMemberBuilder {
+
+ @Tolerate
+ public PromoteChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RestrictChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RestrictChatMember.java
index 0ea56543..e6e132cd 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RestrictChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RestrictChatMember.java
@@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ChatPermissions;
@@ -70,6 +71,11 @@ public class RestrictChatMember extends BotApiMethod {
@JsonProperty(UNTILDATE_FIELD)
private Integer untilDate; ///< Optional. Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be banned forever
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@JsonIgnore
public void setUntilDateInstant(Instant instant) {
setUntilDate((int) instant.getEpochSecond());
@@ -107,14 +113,17 @@ public class RestrictChatMember extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (userId == null) {
- throw new TelegramApiValidationException("UserId can't be empty", this);
- }
- if (permissions == null) {
- throw new TelegramApiValidationException("Permissions can't be empty", this);
+ }
+
+ public static class RestrictChatMemberBuilder {
+
+ @Tolerate
+ public RestrictChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RevokeChatInviteLink.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RevokeChatInviteLink.java
index a70a2175..bab37435 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RevokeChatInviteLink.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RevokeChatInviteLink.java
@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
@@ -51,6 +52,11 @@ public class RevokeChatInviteLink extends BotApiMethod {
@NonNull
private String inviteLink; ///< The invite link to revoke
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -80,4 +86,13 @@ public class RevokeChatInviteLink extends BotApiMethod {
throw new TelegramApiValidationException("InviteLink can't be empty", this);
}
}
+
+ public static class RevokeChatInviteLinkBuilder {
+
+ @Tolerate
+ public RevokeChatInviteLinkBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatAdministratorCustomTitle.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatAdministratorCustomTitle.java
index b9e313e2..fedd9080 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatAdministratorCustomTitle.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatAdministratorCustomTitle.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -47,6 +48,11 @@ public class SetChatAdministratorCustomTitle extends BotApiMethod {
@NonNull
private String customTitle; ///< New custom title for the administrator; 0-16 characters, emoji are not allowed
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -69,14 +75,20 @@ public class SetChatAdministratorCustomTitle extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (userId == null || userId == 0) {
+ if (userId == 0) {
throw new TelegramApiValidationException("UserId can't be empty", this);
}
- if (customTitle == null) {
- throw new TelegramApiValidationException("CustomTitle can't be null", this);
+ }
+
+ public static class SetChatAdministratorCustomTitleBuilder {
+
+ @Tolerate
+ public SetChatAdministratorCustomTitleBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatDescription.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatDescription.java
index 57c5ec35..9376a66c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatDescription.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatDescription.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -45,6 +46,11 @@ public class SetChatDescription extends BotApiMethod {
@JsonProperty(DESCRIPTION_FIELD)
private String description; ///< Optional. New chat description, 0-255 characters
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -67,11 +73,20 @@ public class SetChatDescription extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (description == null) {
throw new TelegramApiValidationException("Description can't be null", this);
}
}
+
+ public static class SetChatDescriptionBuilder {
+
+ @Tolerate
+ public SetChatDescriptionBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPermissions.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPermissions.java
index f92a7791..bde56e81 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPermissions.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPermissions.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.ChatPermissions;
@@ -45,6 +46,11 @@ public class SetChatPermissions extends BotApiMethod {
@NonNull
private ChatPermissions permissions; ///< New default chat permissions
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -67,11 +73,17 @@ public class SetChatPermissions extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (permissions == null) {
- throw new TelegramApiValidationException("Permissions can't be null", this);
+ }
+
+ public static class SetChatPermissionsBuilder {
+
+ @Tolerate
+ public SetChatPermissionsBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java
index f8497edd..34acf893 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java
@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -44,6 +45,11 @@ public class SetChatPhoto extends PartialBotApiMethod {
@NonNull
private InputFile photo; ///< New chat photo as InputStream, uploaded using multipart/form-data
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
@@ -61,11 +67,20 @@ public class SetChatPhoto extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (photo == null || !photo.isNew()) {
+ if (!photo.isNew()) {
throw new TelegramApiValidationException("Photo parameter is required and must be a new file to upload", this);
}
}
+
+ public static class SetChatPhotoBuilder {
+
+ @Tolerate
+ public SetChatPhotoBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatStickerSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatStickerSet.java
index 6aefd939..62563cab 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatStickerSet.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatStickerSet.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -45,6 +46,11 @@ public class SetChatStickerSet extends BotApiMethod {
@NonNull
private String stickerSetName; ///< Name of the sticker set to be set as the group sticker set
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -67,11 +73,20 @@ public class SetChatStickerSet extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (stickerSetName == null || stickerSetName.isEmpty()) {
+ if (stickerSetName.isEmpty()) {
throw new TelegramApiValidationException("StickerSetName can't be empty", this);
}
}
+
+ public static class SetChatStickerSetBuilder {
+
+ @Tolerate
+ public SetChatStickerSetBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatTitle.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatTitle.java
index 5138a561..105314b7 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatTitle.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatTitle.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -46,6 +47,11 @@ public class SetChatTitle extends BotApiMethod {
@NonNull
private String title; ///< Required. New chat title, 1-255 characters
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -68,11 +74,20 @@ public class SetChatTitle extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (title == null || title.isEmpty()) {
+ if (title.isEmpty()) {
throw new TelegramApiValidationException("Title can't be empty", this);
}
}
+
+ public static class SetChatTitleBuilder {
+
+ @Tolerate
+ public SetChatTitleBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatMember.java
index 5b05e43b..96a950d1 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatMember.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -54,6 +55,10 @@ public class UnbanChatMember extends BotApiMethod {
@JsonProperty(ONLYISBANNED_FIELD)
private Boolean onlyIfBanned; ///< Optional. Do nothing if the user is not banned
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
@Override
public String getMethod() {
@@ -77,11 +82,17 @@ public class UnbanChatMember extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
- if (userId == null) {
- throw new TelegramApiValidationException("UserId can't be null", this);
+ }
+
+ public static class UnbanChatMemberBuilder {
+
+ @Tolerate
+ public UnbanChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/unbanChatSenderChat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatSenderChat.java
similarity index 78%
rename from telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/unbanChatSenderChat.java
rename to telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatSenderChat.java
index b33e86bf..4d3bb4e1 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/unbanChatSenderChat.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/UnbanChatSenderChat.java
@@ -2,7 +2,15 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -25,7 +33,7 @@ import java.io.IOException;
@NoArgsConstructor
@AllArgsConstructor
@Builder
-public class unbanChatSenderChat extends BotApiMethod {
+public class UnbanChatSenderChat extends BotApiMethod {
public static final String PATH = "unbanChatSenderChat";
private static final String CHATID_FIELD = "chat_id";
@@ -38,6 +46,11 @@ public class unbanChatSenderChat extends BotApiMethod {
@NonNull
private Long senderChatId; ///< Required. Unique identifier of the target sender chat
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -67,4 +80,13 @@ public class unbanChatSenderChat extends BotApiMethod {
throw new TelegramApiValidationException("SenderChatId can't be null or 0", this);
}
}
+
+ public static class UnbanChatSenderChatBuilder {
+
+ @Tolerate
+ public UnbanChatSenderChatBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButton.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButton.java
index 494609c1..6c7bd220 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButton.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButton.java
@@ -2,7 +2,15 @@ package org.telegram.telegrambots.meta.api.methods.menubutton;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButton;
@@ -39,6 +47,11 @@ public class GetChatMenuButton extends BotApiMethod {
@JsonProperty(CHATID_FIELD)
private String chatId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
@@ -63,4 +76,13 @@ public class GetChatMenuButton extends BotApiMethod {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
+
+ public static class GetChatMenuButtonBuilder {
+
+ @Tolerate
+ public GetChatMenuButtonBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButton.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButton.java
index bcf9a6a2..a3281a26 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButton.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButton.java
@@ -2,12 +2,18 @@ package org.telegram.telegrambots.meta.api.methods.menubutton;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
-import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButton;
-import org.telegram.telegrambots.meta.api.objects.webapp.SentWebAppMessage;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -49,6 +55,11 @@ public class SetChatMenuButton extends BotApiMethod {
@JsonProperty(MENUBUTTON_FIELD)
private MenuButton menuButton;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
if (menuButton != null) {
@@ -75,4 +86,13 @@ public class SetChatMenuButton extends BotApiMethod {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
+
+ public static class SetChatMenuButtonBuilder {
+
+ @Tolerate
+ public SetChatMenuButtonBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/PinChatMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/PinChatMessage.java
index dd5c5ae0..2743447b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/PinChatMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/PinChatMessage.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -55,6 +56,11 @@ public class PinChatMessage extends BotApiMethod {
@JsonProperty(DISABLENOTIFICATION_FIELD)
private Boolean disableNotification;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -77,11 +83,17 @@ public class PinChatMessage extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (messageId == null) {
- throw new TelegramApiValidationException("MessageId parameter can't be null", this);
+ }
+
+ public static class PinChatMessageBuilder {
+
+ @Tolerate
+ public PinChatMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinAllChatMessages.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinAllChatMessages.java
index e63ee5a7..5e8d964a 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinAllChatMessages.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinAllChatMessages.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -43,6 +44,11 @@ public class UnpinAllChatMessages extends BotApiMethod {
@NonNull
private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -65,8 +71,17 @@ public class UnpinAllChatMessages extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
}
+
+ public static class UnpinAllChatMessagesBuilder {
+
+ @Tolerate
+ public UnpinAllChatMessagesBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinChatMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinChatMessage.java
index c5a44bce..81b157d6 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinChatMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/pinnedmessages/UnpinChatMessage.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -54,6 +55,11 @@ public class UnpinChatMessage extends BotApiMethod {
@JsonProperty(MESSAGEID_FIELD)
private Integer messageId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -76,8 +82,17 @@ public class UnpinChatMessage extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
}
+
+ public static class UnpinChatMessageBuilder {
+
+ @Tolerate
+ public UnpinChatMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
index 080c8257..f59c8c06 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -109,6 +110,11 @@ public class SendPoll extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = null;
}
@@ -140,13 +146,13 @@ public class SendPoll extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (question == null || question.isEmpty()) {
+ if (question.isEmpty()) {
throw new TelegramApiValidationException("Question parameter can't be empty", this);
}
- if (options == null || options.size() < 2 || options.size() > 10) {
+ if (options.size() < 2 || options.size() > 10) {
throw new TelegramApiValidationException("Options parameter must be between 2 and 10 item", this);
}
if (openPeriod != null && closeDate != null) {
@@ -168,4 +174,14 @@ public class SendPoll extends BotApiMethod {
replyMarkup.validate();
}
}
+
+
+ public static class SendPollBuilder {
+
+ @Tolerate
+ public SendPollBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/StopPoll.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/StopPoll.java
index bb93ccf2..247b7134 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/StopPoll.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/StopPoll.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.polls.Poll;
@@ -45,6 +46,11 @@ public class StopPoll extends BotApiMethod {
@NonNull
private Integer messageId; ///< Identifier of the original message with the poll
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -67,11 +73,21 @@ public class StopPoll extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (messageId == null || messageId == 0) {
+ if (messageId == 0) {
throw new TelegramApiValidationException("Message Id parameter can't be empty", this);
}
}
+
+
+ public static class StopPollBuilder {
+
+ @Tolerate
+ public StopPollBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java
index d30fb62c..2738d578 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -89,6 +89,11 @@ public class SendAnimation extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -114,14 +119,10 @@ public class SendAnimation extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (animation == null) {
- throw new TelegramApiValidationException("Animation parameter can't be empty", this);
- }
-
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -135,4 +136,13 @@ public class SendAnimation extends PartialBotApiMethod {
thumb.validate();
}
}
+
+ public static class SendAnimationBuilder {
+
+ @Tolerate
+ public SendAnimationBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java
index eed92725..505156ae 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -85,6 +85,11 @@ public class SendAudio extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -110,14 +115,10 @@ public class SendAudio extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (audio == null) {
- throw new TelegramApiValidationException("Audio parameter can't be empty", this);
- }
-
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -132,4 +133,13 @@ public class SendAudio extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendAudioBuilder {
+
+ @Tolerate
+ public SendAudioBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendChatAction.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendChatAction.java
index 1e688945..019ff19b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendChatAction.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendChatAction.java
@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.ActionType;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
@@ -59,6 +60,11 @@ public class SendChatAction extends BotApiMethod {
@NonNull
private String action;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@JsonIgnore
public ActionType getActionType() {
return ActionType.get(action);
@@ -98,4 +104,13 @@ public class SendChatAction extends BotApiMethod {
throw new TelegramApiValidationException("Action parameter can't be empty", this);
}
}
+
+ public static class SendChatActionBuilder {
+
+ @Tolerate
+ public SendChatActionBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java
index 502f51a6..e103db52 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -72,6 +73,11 @@ public class SendContact extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -102,17 +108,20 @@ public class SendContact extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (phoneNumber == null) {
- throw new TelegramApiValidationException("PhoneNumber parameter can't be empty", this);
- }
- if (firstName == null) {
- throw new TelegramApiValidationException("FirstName parameter can't be empty", this);
- }
if (replyMarkup != null) {
replyMarkup.validate();
}
}
+
+ public static class SendContactBuilder {
+
+ @Tolerate
+ public SendContactBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
index afc12f57..c0875494 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -76,6 +77,11 @@ public class SendDice extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -106,7 +112,7 @@ public class SendDice extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
if (emoji != null && !VALIDEMOJIS.contains(emoji)) {
@@ -116,4 +122,13 @@ public class SendDice extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendDiceBuilder {
+
+ @Tolerate
+ public SendDiceBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java
index 57cd3c1e..4abb1651 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -77,6 +77,11 @@ public class SendDocument extends PartialBotApiMethod {
private Boolean disableContentTypeDetection; ///< Optional Disables automatic server-side content type detection for files uploaded using multipart/form-data
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -102,14 +107,10 @@ public class SendDocument extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (document == null) {
- throw new TelegramApiValidationException("Document parameter can't be empty", this);
- }
-
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -124,4 +125,13 @@ public class SendDocument extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendDocumentBuilder {
+
+ @Tolerate
+ public SendDocumentBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java
index 6309b613..a122ae82 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java
@@ -28,6 +28,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -78,6 +79,11 @@ public class SendGame extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = null;
}
@@ -108,14 +114,23 @@ public class SendGame extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (gameShortName == null || gameShortName.isEmpty()) {
+ if (gameShortName.isEmpty()) {
throw new TelegramApiValidationException("GameShortName parameter can't be empty", this);
}
if (replyMarkup != null) {
replyMarkup.validate();
}
}
+
+ public static class SendGameBuilder {
+
+ @Tolerate
+ public SendGameBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java
index 01cc934b..7ac363c0 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -165,6 +166,11 @@ public class SendInvoice extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -205,7 +211,7 @@ public class SendInvoice extends BotApiMethod {
if (Strings.isNullOrEmpty(currency)) {
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
}
- if (prices == null || prices.isEmpty()) {
+ if (prices.isEmpty()) {
throw new TelegramApiValidationException("Prices parameter can't be empty", this);
} else {
for (LabeledPrice price : prices) {
@@ -219,4 +225,13 @@ public class SendInvoice extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendInvoiceBuilder {
+
+ @Tolerate
+ public SendInvoiceBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java
index f90ed627..0da14eda 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -91,6 +92,11 @@ public class SendLocation extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -121,15 +127,9 @@ public class SendLocation extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (latitude == null) {
- throw new TelegramApiValidationException("Latitude parameter can't be empty", this);
- }
- if (longitude == null) {
- throw new TelegramApiValidationException("Longitude parameter can't be empty", this);
- }
if (horizontalAccuracy != null && (horizontalAccuracy < 0 || horizontalAccuracy > 1500)) {
throw new TelegramApiValidationException("Horizontal Accuracy parameter must be between 0 and 1500", this);
}
@@ -146,4 +146,13 @@ public class SendLocation extends BotApiMethod {
throw new TelegramApiValidationException("Live period parameter must be between 60 and 86400", this);
}
}
+
+ public static class SendLocationBuilder {
+
+ @Tolerate
+ public SendLocationBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java
index 118fb854..eaddb984 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -66,6 +67,11 @@ public class SendMediaGroup extends PartialBotApiMethod> {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -92,11 +98,11 @@ public class SendMediaGroup extends PartialBotApiMethod> {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (medias == null || medias.isEmpty()) {
+ if (medias.isEmpty()) {
throw new TelegramApiValidationException("Media parameter can't be empty", this);
} else if (medias.size() < 2 || medias.size() > 10) {
throw new TelegramApiValidationException("Number of media should be between 2 and 10", this);
@@ -122,4 +128,13 @@ public class SendMediaGroup extends PartialBotApiMethod> {
}
}
}
+
+ public static class SendMediaGroupBuilder {
+
+ @Tolerate
+ public SendMediaGroupBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java
index f3d02da9..1388f11c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java
@@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
@@ -76,6 +77,11 @@ public class SendMessage extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void disableWebPagePreview() {
disableWebPagePreview = true;
}
@@ -138,10 +144,10 @@ public class SendMessage extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (text == null || text.isEmpty()) {
+ if (text.isEmpty()) {
throw new TelegramApiValidationException("Text parameter can't be empty", this);
}
if (parseMode != null && (entities != null && !entities.isEmpty()) ) {
@@ -151,4 +157,13 @@ public class SendMessage extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendMessageBuilder {
+
+ @Tolerate
+ public SendMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java
index 6c04aa49..f45eeb48 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -66,6 +66,11 @@ public class SendPhoto extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -96,14 +101,10 @@ public class SendPhoto extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (photo == null) {
- throw new TelegramApiValidationException("Photo parameter can't be empty", this);
- }
-
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -113,4 +114,13 @@ public class SendPhoto extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendPhotoBuilder {
+
+ @Tolerate
+ public SendPhotoBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
index b8b2b4e6..4b26df7a 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
@@ -10,6 +10,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -55,6 +56,11 @@ public class SendSticker extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public Boolean getDisableNotification() {
return disableNotification;
}
@@ -94,4 +100,13 @@ public class SendSticker extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendStickerBuilder {
+
+ @Tolerate
+ public SendStickerBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java
index 0cce42f3..0c55d174 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -86,6 +87,11 @@ public class SendVenue extends BotApiMethod {
@JsonProperty(PROTECTCONTENT_FIELD)
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -116,23 +122,23 @@ public class SendVenue extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (longitude == null) {
- throw new TelegramApiValidationException("Longitude parameter can't be empty", this);
- }
- if (latitude == null) {
- throw new TelegramApiValidationException("Latitude parameter can't be empty", this);
- }
- if (title == null || title.isEmpty()) {
+ if (title.isEmpty()) {
throw new TelegramApiValidationException("Title parameter can't be empty", this);
}
- if (address == null) {
- throw new TelegramApiValidationException("Address parameter can't be empty", this);
- }
if (replyMarkup != null) {
replyMarkup.validate();
}
}
+
+ public static class SendVenueBuilder {
+
+ @Tolerate
+ public SendVenueBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java
index 212af2bb..71e2da65 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -84,6 +84,11 @@ public class SendVideo extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -109,14 +114,10 @@ public class SendVideo extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (video == null) {
- throw new TelegramApiValidationException("Video parameter can't be empty", this);
- }
-
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -130,4 +131,13 @@ public class SendVideo extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendVideoBuilder {
+
+ @Tolerate
+ public SendVideoBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java
index dcaa0c68..5ea46f92 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -11,6 +10,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -70,6 +70,11 @@ public class SendVideoNote extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -95,14 +100,10 @@ public class SendVideoNote extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (videoNote == null) {
- throw new TelegramApiValidationException("VideoNote parameter can't be empty", this);
- }
-
videoNote.validate();
if (thumb != null) {
@@ -112,4 +113,13 @@ public class SendVideoNote extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendVideoNoteBuilder {
+
+ @Tolerate
+ public SendVideoNoteBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java
index 907e5b27..eba8280f 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.send;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.InputFile;
@@ -69,6 +69,11 @@ public class SendVoice extends PartialBotApiMethod {
private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
public void enableNotification() {
this.disableNotification = false;
}
@@ -94,13 +99,10 @@ public class SendVoice extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (voice == null) {
- throw new TelegramApiValidationException("Voice parameter can't be empty", this);
- }
if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) {
throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this);
}
@@ -110,4 +112,13 @@ public class SendVoice extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class SendVoiceBuilder {
+
+ @Tolerate
+ public SendVoiceBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/DeleteMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/DeleteMessage.java
index 1c77e3a3..71673c5b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/DeleteMessage.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/DeleteMessage.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
@@ -56,6 +57,11 @@ public class DeleteMessage extends BotApiMethod {
@NonNull
private Integer messageId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -79,11 +85,17 @@ public class DeleteMessage extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (messageId == null) {
- throw new TelegramApiValidationException("MessageId parameter can't be empty", this);
+ }
+
+ public static class DeleteMessageBuilder {
+
+ @Tolerate
+ public DeleteMessageBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
}
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageCaption.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageCaption.java
index 14e4c504..f83a9c1b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageCaption.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageCaption.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -72,6 +73,11 @@ public class EditMessageCaption extends BotApiMethod {
@Singular
private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -127,4 +133,13 @@ public class EditMessageCaption extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class EditMessageCaptionBuilder {
+
+ @Tolerate
+ public EditMessageCaptionBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageLiveLocation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageLiveLocation.java
index e91006c6..01dd8475 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageLiveLocation.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageLiveLocation.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -93,6 +94,11 @@ public class EditMessageLiveLocation extends BotApiMethod {
@JsonProperty(PROXIMITYALERTRADIUS_FIELD)
private Integer proximityAlertRadius;
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -141,12 +147,6 @@ public class EditMessageLiveLocation extends BotApiMethod {
throw new TelegramApiValidationException("MessageId parameter must be empty if inlineMessageId is provided", this);
}
}
- if (latitude == null) {
- throw new TelegramApiValidationException("Latitude parameter can't be empty", this);
- }
- if (longitude == null) {
- throw new TelegramApiValidationException("Longitude parameter can't be empty", this);
- }
if (horizontalAccuracy != null && (horizontalAccuracy < 0 || horizontalAccuracy > 1500)) {
throw new TelegramApiValidationException("Horizontal Accuracy parameter must be between 0 and 1500", this);
}
@@ -160,4 +160,13 @@ public class EditMessageLiveLocation extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class EditMessageLiveLocationBuilder {
+
+ @Tolerate
+ public EditMessageLiveLocationBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java
index c6ad262c..44745131 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -75,6 +76,11 @@ public class EditMessageMedia extends PartialBotApiMethod {
@JsonProperty(REPLYMARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. A JSON-serialized object for an inline keyboard.
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
try {
@@ -118,9 +124,6 @@ public class EditMessageMedia extends PartialBotApiMethod {
throw new TelegramApiValidationException("MessageId parameter must be empty if inlineMessageId is provided", this);
}
}
- if (media == null) {
- throw new TelegramApiValidationException("Media parameter can't be empty", this);
- }
media.validate();
@@ -128,4 +131,13 @@ public class EditMessageMedia extends PartialBotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class EditMessageMediaBuilder {
+
+ @Tolerate
+ public EditMessageMediaBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageReplyMarkup.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageReplyMarkup.java
index fb26f6c3..030d972a 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageReplyMarkup.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageReplyMarkup.java
@@ -9,6 +9,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
@@ -60,6 +61,11 @@ public class EditMessageReplyMarkup extends BotApiMethod {
@JsonProperty(REPLYMARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. A JSON-serialized object for an inline keyboard.
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -112,4 +118,13 @@ public class EditMessageReplyMarkup extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class EditMessageReplyMarkupBuilder {
+
+ @Tolerate
+ public EditMessageReplyMarkupBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
index f3a6ea06..237af7d5 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
@@ -110,6 +111,11 @@ public class EditMessageText extends BotApiMethod {
}
}
+ @Tolerate
+ public void setChatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -158,7 +164,7 @@ public class EditMessageText extends BotApiMethod {
throw new TelegramApiValidationException("MessageId parameter must be empty if inlineMessageId is provided", this);
}
}
- if (text == null || text.isEmpty()) {
+ if (text.isEmpty()) {
throw new TelegramApiValidationException("Text parameter can't be empty", this);
}
if (parseMode != null && (entities != null && !entities.isEmpty()) ) {
@@ -168,4 +174,13 @@ public class EditMessageText extends BotApiMethod {
replyMarkup.validate();
}
}
+
+ public static class EditMessageTextBuilder {
+
+ @Tolerate
+ public EditMessageTextBuilder chatId(Long chatId) {
+ this.chatId = chatId == null ? null : chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChat.java
index 47858083..d91e5a05 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChat.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChat.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
@@ -42,10 +43,24 @@ public class BotCommandScopeChat implements BotCommandScope {
@NonNull
private String chatId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
}
+
+ public static class BotCommandScopeChatBuilder {
+
+ @Tolerate
+ public BotCommandScopeChatBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatAdministrators.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatAdministrators.java
index 22ac35ce..f6558e20 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatAdministrators.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatAdministrators.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
@@ -42,10 +43,24 @@ public class BotCommandScopeChatAdministrators implements BotCommandScope {
@NonNull
private String chatId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
}
+
+ public static class BotCommandScopeChatAdministratorsBuilder {
+
+ @Tolerate
+ public BotCommandScopeChatAdministratorsBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatMember.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatMember.java
index 662fc6c2..769f7d96 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatMember.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeChatMember.java
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
+import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
@@ -49,13 +50,27 @@ public class BotCommandScopeChatMember implements BotCommandScope {
@NonNull
private Long userId;
+ @Tolerate
+ public void setChatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (userId == null || userId == 0L) {
+ if (userId == 0L) {
throw new TelegramApiValidationException("UserId parameter can't be empty", this);
}
}
+
+ public static class BotCommandScopeChatMemberBuilder {
+
+ @Tolerate
+ public BotCommandScopeChatMemberBuilder chatId(@NonNull Long chatId) {
+ this.chatId = chatId.toString();
+ return this;
+ }
+ }
}
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMemberTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMemberTest.java
index 61b17c96..2123761c 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMemberTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/BanChatMemberTest.java
@@ -16,7 +16,7 @@ public class BanChatMemberTest {
public void testBanChatMemberWithAllSet() {
BanChatMember banChatMember = BanChatMember
.builder()
- .chatId("12345")
+ .chatId(12345L)
.userId(12345L)
.untilDate(1000)
.revokeMessages(true)
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCountTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCountTest.java
index 3ccc28f7..28eec6cb 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCountTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCountTest.java
@@ -16,7 +16,7 @@ public class GetChatMemberCountTest {
public void testGetChatMemberCountWithAllSet() {
GetChatMemberCount getChatMemberCount = GetChatMemberCount
.builder()
- .chatId("12345")
+ .chatId(12345L)
.build();
assertEquals("getChatMemberCount", getChatMemberCount.getMethod());
assertDoesNotThrow(getChatMemberCount::validate);
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMemberTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMemberTest.java
index 1c6a026b..4fd3e11a 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMemberTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/groupadministration/PromoteChatMemberTest.java
@@ -4,7 +4,11 @@ import org.junit.jupiter.api.Test;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Ruben Bermudez
@@ -15,7 +19,7 @@ public class PromoteChatMemberTest {
public void testPromoteChatMemberWithAllSet() {
PromoteChatMember promoteChatMember = PromoteChatMember
.builder()
- .chatId("12345")
+ .chatId(12345L)
.userId(12345L)
.build();
assertEquals("promoteChatMember", promoteChatMember.getMethod());
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButtonTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButtonTest.java
index b6eb16d3..24c3f0a5 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButtonTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/GetChatMenuButtonTest.java
@@ -5,7 +5,11 @@ import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButton;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButtonDefault;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Ruben Bermudez
@@ -26,7 +30,7 @@ public class GetChatMenuButtonTest {
public void testGetChatMenuButtonForChat() {
GetChatMenuButton getChatMenuButton = GetChatMenuButton
.builder()
- .chatId("123456")
+ .chatId(123456L)
.build();
assertEquals("getChatMenuButton", getChatMenuButton.getMethod());
assertDoesNotThrow(getChatMenuButton::validate);
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButtonTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButtonTest.java
index 4bdfe6c1..0a82cc31 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButtonTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/menubutton/SetChatMenuButtonTest.java
@@ -1,7 +1,6 @@
package org.telegram.telegrambots.meta.api.methods.menubutton;
import org.junit.jupiter.api.Test;
-import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButton;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButtonCommands;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButtonDefault;
import org.telegram.telegrambots.meta.api.objects.menubutton.MenuButtonWebApp;
@@ -9,7 +8,11 @@ import org.telegram.telegrambots.meta.api.objects.webapp.WebAppInfo;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Ruben Bermudez
@@ -31,7 +34,7 @@ public class SetChatMenuButtonTest {
public void testGetChatMenuButtonAsCommands() {
SetChatMenuButton setChatMenuButton = SetChatMenuButton
.builder()
- .chatId("123456")
+ .chatId(123456L)
.menuButton(MenuButtonCommands.builder().build())
.build();
assertEquals("setChatMenuButton", setChatMenuButton.getMethod());
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoiceTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoiceTest.java
index a5e5b0aa..29d8f4af 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoiceTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoiceTest.java
@@ -112,7 +112,7 @@ public class SendInvoiceTest {
private SendInvoice createSendInvoiceObject() {
return SendInvoice.builder()
- .chatId("123456")
+ .chatId(123456L)
.title("Title")
.description("Description")
.payload("Payload")
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendMessageTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendMessageTest.java
index 0b03b425..d04ecc80 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendMessageTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/methods/send/SendMessageTest.java
@@ -11,7 +11,7 @@ class SendMessageTest {
void comparison() {
SendMessage sm1 = SendMessage
.builder()
- .chatId("1")
+ .chatId(1L)
.text("Hello World")
.build();
SendMessage sm2 = SendMessage
@@ -26,7 +26,6 @@ class SendMessageTest {
.disableNotification(true)
.build();
- sm1.equals(sm2);
assertEquals(sm1, sm2);
assertNotEquals(sm1, disabledNotification);
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeTest.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeTest.java
index efbe0be7..68b16ccc 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeTest.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/objects/commands/scope/BotCommandScopeTest.java
@@ -44,7 +44,7 @@ public class BotCommandScopeTest {
public void testBotCommandScopeChatWithValidChatIId() {
BotCommandScopeChat botCommandScope = BotCommandScopeChat
.builder()
- .chatId("12345")
+ .chatId(12345L)
.build();
assertEquals("chat", botCommandScope.getType());
assertDoesNotThrow(botCommandScope::validate);
@@ -87,7 +87,7 @@ public class BotCommandScopeTest {
public void testBotCommandScopeChatMemberWithValidSetUp() {
BotCommandScopeChatMember botCommandScope = BotCommandScopeChatMember
.builder()
- .chatId("12345")
+ .chatId(12345L)
.userId(12345L)
.build();
assertEquals("chat_member", botCommandScope.getType());
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestSerialization.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestSerialization.java
index e80f1322..9a39328a 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestSerialization.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestSerialization.java
@@ -27,7 +27,7 @@ public class TestSerialization {
@Test
void testSendLocation() throws JsonProcessingException {
SendLocation location = SendLocation.builder()
- .chatId("12345")
+ .chatId(12345L)
.latitude(20.758069)
.longitude(-0.005702)
.horizontalAccuracy(65.00000)
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/apimethods/TestSetGameScore.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/apimethods/TestSetGameScore.java
index 29b5fc2f..61073536 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/apimethods/TestSetGameScore.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/apimethods/TestSetGameScore.java
@@ -1,7 +1,6 @@
package org.telegram.telegrambots.meta.test.apimethods;
import com.fasterxml.jackson.databind.ObjectMapper;
-
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.telegram.telegrambots.meta.api.methods.games.SetGameScore;
@@ -26,7 +25,7 @@ class TestSetGameScore {
@BeforeEach
void setUp() {
setGameScore = new SetGameScore();
- setGameScore.setChatId("12345");
+ setGameScore.setChatId(12345L);
setGameScore.setDisableEditMessage(true);
setGameScore.setMessageId(54321);
setGameScore.setScore(12);
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index 64c99dc7..4a6771e9 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -267,6 +267,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index a8a8eb85..f3a77083 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -338,6 +338,13 @@
${java.version}
UTF-8
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+