Merge pull request #1263 from rubenlagus/dev

Dev
This commit is contained in:
Ruben Bermudez 2023-08-19 18:41:18 +01:00 committed by GitHub
commit f343d17ae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 170 additions and 39 deletions

View File

@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
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`.

View File

@ -1,3 +1,7 @@
### <a id="6.8.0"></a>6.8.0 ###
1. Update Api version [6.8](https://core.telegram.org/bots/api-changelog#august-18-2023)
2. Fix #1254
### <a id="6.7.0"></a>6.7.0 ###
1. Update Api version [6.7](https://core.telegram.org/bots/api-changelog#april-21-2023)

View File

@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
* 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).

View File

@ -1,4 +1,4 @@
### <a id="6.7.0"></a>To version 6.7.0 ###
### <a id="6.8.0"></a>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.

View File

@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
* **Gradle**
```gradle
implementation 'org.telegram:telegrambots-abilities:6.7.0'
implementation 'org.telegram:telegrambots-abilities:6.8.0'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

View File

@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>6.7.0</version>
<version>6.8.0</version>
<modules>
<module>telegrambots</module>
@ -74,8 +74,8 @@
<jackson.version>2.14.2</jackson.version>
<slf4j.version>2.0.3</slf4j.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<lombok.version>1.18.24</lombok.version>
<guava.version>31.1-jre</guava.version>
<lombok.version>1.18.28</lombok.version>
<guava.version>32.0.0-jre</guava.version>
<commons.version>3.12.0</commons.version>
</properties>

View File

@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
**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)

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambots-abilities</artifactId>
@ -84,7 +84,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>

View File

@ -15,14 +15,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
**Gradle**
```gradle
implementation 'org.telegram:telegrambots-chat-session-bot:6.7.0'
implementation 'org.telegram:telegrambots-chat-session-bot:6.8.0'
```
Motivation

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambots-chat-session-bot</artifactId>
@ -84,7 +84,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->

View File

@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
2. Using Gradle:
```gradle
implementation 'org.telegram:telegrambotsextensions:6.7.0'
implementation 'org.telegram:telegrambotsextensions:6.8.0'
```

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambotsextensions</artifactId>
@ -75,7 +75,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambots-meta</artifactId>

View File

@ -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;
}
}
}

View File

@ -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() {

View File

@ -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<MessageEntity> 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;
}
}

View File

@ -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<Integer> 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<Integer> optionIds;
/**
* Optional.
* The chat that changed the answer to the poll, if the voter is anonymous
*/
@JsonProperty(VOTER_CHAT_FIELD)
private Chat voterChat;
}

View File

@ -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 {
}

View File

@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```
**Gradle**
```gradle
implementation 'org.telegram:telegrambots-spring-boot-starter:6.7.0'
implementation 'org.telegram:telegrambots-spring-boot-starter:6.8.0'
```
Motivation

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambots-spring-boot-starter</artifactId>
@ -70,7 +70,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<telegrambots.version>6.7.0</telegrambots.version>
<telegrambots.version>6.8.0</telegrambots.version>
<spring-boot.version>2.7.12</spring-boot.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</parent>
<artifactId>telegrambots</artifactId>
@ -91,7 +91,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-meta</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -737,7 +737,7 @@ public abstract class DefaultAbsSender extends AbsSender {
addInputFile(builder, createNewStickerSet.getPngSticker(), CreateNewStickerSet.PNGSTICKER_FIELD, true);
} else if (createNewStickerSet.getTgsSticker() != null) {
addInputFile(builder, createNewStickerSet.getTgsSticker(), CreateNewStickerSet.TGSSTICKER_FIELD, true);
} else {
} else if (createNewStickerSet.getWebmSticker() != null) {
addInputFile(builder, createNewStickerSet.getWebmSticker(), CreateNewStickerSet.WEBMSTICKER_FIELD, true);
}
if (createNewStickerSet.getMaskPosition() != null) {