From eef0681ddf8b8d846ae021395931c12b87646b4d Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 6 Nov 2021 14:52:47 +0000 Subject: [PATCH] Api Version 5.4 --- README.md | 8 +-- TelegramBots.wiki/Changelog.md | 4 ++ TelegramBots.wiki/Getting-Started.md | 4 +- TelegramBots.wiki/abilities/Simple-Example.md | 4 +- pom.xml | 2 +- telegrambots-abilities/README.md | 4 +- telegrambots-abilities/pom.xml | 4 +- .../abilitybots/api/objects/Flag.java | 1 + telegrambots-chat-session-bot/README.md | 4 +- telegrambots-chat-session-bot/pom.xml | 4 +- telegrambots-extensions/README.md | 4 +- telegrambots-extensions/pom.xml | 4 +- telegrambots-meta/pom.xml | 2 +- .../ApproveChatJoinRequest.java | 70 +++++++++++++++++++ .../CreateChatInviteLink.java | 22 +++++- .../DeclineChatJoinRequest.java | 70 +++++++++++++++++++ .../EditChatInviteLink.java | 18 +++++ .../meta/api/methods/send/SendChatAction.java | 18 +++-- .../meta/api/objects/ChatInviteLink.java | 12 ++++ .../meta/api/objects/ChatJoinRequest.java | 37 ++++++++++ .../telegrambots/meta/api/objects/Update.java | 7 ++ telegrambots-spring-boot-starter/README.md | 4 +- telegrambots-spring-boot-starter/pom.xml | 4 +- telegrambots/pom.xml | 4 +- 24 files changed, 279 insertions(+), 36 deletions(-) create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatJoinRequest.java diff --git a/README.md b/README.md index a4dfc65a..bd7ce472 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,18 @@ Just import add the library to your project with one of these options: org.telegram telegrambots - 5.3.0 + 5.4.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambots:5.3.0' + implementation 'org.telegram:telegrambots:5.4.0' ``` - 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.3.0) - 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.3.0) + 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.4.0) + 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.4.0) In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`. diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md index 84e30ef5..388a2aae 100644 --- a/TelegramBots.wiki/Changelog.md +++ b/TelegramBots.wiki/Changelog.md @@ -1,3 +1,7 @@ +### 5.3.0 ### +1. Update Api version [5.4](https://core.telegram.org/bots/api-changelog#november-4-2021) +2. Bug fixing: #968, #958, #942 + ### 5.3.0 ### 1. Update Api version [5.3](https://core.telegram.org/bots/api-changelog#june-25-2021) 2. `KeyboardRow` now support creation from a collection of buttons. diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index 7ebb0299..97b8333f 100644 --- a/TelegramBots.wiki/Getting-Started.md +++ b/TelegramBots.wiki/Getting-Started.md @@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss org.telegram telegrambots - 5.3.0 + 5.4.0 ``` * With **Gradle**: ```gradle - implementation 'org.telegram:telegrambots:5.3.0' + implementation 'org.telegram:telegrambots:5.4.0' ``` 2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots). diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md index da3736ca..7e1aa2f4 100644 --- a/TelegramBots.wiki/abilities/Simple-Example.md +++ b/TelegramBots.wiki/abilities/Simple-Example.md @@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies. org.telegram telegrambots-abilities - 5.3.0 + 5.4.0 ``` * **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:5.3.0' + implementation 'org.telegram:telegrambots-abilities:5.4.0' ``` * [JitPack](https://jitpack.io/#rubenlagus/TelegramBots) diff --git a/pom.xml b/pom.xml index 1157e0cf..8e3715c3 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots pom - 5.3.0 + 5.4.0 telegrambots diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md index 72c359e6..b869afae 100644 --- a/telegrambots-abilities/README.md +++ b/telegrambots-abilities/README.md @@ -18,14 +18,14 @@ Usage org.telegram telegrambots-abilities - 5.3.0 + 5.4.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:5.3.0' + implementation 'org.telegram:telegrambots-abilities:5.4.0' ``` **JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1) diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml index 68afd8cb..bf1ae158 100644 --- a/telegrambots-abilities/pom.xml +++ b/telegrambots-abilities/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambots-abilities @@ -84,7 +84,7 @@ org.telegram telegrambots - 5.3.0 + 5.4.0 org.apache.commons diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java index 414d08da..27623fab 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/Flag.java @@ -31,6 +31,7 @@ public enum Flag implements Predicate { POLL_ANSWER(Update::hasPollAnswer), MY_CHAT_MEMBER(Update::hasMyChatMember), CHAT_MEMBER(Update::hasChatMember), + HAS_CHAT_JOIN_REQUEST(Update::hasChatJoinRequest), // Message Flags diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md index 5b44068c..07c4ad09 100644 --- a/telegrambots-chat-session-bot/README.md +++ b/telegrambots-chat-session-bot/README.md @@ -15,14 +15,14 @@ Usage org.telegram telegrambots-chat-session-bot - 5.3.0 + 5.4.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-chat-session-bot:5.3.0' + implementation 'org.telegram:telegrambots-chat-session-bot:5.4.0' ``` Motivation diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml index 7b901bea..36f5df43 100644 --- a/telegrambots-chat-session-bot/pom.xml +++ b/telegrambots-chat-session-bot/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambots-chat-session-bot @@ -84,7 +84,7 @@ org.telegram telegrambots - 5.3.0 + 5.4.0 diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md index eb620d4d..8c55e16d 100644 --- a/telegrambots-extensions/README.md +++ b/telegrambots-extensions/README.md @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options: org.telegram telegrambotsextensions - 5.3.0 + 5.4.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambotsextensions:5.3.0' + implementation 'org.telegram:telegrambotsextensions:5.4.0' ``` \ No newline at end of file diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml index a8968c88..f95690e1 100644 --- a/telegrambots-extensions/pom.xml +++ b/telegrambots-extensions/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambotsextensions @@ -75,7 +75,7 @@ org.telegram telegrambots - 5.3.0 + 5.4.0 diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml index 156a8c33..d753c26b 100644 --- a/telegrambots-meta/pom.xml +++ b/telegrambots-meta/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambots-meta 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 new file mode 100644 index 00000000..a2e4d0e4 --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/ApproveChatJoinRequest.java @@ -0,0 +1,70 @@ +package org.telegram.telegrambots.meta.api.methods.groupadministration; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.*; +import org.telegram.telegrambots.meta.api.methods.BotApiMethod; +import org.telegram.telegrambots.meta.api.objects.ApiResponse; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; + +import java.io.IOException; + +/** + * @author Ruben Bermudez + * @version 5.4 + * Use this method to approve a chat join request. + * The bot must be an administrator in the chat for this to work and must have the can_invite_users admin right. + * Returns True on success. + */ +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@NoArgsConstructor +@RequiredArgsConstructor +@AllArgsConstructor +@Builder +public class ApproveChatJoinRequest extends BotApiMethod { + public static final String PATH = "approveChatJoinRequest"; + + private static final String CHATID_FIELD = "chat_id"; + private static final String USERID_FIELD = "user_id"; + + @JsonProperty(CHATID_FIELD) + @NonNull + private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + @JsonProperty(USERID_FIELD) + @NonNull + private Long userId; ///< Required. Unique identifier of the target user + + @Override + public String getMethod() { + return PATH; + } + + @Override + public Boolean deserializeResponse(String answer) throws TelegramApiRequestException { + try { + ApiResponse result = OBJECT_MAPPER.readValue(answer, + new TypeReference>(){}); + if (result.getOk()) { + return result.getResult(); + } else { + throw new TelegramApiRequestException("Error approving chat join request", result); + } + } catch (IOException e) { + throw new TelegramApiRequestException("Unable to deserialize response", e); + } + } + + @Override + public void validate() throws TelegramApiValidationException { + if (chatId.isEmpty()) { + throw new TelegramApiValidationException("ChatId can't be empty", this); + } + if (userId == 0) { + throw new TelegramApiValidationException("UserId can't be null or 0", 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 1daad76f..124e600a 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 @@ -43,6 +43,8 @@ public class CreateChatInviteLink extends BotApiMethod { private static final String CHATID_FIELD = "chat_id"; private static final String EXPIREDATE_FIELD = "expire_date"; private static final String MEMBERLIMIT_FIELD = "member_limit"; + private static final String NAME_FIELD = "name"; + private static final String CREATESJOINREQUEST_FIELD = "creates_join_request"; @JsonProperty(CHATID_FIELD) @NonNull @@ -55,7 +57,17 @@ public class CreateChatInviteLink extends BotApiMethod { * Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ @JsonProperty(MEMBERLIMIT_FIELD) - private Integer memberLimit; + private Integer memberLimit; ///< Optional. Invite link name; 0-32 characters + @JsonProperty(NAME_FIELD) + private String name; ///< Optional. Invite link name; 0-32 characters + /** + * Optional. + * + * True, if users joining the chat via the link need to be approved by chat administrators. + * If True, member_limit can't be specified + */ + @JsonProperty(CREATESJOINREQUEST_FIELD) + private Boolean createsJoinRequest; @Override @@ -80,9 +92,15 @@ public class CreateChatInviteLink 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 (name != null && name.length() > 32) { + throw new TelegramApiValidationException("Name must be between 0 and 32 characters", this); + } + if (createsJoinRequest != null && memberLimit != null) { + throw new TelegramApiValidationException("MemberLimit can not be used with CreatesJoinRequest field", this); + } if (memberLimit != null && (memberLimit < 1 || memberLimit > 99999)) { throw new TelegramApiValidationException("MemberLimit must be between 1 and 99999", 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 new file mode 100644 index 00000000..26639b57 --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeclineChatJoinRequest.java @@ -0,0 +1,70 @@ +package org.telegram.telegrambots.meta.api.methods.groupadministration; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.*; +import org.telegram.telegrambots.meta.api.methods.BotApiMethod; +import org.telegram.telegrambots.meta.api.objects.ApiResponse; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; + +import java.io.IOException; + +/** + * @author Ruben Bermudez + * @version 5.4 + * Use this method to decline a chat join request. + * The bot must be an administrator in the chat for this to work and must have the can_invite_users admin right. + * Returns True on success. + */ +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@NoArgsConstructor +@RequiredArgsConstructor +@AllArgsConstructor +@Builder +public class DeclineChatJoinRequest extends BotApiMethod { + public static final String PATH = "declineChatJoinRequest"; + + private static final String CHATID_FIELD = "chat_id"; + private static final String USERID_FIELD = "user_id"; + + @JsonProperty(CHATID_FIELD) + @NonNull + private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + @JsonProperty(USERID_FIELD) + @NonNull + private Long userId; ///< Required. Unique identifier of the target user + + @Override + public String getMethod() { + return PATH; + } + + @Override + public Boolean deserializeResponse(String answer) throws TelegramApiRequestException { + try { + ApiResponse result = OBJECT_MAPPER.readValue(answer, + new TypeReference>(){}); + if (result.getOk()) { + return result.getResult(); + } else { + throw new TelegramApiRequestException("Error declining chat join request", result); + } + } catch (IOException e) { + throw new TelegramApiRequestException("Unable to deserialize response", e); + } + } + + @Override + public void validate() throws TelegramApiValidationException { + if (chatId.isEmpty()) { + throw new TelegramApiValidationException("ChatId can't be empty", this); + } + if (userId == 0) { + throw new TelegramApiValidationException("UserId can't be null or 0", 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 18b617d6..014101df 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 @@ -45,6 +45,8 @@ public class EditChatInviteLink extends BotApiMethod { private static final String INVITELINK_FIELD = "invite_link"; private static final String EXPIREDATE_FIELD = "expire_date"; private static final String MEMBERLIMIT_FIELD = "member_limit"; + private static final String NAME_FIELD = "name"; + private static final String CREATESJOINREQUEST_FIELD = "creates_join_request"; @JsonProperty(CHATID_FIELD) @NonNull @@ -61,6 +63,16 @@ public class EditChatInviteLink extends BotApiMethod { */ @JsonProperty(MEMBERLIMIT_FIELD) private Integer memberLimit; + @JsonProperty(NAME_FIELD) + private String name; ///< Optional. Invite link name; 0-32 characters + /** + * Optional. + * + * True, if users joining the chat via the link need to be approved by chat administrators. + * If True, member_limit can't be specified + */ + @JsonProperty(CREATESJOINREQUEST_FIELD) + private Boolean createsJoinRequest; @Override @@ -91,6 +103,12 @@ public class EditChatInviteLink extends BotApiMethod { if (Strings.isNullOrEmpty(inviteLink)) { throw new TelegramApiValidationException("InviteLink can't be empty", this); } + if (name != null && name.length() > 32) { + throw new TelegramApiValidationException("Name must be between 0 and 32 characters", this); + } + if (createsJoinRequest != null && memberLimit != null) { + throw new TelegramApiValidationException("MemberLimit can not be used with CreatesJoinRequest field", this); + } if (memberLimit != null && (memberLimit < 1 || memberLimit > 99999)) { throw new TelegramApiValidationException("MemberLimit must be between 1 and 99999", 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 a821cd65..1e688945 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 @@ -44,10 +44,16 @@ public class SendChatAction extends BotApiMethod { @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) /** - * Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, - * upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, - * upload_document for general files, find_location for location data, - * record_video_note or upload_video_note for video notes. + * Type of action to broadcast. Choose one, depending on what the user is about to receive: + * typing for text messages + * upload_photo for photos + * record_video or upload_video for videos + * record_voice or upload_voice for voice notes + * upload_document for general files + * choose_sticker for stickers + * find_location for location data + * record_video_note + * upload_video_note for video notes */ @JsonProperty(ACTION_FIELD) @NonNull @@ -85,10 +91,10 @@ public class SendChatAction 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 (action == null) { + if (action.isEmpty()) { throw new TelegramApiValidationException("Action parameter can't be empty", this); } } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatInviteLink.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatInviteLink.java index 9ebc4210..617a6d75 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatInviteLink.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatInviteLink.java @@ -28,6 +28,9 @@ public class ChatInviteLink implements BotApiObject { private static final String ISREVOKED_FIELD = "is_revoked"; private static final String EXPIREDATE_FIELD = "expire_date"; private static final String MEMBERLIMIT_FIELD = "member_limit"; + private static final String NAME_FIELD = "member_limit"; + private static final String PENDINGJOINREQUESTCOUNT_FIELD = "pending_join_request_count"; + private static final String CREATESJOINREQUEST_FIELD = "creates_join_request"; /** * The invite link. @@ -50,4 +53,13 @@ public class ChatInviteLink implements BotApiObject { */ @JsonProperty(MEMBERLIMIT_FIELD) private Integer memberLimit; + @JsonProperty(NAME_FIELD) + private String name; ///< Optional. Invite link name + @JsonProperty(PENDINGJOINREQUESTCOUNT_FIELD) + private Integer pendingJoinRequestCount; ///< Optional. Number of pending join requests created using this link + /** + * True, if users joining the chat via the link need to be approved by chat administrators + */ + @JsonProperty(CREATESJOINREQUEST_FIELD) + private Boolean createsJoinRequest; } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatJoinRequest.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatJoinRequest.java new file mode 100644 index 00000000..7eba4c79 --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatJoinRequest.java @@ -0,0 +1,37 @@ +package org.telegram.telegrambots.meta.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; + +/** + * @author Ruben Bermudez + * @version 5.4 + * + * Represents a join request sent to a chat. + */ +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class ChatJoinRequest implements BotApiObject { + private static final String CHAT_FIELD = "chat"; + private static final String FROM_FIELD = "from"; + private static final String DATE_FIELD = "date"; + private static final String BIO_FIELD = "bio"; + private static final String INVITELINK_FIELD = "invite_link"; + + + @JsonProperty(CHAT_FIELD) + private Chat chat; ///< Chat to which the request was sent + @JsonProperty(FROM_FIELD) + private User user; ///< User that sent the join request + @JsonProperty(DATE_FIELD) + private Integer date; ///< Date the request was sent in Unix time + @JsonProperty(BIO_FIELD) + private String bio; ///< Optional. Bio of the user. + @JsonProperty(INVITELINK_FIELD) + private String inviteLink; ///< Optional. Chat invite link that was used by the user to send the join request +} diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Update.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Update.java index d56697f9..fd0e63e1 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Update.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Update.java @@ -44,6 +44,7 @@ public class Update implements BotApiObject { private static final String POLLANSWER_FIELD = "poll_answer"; private static final String MYCHATMEMBER_FIELD = "my_chat_member"; private static final String CHATMEMBER_FIELD = "chat_member"; + private static final String CHATJOINREQUEST_FIELD = "chat_join_request"; @JsonProperty(UPDATEID_FIELD) private Integer updateId; @@ -91,6 +92,8 @@ public class Update implements BotApiObject { */ @JsonProperty(CHATMEMBER_FIELD) private ChatMemberUpdated chatMember; + @JsonProperty(CHATJOINREQUEST_FIELD) + private ChatJoinRequest chatJoinRequest; public boolean hasMessage() { return message != null; @@ -143,4 +146,8 @@ public class Update implements BotApiObject { public boolean hasChatMember() { return chatMember != null; } + + public boolean hasChatJoinRequest() { + return chatJoinRequest != null; + } } diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md index ede37898..f4ab20e7 100644 --- a/telegrambots-spring-boot-starter/README.md +++ b/telegrambots-spring-boot-starter/README.md @@ -18,14 +18,14 @@ Usage org.telegram telegrambots-spring-boot-starter - 5.3.0 + 5.4.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-spring-boot-starter:5.3.0' + implementation 'org.telegram:telegrambots-spring-boot-starter:5.4.0' ``` Motivation diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml index 0f3d09b9..81cde1c6 100644 --- a/telegrambots-spring-boot-starter/pom.xml +++ b/telegrambots-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambots-spring-boot-starter @@ -70,7 +70,7 @@ UTF-8 UTF-8 - 5.3.0 + 5.4.0 2.4.5 1.6 diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml index 301e6bc5..89fe45f4 100644 --- a/telegrambots/pom.xml +++ b/telegrambots/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.3.0 + 5.4.0 telegrambots @@ -92,7 +92,7 @@ org.telegram telegrambots-meta - 5.3.0 + 5.4.0 org.projectlombok