Skip to content

Commit de14334

Browse files
committed
Api Version 8.3
1 parent cceccfd commit de14334

File tree

27 files changed

+287
-84
lines changed

27 files changed

+287
-84
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>org.telegram</groupId>
88
<artifactId>Bots</artifactId>
99
<packaging>pom</packaging>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111

1212
<modules>
1313
<module>telegrambots-meta</module>

telegrambots-abilities/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-abilities</artifactId>
@@ -104,12 +104,12 @@
104104
<dependency>
105105
<groupId>org.telegram</groupId>
106106
<artifactId>telegrambots-webhook</artifactId>
107-
<version>8.2.0</version>
107+
<version>8.3.0</version>
108108
</dependency>
109109
<dependency>
110110
<groupId>org.telegram</groupId>
111111
<artifactId>telegrambots-longpolling</artifactId>
112-
<version>8.2.0</version>
112+
<version>8.3.0</version>
113113
</dependency>
114114

115115
<dependency>

telegrambots-client-jetty-adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111
</parent>
1212

1313
<name>Telegram Bots Client Jetty HttpClient adapter</name>

telegrambots-client-jetty-adapter/src/main/java/org/telegram/telegrambots/client/jetty/JettyTelegramClient.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,17 @@ public CompletableFuture<Message> executeAsync(SendVideo sendVideo) {
184184
.addPart(SendVideo.HAS_SPOILER_FIELD, sendVideo.getHasSpoiler())
185185
.addPart(SendVideo.BUSINESS_CONNECTION_ID_FIELD, sendVideo.getBusinessConnectionId())
186186
.addPart(SendVideo.SHOW_CAPTION_ABOVE_MEDIA_FIELD, sendVideo.getShowCaptionAboveMedia())
187+
.addPart(SendVideo.START_TIMESTAMP_FIELD, sendVideo.getStartTimestamp())
187188
.addJsonPart(SendVideo.CAPTION_ENTITIES_FIELD, sendVideo.getCaptionEntities());
188189

189190
if (sendVideo.getThumbnail() != null) {
190191
builder.addInputFile(SendVideo.THUMBNAIL_FIELD, sendVideo.getThumbnail(), false);
191192
builder.addPart(SendVideo.THUMBNAIL_FIELD, sendVideo.getThumbnail().getAttachName());
192193
}
194+
if (sendVideo.getCover() != null) {
195+
builder.addInputFile(SendVideo.COVER_FIELD, sendVideo.getCover(), false);
196+
builder.addPart(SendVideo.COVER_FIELD, sendVideo.getCover().getAttachName());
197+
}
193198
});
194199
}
195200

@@ -642,6 +647,9 @@ private void addInputData(JettyMultipartBuilder builder, String mediaField, Inpu
642647
if (video.getThumbnail() != null) {
643648
builder.addInputFile(InputMediaVideo.THUMBNAIL_FIELD, video.getThumbnail(), false);
644649
}
650+
if (video.getCover() != null) {
651+
builder.addInputFile(InputMediaVideo.COVER_FIELD, video.getCover(), false);
652+
}
645653
} else if (media instanceof InputMediaAnimation animation) {
646654
if (animation.getThumbnail() != null) {
647655
builder.addInputFile(InputMediaAnimation.THUMBNAIL_FIELD, animation.getThumbnail(), false);
@@ -658,9 +666,12 @@ private void addInputData(JettyMultipartBuilder builder, String mediaField, Inpu
658666
builder.addMedia(media);
659667
}
660668

661-
if (media instanceof InputPaidMediaVideo document) {
662-
if (document.getThumbnail() != null) {
663-
builder.addInputFile(InputMediaDocument.THUMBNAIL_FIELD, document.getThumbnail(), false);
669+
if (media instanceof InputPaidMediaVideo video) {
670+
if (video.getThumbnail() != null) {
671+
builder.addInputFile(InputPaidMediaVideo.THUMBNAIL_FIELD, video.getThumbnail(), false);
672+
}
673+
if (video.getCover() != null) {
674+
builder.addInputFile(InputPaidMediaVideo.COVER_FIELD, video.getCover(), false);
664675
}
665676
}
666677

telegrambots-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111
</parent>
1212

1313
<name>Telegram Bots Client</name>

telegrambots-client/src/main/java/org/telegram/telegrambots/client/okhttp/OkHttpTelegramClient.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,17 @@ public CompletableFuture<Message> executeAsync(SendVideo sendVideo) {
178178
.addPart(SendVideo.HAS_SPOILER_FIELD, sendVideo.getHasSpoiler())
179179
.addPart(SendVideo.BUSINESS_CONNECTION_ID_FIELD, sendVideo.getBusinessConnectionId())
180180
.addPart(SendVideo.SHOW_CAPTION_ABOVE_MEDIA_FIELD, sendVideo.getShowCaptionAboveMedia())
181+
.addPart(SendVideo.START_TIMESTAMP_FIELD, sendVideo.getStartTimestamp())
181182
.addJsonPart(SendVideo.CAPTION_ENTITIES_FIELD, sendVideo.getCaptionEntities());
182183

183184
if (sendVideo.getThumbnail() != null) {
184185
builder.addInputFile(SendVideo.THUMBNAIL_FIELD, sendVideo.getThumbnail(), false);
185186
builder.addPart(SendVideo.THUMBNAIL_FIELD, sendVideo.getThumbnail().getAttachName());
186187
}
188+
if (sendVideo.getCover() != null) {
189+
builder.addInputFile(SendVideo.COVER_FIELD, sendVideo.getCover(), false);
190+
builder.addPart(SendVideo.COVER_FIELD, sendVideo.getCover().getAttachName());
191+
}
187192
});
188193
}
189194

@@ -641,6 +646,9 @@ private void addInputData(TelegramMultipartBuilder builder, String mediaField, I
641646
if (video.getThumbnail() != null) {
642647
builder.addInputFile(InputMediaVideo.THUMBNAIL_FIELD, video.getThumbnail(), false);
643648
}
649+
if (video.getCover() != null) {
650+
builder.addInputFile(InputMediaVideo.COVER_FIELD, video.getCover(), false);
651+
}
644652
} else if (media instanceof InputMediaAnimation animation) {
645653
if (animation.getThumbnail() != null) {
646654
builder.addInputFile(InputMediaAnimation.THUMBNAIL_FIELD, animation.getThumbnail(), false);
@@ -657,10 +665,14 @@ private void addInputData(TelegramMultipartBuilder builder, String mediaField, I
657665
builder.addMedia(media);
658666
}
659667

660-
if (media instanceof InputPaidMediaVideo document) {
661-
if (document.getThumbnail() != null) {
662-
builder.addInputFile(InputMediaDocument.THUMBNAIL_FIELD, document.getThumbnail(), false);
668+
if (media instanceof InputPaidMediaVideo video) {
669+
if (video.getThumbnail() != null) {
670+
builder.addInputFile(InputPaidMediaVideo.THUMBNAIL_FIELD, video.getThumbnail(), false);
671+
}
672+
if (video.getCover() != null) {
673+
builder.addInputFile(InputPaidMediaVideo.COVER_FIELD, video.getCover(), false);
663674
}
675+
664676
}
665677

666678
if (addField) {

telegrambots-extensions/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
1616
<dependency>
1717
<groupId>org.telegram</groupId>
1818
<artifactId>telegrambots-extensions</artifactId>
19-
<version>8.2.0</version>
19+
<version>8.3.0</version>
2020
</dependency>
2121
```
2222

2323
2. Using Gradle:
2424

2525
```gradle
26-
implementation 'org.telegram:telegrambots-extensions:8.2.0'
26+
implementation 'org.telegram:telegrambots-extensions:8.3.0'
2727
```

telegrambots-extensions/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-extensions</artifactId>
@@ -89,12 +89,12 @@
8989
<dependency>
9090
<groupId>org.telegram</groupId>
9191
<artifactId>telegrambots-webhook</artifactId>
92-
<version>8.2.0</version>
92+
<version>8.3.0</version>
9393
</dependency>
9494
<dependency>
9595
<groupId>org.telegram</groupId>
9696
<artifactId>telegrambots-longpolling</artifactId>
97-
<version>8.2.0</version>
97+
<version>8.3.0</version>
9898
</dependency>
9999

100100
<dependency>

telegrambots-longpolling/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.telegram</groupId>
88
<artifactId>Bots</artifactId>
9-
<version>8.2.0</version>
9+
<version>8.3.0</version>
1010
</parent>
1111

1212
<artifactId>telegrambots-longpolling</artifactId>

telegrambots-meta/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>8.2.0</version>
10+
<version>8.3.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-meta</artifactId>

telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,58 +48,59 @@
4848
public class CopyMessage extends BotApiMethod<MessageId> {
4949
public static final String PATH = "copyMessage";
5050

51-
private static final String CHATID_FIELD = "chat_id";
52-
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
53-
private static final String FROMCHATID_FIELD = "from_chat_id";
54-
private static final String MESSAGEID_FIELD = "message_id";
51+
private static final String CHAT_ID_FIELD = "chat_id";
52+
private static final String MESSAGE_THREAD_ID_FIELD = "message_thread_id";
53+
private static final String FROM_CHAT_ID_FIELD = "from_chat_id";
54+
private static final String MESSAGE_ID_FIELD = "message_id";
5555
private static final String CAPTION_FIELD = "caption";
56-
private static final String PARSEMODE_FIELD = "parse_mode";
57-
private static final String CAPTIONENTITIES_FIELD = "caption_entities";
58-
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
59-
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
60-
private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply";
61-
private static final String REPLYMARKUP_FIELD = "reply_markup";
62-
private static final String PROTECTCONTENT_FIELD = "protect_content";
56+
private static final String PARSE_MODE_FIELD = "parse_mode";
57+
private static final String CAPTION_ENTITIES_FIELD = "caption_entities";
58+
private static final String DISABLE_NOTIFICATION_FIELD = "disable_notification";
59+
private static final String REPLY_TO_MESSAGE_ID_FIELD = "reply_to_message_id";
60+
private static final String ALLOW_SENDING_WITHOUT_REPLY_FIELD = "allow_sending_without_reply";
61+
private static final String REPLY_MARKUP_FIELD = "reply_markup";
62+
private static final String PROTECT_CONTENT_FIELD = "protect_content";
6363
private static final String REPLY_PARAMETERS_FIELD = "reply_parameters";
6464
private static final String SHOW_CAPTION_ABOVE_MEDIA_FIELD = "show_caption_above_media";
6565
private static final String ALLOW_PAID_BROADCAST_FIELD = "allow_paid_broadcast";
66+
private static final String VIDEO_START_TIMESTAMP_FIELD = "video_start_timestamp";
6667

67-
@JsonProperty(CHATID_FIELD)
68+
@JsonProperty(CHAT_ID_FIELD)
6869
@NonNull
6970
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
7071
/**
7172
* Unique identifier for the target message thread (topic) of the forum;
7273
* for forum supergroups only
7374
*/
74-
@JsonProperty(MESSAGETHREADID_FIELD)
75+
@JsonProperty(MESSAGE_THREAD_ID_FIELD)
7576
private Integer messageThreadId;
76-
@JsonProperty(FROMCHATID_FIELD)
77+
@JsonProperty(FROM_CHAT_ID_FIELD)
7778
@NonNull
7879
private String fromChatId; ///< Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
79-
@JsonProperty(MESSAGEID_FIELD)
80+
@JsonProperty(MESSAGE_ID_FIELD)
8081
@NonNull
8182
private Integer messageId; ///< Message identifier in the chat specified in from_chat_id
8283
@JsonProperty(CAPTION_FIELD)
8384
private String caption; ///< Optional. New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
84-
@JsonProperty(PARSEMODE_FIELD)
85+
@JsonProperty(PARSE_MODE_FIELD)
8586
private String parseMode; ///< Optional. Mode for parsing entities in the new caption. See formatting options for more details.
86-
@JsonProperty(CAPTIONENTITIES_FIELD)
87+
@JsonProperty(CAPTION_ENTITIES_FIELD)
8788
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the new caption, which can be specified instead of parse_mode
88-
@JsonProperty(DISABLENOTIFICATION_FIELD)
89+
@JsonProperty(DISABLE_NOTIFICATION_FIELD)
8990
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
90-
@JsonProperty(REPLYTOMESSAGEID_FIELD)
91+
@JsonProperty(REPLY_TO_MESSAGE_ID_FIELD)
9192
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
92-
@JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD)
93+
@JsonProperty(ALLOW_SENDING_WITHOUT_REPLY_FIELD)
9394
private Boolean allowSendingWithoutReply; ///< Optional. Pass True, if the message should be sent even if the specified replied-to message is not found
9495
/**
9596
* Optional.
9697
* Additional interface options.
9798
* A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or
9899
* to force a reply from the user.
99100
*/
100-
@JsonProperty(REPLYMARKUP_FIELD)
101+
@JsonProperty(REPLY_MARKUP_FIELD)
101102
private ReplyKeyboard replyMarkup;
102-
@JsonProperty(PROTECTCONTENT_FIELD)
103+
@JsonProperty(PROTECT_CONTENT_FIELD)
103104
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
104105
/**
105106
* Optional
@@ -120,6 +121,12 @@ public class CopyMessage extends BotApiMethod<MessageId> {
120121
*/
121122
@JsonProperty(ALLOW_PAID_BROADCAST_FIELD)
122123
private Boolean allowPaidBroadcast;
124+
/**
125+
* Optional
126+
* New start timestamp for the copied video in the message
127+
*/
128+
@JsonProperty(VIDEO_START_TIMESTAMP_FIELD)
129+
private Boolean videoStartTimestamp;
123130

124131
@Tolerate
125132
public void setChatId(@NonNull Long chatId) {

telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,27 @@
3838
public class ForwardMessage extends BotApiMethodMessage {
3939
public static final String PATH = "forwardmessage";
4040

41-
private static final String CHATID_FIELD = "chat_id";
42-
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
43-
private static final String FROMCHATID_FIELD = "from_chat_id";
44-
private static final String MESSAGEID_FIELD = "message_id";
45-
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
46-
private static final String PROTECTCONTENT_FIELD = "protect_content";
41+
private static final String CHAT_ID_FIELD = "chat_id";
42+
private static final String MESSAGE_THREAD_ID_FIELD = "message_thread_id";
43+
private static final String FROM_CHAT_ID_FIELD = "from_chat_id";
44+
private static final String MESSAGE_ID_FIELD = "message_id";
45+
private static final String DISABLE_NOTIFICATION_FIELD = "disable_notification";
46+
private static final String PROTECT_CONTENT_FIELD = "protect_content";
47+
private static final String VIDEO_START_TIMESTAMP_FIELD = "video_start_timestamp";
4748

48-
@JsonProperty(CHATID_FIELD)
49+
@JsonProperty(CHAT_ID_FIELD)
4950
@NonNull
5051
private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels)
5152
/**
5253
* Unique identifier for the target message thread (topic) of the forum;
5354
* for forum supergroups only
5455
*/
55-
@JsonProperty(MESSAGETHREADID_FIELD)
56+
@JsonProperty(MESSAGE_THREAD_ID_FIELD)
5657
private Integer messageThreadId;
57-
@JsonProperty(FROMCHATID_FIELD)
58+
@JsonProperty(FROM_CHAT_ID_FIELD)
5859
@NonNull
5960
private String fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id
60-
@JsonProperty(MESSAGEID_FIELD)
61+
@JsonProperty(MESSAGE_ID_FIELD)
6162
@NonNull
6263
private Integer messageId; ///< Unique message identifier
6364
/**
@@ -66,10 +67,16 @@ public class ForwardMessage extends BotApiMethodMessage {
6667
* Android users will receive a notification with no sound.
6768
* Other apps coming soon
6869
*/
69-
@JsonProperty(DISABLENOTIFICATION_FIELD)
70+
@JsonProperty(DISABLE_NOTIFICATION_FIELD)
7071
private Boolean disableNotification;
71-
@JsonProperty(PROTECTCONTENT_FIELD)
72+
@JsonProperty(PROTECT_CONTENT_FIELD)
7273
private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving
74+
/**
75+
* Optional
76+
* New start timestamp for the copied video in the message
77+
*/
78+
@JsonProperty(VIDEO_START_TIMESTAMP_FIELD)
79+
private Boolean videoStartTimestamp;
7380

7481
@Tolerate
7582
public void setChatId(@NonNull Long chatId) {

telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/gifts/GetAvailableGifts.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
/**
1616
* @author Ruben Bermudez
1717
* @version 8.0
18-
* Returns the list of gifts that can be sent by the bot to users.
18+
* Returns the list of gifts that can be sent by the bot to users and channel chats.
1919
* Requires no parameters.
20-
*
2120
* Returns a Gifts object.
2221
*/
2322
@EqualsAndHashCode(callSuper = false)

0 commit comments

Comments
 (0)