diff --git a/README.md b/README.md index 688eab46..d9a7d39b 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 - 6.7.0 + 6.8.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambots:6.7.0' + implementation 'org.telegram:telegrambots:6.8.0' ``` - 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.7.0) - 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.7.0) + 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.8.0) + 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.8.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 cf999b4e..631d2a56 100644 --- a/TelegramBots.wiki/Changelog.md +++ b/TelegramBots.wiki/Changelog.md @@ -1,3 +1,7 @@ +### 6.8.0 ### +1. Update Api version [6.8](https://core.telegram.org/bots/api-changelog#august-18-2023) +2. Fix #1254 + ### 6.7.0 ### 1. Update Api version [6.7](https://core.telegram.org/bots/api-changelog#april-21-2023) diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index 62aeb066..9b19c2d0 100644 --- a/TelegramBots.wiki/Getting-Started.md +++ b/TelegramBots.wiki/Getting-Started.md @@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve org.telegram telegrambots - 6.7.0 + 6.8.0 ``` * With **Gradle**: ```gradle - implementation 'org.telegram:telegrambots:6.7.0' + implementation 'org.telegram:telegrambots:6.8.0' ``` 2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots). diff --git a/TelegramBots.wiki/How-To-Update.md b/TelegramBots.wiki/How-To-Update.md index 15940d46..3a10b2e7 100644 --- a/TelegramBots.wiki/How-To-Update.md +++ b/TelegramBots.wiki/How-To-Update.md @@ -1,4 +1,4 @@ -### To version 6.7.0 ### +### To version 6.8.0 ### 1. Api methods with thumbnails have changed the field, use getThumbnail()/setThumbnail() instead of getThumb()/setThumb() 2. In `AddStickerToSet`/`CreateNewStickerSet`/`UploadStickerFile`/etc, use field `sticker` instead of the deprecated fields. 3. `ChatMember` has more details permissions, use those instead of the legacy general ones. diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md index 51446b6e..f1e796e5 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 - 6.7.0 + 6.8.0 ``` * **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:6.7.0' + implementation 'org.telegram:telegrambots-abilities:6.8.0' ``` * [JitPack](https://jitpack.io/#rubenlagus/TelegramBots) diff --git a/pom.xml b/pom.xml index 6678aeba..d15dae57 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots pom - 6.7.0 + 6.8.0 telegrambots @@ -74,8 +74,8 @@ 2.14.2 2.0.3 2.1.1 - 1.18.24 - 31.1-jre + 1.18.28 + 32.0.0-jre 3.12.0 diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md index 126e393e..fa315de8 100644 --- a/telegrambots-abilities/README.md +++ b/telegrambots-abilities/README.md @@ -18,14 +18,14 @@ Usage org.telegram telegrambots-abilities - 6.7.0 + 6.8.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:6.7.0' + implementation 'org.telegram:telegrambots-abilities:6.8.0' ``` **JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1) diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml index 26d6b708..63f2fbe4 100644 --- a/telegrambots-abilities/pom.xml +++ b/telegrambots-abilities/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambots-abilities @@ -84,7 +84,7 @@ org.telegram telegrambots - 6.7.0 + 6.8.0 org.apache.commons diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md index 662617f5..db497f32 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 - 6.7.0 + 6.8.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-chat-session-bot:6.7.0' + implementation 'org.telegram:telegrambots-chat-session-bot:6.8.0' ``` Motivation diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml index b2b1f4ab..6609e458 100644 --- a/telegrambots-chat-session-bot/pom.xml +++ b/telegrambots-chat-session-bot/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambots-chat-session-bot @@ -84,7 +84,7 @@ org.telegram telegrambots - 6.7.0 + 6.8.0 diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md index b063b563..3cdcae43 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 - 6.7.0 + 6.8.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambotsextensions:6.7.0' + implementation 'org.telegram:telegrambotsextensions:6.8.0' ``` \ No newline at end of file diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml index bd0c2e98..38819f85 100644 --- a/telegrambots-extensions/pom.xml +++ b/telegrambots-extensions/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambotsextensions @@ -75,7 +75,7 @@ org.telegram telegrambots - 6.7.0 + 6.8.0 diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml index d309d5b1..fda75ac8 100644 --- a/telegrambots-meta/pom.xml +++ b/telegrambots-meta/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambots-meta diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/forum/UnpinAllGeneralForumTopicMessages.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/forum/UnpinAllGeneralForumTopicMessages.java new file mode 100644 index 00000000..c0b8cacf --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/forum/UnpinAllGeneralForumTopicMessages.java @@ -0,0 +1,70 @@ +package org.telegram.telegrambots.meta.api.methods.forum; + +import com.fasterxml.jackson.annotation.JsonProperty; +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.botapimethods.BotApiMethodBoolean; +import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; + +/** + * @author Ruben Bermudez + * @version 6.8 + * Use this method to clear the list of pinned messages in a General forum topic. + * The bot must be an administrator in the chat for this to work and must have the + * can_pin_messages administrator right in the supergroup. + * + * Returns True on success. + */ +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@NoArgsConstructor(force = true) +@AllArgsConstructor +@Builder +public class UnpinAllGeneralForumTopicMessages extends BotApiMethodBoolean { + public static final String PATH = "unpinAllGeneralForumTopicMessages"; + + private static final String CHAT_ID_FIELD = "chat_id"; + + /** + * Unique identifier for the target chat or username + * of the target supergroup (in the format @supergroupusername) + */ + @JsonProperty(CHAT_ID_FIELD) + @NonNull + private String chatId; + + @Tolerate + public void setChatId(@NonNull Long chatId) { + this.chatId = chatId.toString(); + } + + @Override + public void validate() throws TelegramApiValidationException { + if (chatId.isEmpty()) { + throw new TelegramApiValidationException("ChatId can't be empty", this); + } + } + + @Override + public String getMethod() { + return PATH; + } + + public static class UnpinAllGeneralForumTopicMessagesBuilder { + + @Tolerate + public UnpinAllGeneralForumTopicMessagesBuilder chatId(@NonNull Long chatId) { + this.chatId = chatId.toString(); + return this; + } + } +} diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Chat.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Chat.java index 89432362..677db59c 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Chat.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Chat.java @@ -57,6 +57,7 @@ public class Chat implements BotApiObject { private static final String EMOJISTATUSCUSTOMEMOJIID_FIELD = "emoji_status_custom_emoji_id"; private static final String HASAGGRESSIVEANTISPAMENABLED_FIELD = "has_aggressive_anti_spam_enabled"; private static final String HASHIDDENMEMBERS_FIELD = "has_hidden_members"; + private static final String EMOJI_STATUS_EXPIRATION_DATE_FIELD = "emoji_status_expiration_date"; private static final String USERCHATTYPE = "private"; private static final String GROUPCHATTYPE = "group"; @@ -252,6 +253,13 @@ public class Chat implements BotApiObject { */ @JsonProperty(HASHIDDENMEMBERS_FIELD) private Boolean hasHiddenMembers; + /** + * Optional. + * Expiration date of the emoji status of the other party in a private chat, if any. + * Returned only in getChat. + */ + @JsonProperty(EMOJI_STATUS_EXPIRATION_DATE_FIELD) + private Boolean emojiStatusExpirationDate; @JsonIgnore public Boolean isGroupChat() { diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java index f1cdc0dd..af2b77a3 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java @@ -23,6 +23,7 @@ import org.telegram.telegrambots.meta.api.objects.payments.SuccessfulPayment; import org.telegram.telegrambots.meta.api.objects.polls.Poll; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.stickers.Sticker; +import org.telegram.telegrambots.meta.api.objects.stories.Story; import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatEnded; import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatParticipantsInvited; import org.telegram.telegrambots.meta.api.objects.videochat.VideoChatScheduled; @@ -115,6 +116,7 @@ public class Message implements BotApiObject { private static final String HASMEDIASPOILER_FIELD = "has_media_spoiler"; private static final String USERSHARED_FIELD = "user_shared"; private static final String CHATSHARED_FIELD = "chat_shared"; + private static final String STORY_FIELD = "story"; /** * Integer Unique message identifier @@ -555,6 +557,12 @@ public class Message implements BotApiObject { */ @JsonProperty(CHATSHARED_FIELD) private ChatShared chatShared; + /** + * Optional. + * Message is a forwarded story + */ + @JsonProperty(STORY_FIELD) + private Story story; public List getEntities() { if (entities != null) { @@ -777,4 +785,9 @@ public class Message implements BotApiObject { private boolean hasChatShared() { return chatShared != null; } + + @JsonIgnore + private boolean hasStory() { + return story != null; + } } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/PollAnswer.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/PollAnswer.java index ee5edd0a..01c669d1 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/PollAnswer.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/PollAnswer.java @@ -8,6 +8,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; +import org.telegram.telegrambots.meta.api.objects.Chat; import org.telegram.telegrambots.meta.api.objects.User; import java.util.List; @@ -25,14 +26,31 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor public class PollAnswer implements BotApiObject { - private static final String POLLID_FIELD = "poll_id"; + private static final String POLL_ID_FIELD = "poll_id"; private static final String USER_FIELD = "user"; - private static final String OPTIONIDS_FIELD = "option_ids"; + private static final String OPTION_IDS_FIELD = "option_ids"; + private static final String VOTER_CHAT_FIELD = "voter_chat"; - @JsonProperty(POLLID_FIELD) - private String pollId; ///< Unique poll identifier + /** + * Unique poll identifier + */ + @JsonProperty(POLL_ID_FIELD) + private String pollId; + /** + * The user, who changed the answer to the poll + */ @JsonProperty(USER_FIELD) - private User user; ///< The user, who changed the answer to the poll - @JsonProperty(OPTIONIDS_FIELD) - private List optionIds; ///< 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. + private User user; + /** + * Optional. + * The chat that changed the answer to the poll, if the voter is anonymous + */ + @JsonProperty(OPTION_IDS_FIELD) + private List optionIds; + /** + * Optional. + * The chat that changed the answer to the poll, if the voter is anonymous + */ + @JsonProperty(VOTER_CHAT_FIELD) + private Chat voterChat; } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stories/Story.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stories/Story.java new file mode 100644 index 00000000..f968dcae --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stories/Story.java @@ -0,0 +1,18 @@ +package org.telegram.telegrambots.meta.api.objects.stories; + +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; + +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@NoArgsConstructor +@Builder +public class Story implements BotApiObject { +} diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md index 433af7f1..4364752b 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 - 6.7.0 + 6.8.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-spring-boot-starter:6.7.0' + implementation 'org.telegram:telegrambots-spring-boot-starter:6.8.0' ``` Motivation diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml index 06d9dde4..18623199 100644 --- a/telegrambots-spring-boot-starter/pom.xml +++ b/telegrambots-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambots-spring-boot-starter @@ -70,7 +70,7 @@ UTF-8 UTF-8 - 6.7.0 + 6.8.0 2.7.12 1.6 diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml index 7997878d..6f3959d7 100644 --- a/telegrambots/pom.xml +++ b/telegrambots/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 6.7.0 + 6.8.0 telegrambots @@ -91,7 +91,7 @@ org.telegram telegrambots-meta - 6.7.0 + 6.8.0 org.projectlombok