Skip to content

Commit 0e6168f

Browse files
authored
Merge pull request #389 from mircoianese/api_v7.6
BOT API v7.6
2 parents f501d8b + d908b0f commit 0e6168f

18 files changed

+536
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ Java library for interacting with [Telegram Bot API](https://core.telegram.org/b
1313

1414
Gradle:
1515
```groovy
16-
implementation 'com.github.pengrad:java-telegram-bot-api:7.4.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:7.6.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>7.4.0</version>
23+
<version>7.6.0</version>
2424
</dependency>
2525
```
2626
[JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases)

README_RU.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B
1313

1414
Gradle:
1515
```groovy
16-
implementation 'com.github.pengrad:java-telegram-bot-api:7.4.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:7.6.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>7.4.0</version>
23+
<version>7.6.0</version>
2424
</dependency>
2525
```
2626
Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases).

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.github.pengrad
2-
VERSION_NAME=7.4.0
2+
VERSION_NAME=7.6.0
33

44
POM_DESCRIPTION=Java API for Telegram Bot API
55
POM_URL=https://github.com/pengrad/java-telegram-bot-api/

library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public enum Type {
5959
private String invite_link;
6060
private Message pinned_message;
6161
private ChatPermissions permissions;
62+
private Boolean can_send_paid_media;
6263
private Integer slow_mode_delay;
6364
private Integer unrestrict_boost_count;
6465
private Integer message_auto_delete_time;
@@ -217,6 +218,9 @@ public Message pinnedMessage() {
217218
public ChatPermissions permissions() {
218219
return permissions;
219220
}
221+
public Boolean canSendPaidMedia() {
222+
return can_send_paid_media;
223+
}
220224

221225
public Integer slowModeDelay() {
222226
return slow_mode_delay;
@@ -296,6 +300,7 @@ public boolean equals(Object o) {
296300
Objects.equals(invite_link, chat.invite_link) &&
297301
Objects.equals(pinned_message, chat.pinned_message) &&
298302
Objects.equals(permissions, chat.permissions) &&
303+
Objects.equals(can_send_paid_media, chat.can_send_paid_media) &&
299304
Objects.equals(slow_mode_delay, chat.slow_mode_delay) &&
300305
Objects.equals(unrestrict_boost_count, chat.unrestrict_boost_count) &&
301306
Objects.equals(message_auto_delete_time, chat.message_auto_delete_time) &&
@@ -349,6 +354,7 @@ public String toString() {
349354
", invite_link='" + invite_link + '\'' +
350355
", pinned_message=" + pinned_message +
351356
", permissions=" + permissions +
357+
", can_send_paid_media=" + can_send_paid_media +
352358
", slow_mode_delay=" + slow_mode_delay +
353359
", unrestrict_boost_count=" + unrestrict_boost_count +
354360
", message_auto_delete_time=" + message_auto_delete_time +

library/src/main/java/com/pengrad/telegrambot/model/ExternalReplyInfo.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.pengrad.telegrambot.model.giveaway.Giveaway;
44
import com.pengrad.telegrambot.model.giveaway.GiveawayWinners;
55
import com.pengrad.telegrambot.model.message.origin.MessageOrigin;
6+
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
67

78
import java.io.Serializable;
89
import java.util.Arrays;
@@ -18,6 +19,7 @@ public class ExternalReplyInfo implements Serializable {
1819
private LinkPreviewOptions link_preview_options;
1920
private Animation animation;
2021
private Audio audio;
22+
private PaidMediaInfo paid_media;
2123
private Document document;
2224
private PhotoSize[] photo;
2325
private Sticker sticker;
@@ -60,6 +62,9 @@ public Audio audio() {
6062
return audio;
6163
}
6264

65+
public PaidMediaInfo paidMedia() {
66+
return paid_media;
67+
}
6368
public Document document() {
6469
return document;
6570
}
@@ -133,12 +138,12 @@ public boolean equals(Object o) {
133138
if (this == o) return true;
134139
if (o == null || getClass() != o.getClass()) return false;
135140
ExternalReplyInfo that = (ExternalReplyInfo) o;
136-
return Objects.equals(origin, that.origin) && Objects.equals(chat, that.chat) && Objects.equals(message_id, that.message_id) && Objects.equals(link_preview_options, that.link_preview_options) && Objects.equals(animation, that.animation) && Objects.equals(audio, that.audio) && Objects.equals(document, that.document) && Arrays.equals(photo, that.photo) && Objects.equals(sticker, that.sticker) && Objects.equals(story, that.story) && Objects.equals(video, that.video) && Objects.equals(video_note, that.video_note) && Objects.equals(voice, that.voice) && Objects.equals(has_media_spoiler, that.has_media_spoiler) && Objects.equals(contact, that.contact) && Objects.equals(dice, that.dice) && Objects.equals(game, that.game) && Objects.equals(giveaway, that.giveaway) && Objects.equals(giveaway_winners, that.giveaway_winners) && Objects.equals(invoice, that.invoice) && Objects.equals(location, that.location) && Objects.equals(poll, that.poll) && Objects.equals(venue, that.venue);
141+
return Objects.equals(origin, that.origin) && Objects.equals(chat, that.chat) && Objects.equals(message_id, that.message_id) && Objects.equals(link_preview_options, that.link_preview_options) && Objects.equals(animation, that.animation) && Objects.equals(audio, that.audio) && Objects.equals(paid_media, that.paid_media) && Objects.equals(document, that.document) && Arrays.equals(photo, that.photo) && Objects.equals(sticker, that.sticker) && Objects.equals(story, that.story) && Objects.equals(video, that.video) && Objects.equals(video_note, that.video_note) && Objects.equals(voice, that.voice) && Objects.equals(has_media_spoiler, that.has_media_spoiler) && Objects.equals(contact, that.contact) && Objects.equals(dice, that.dice) && Objects.equals(game, that.game) && Objects.equals(giveaway, that.giveaway) && Objects.equals(giveaway_winners, that.giveaway_winners) && Objects.equals(invoice, that.invoice) && Objects.equals(location, that.location) && Objects.equals(poll, that.poll) && Objects.equals(venue, that.venue);
137142
}
138143

139144
@Override
140145
public int hashCode() {
141-
int result = Objects.hash(origin, chat, message_id, link_preview_options, animation, audio, document, sticker, story, video, video_note, voice, has_media_spoiler, contact, dice, game, giveaway, giveaway_winners, invoice, location, poll, venue);
146+
int result = Objects.hash(origin, chat, message_id, link_preview_options, animation, audio, paid_media, document, sticker, story, video, video_note, voice, has_media_spoiler, contact, dice, game, giveaway, giveaway_winners, invoice, location, poll, venue);
142147
result = 31 * result + Arrays.hashCode(photo);
143148
return result;
144149
}
@@ -152,6 +157,7 @@ public String toString() {
152157
", link_preview_options=" + link_preview_options +
153158
", animation=" + animation +
154159
", audio=" + audio +
160+
", paid_media=" + paid_media +
155161
", document=" + document +
156162
", photo=" + Arrays.toString(photo) +
157163
", sticker=" + sticker +

library/src/main/java/com/pengrad/telegrambot/model/Message.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
66
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
77
import com.pengrad.telegrambot.model.message.origin.*;
8+
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
9+
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
810
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
911
import com.pengrad.telegrambot.passport.PassportData;
1012

@@ -46,6 +48,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
4648
private LinkPreviewOptions link_preview_options;
4749
private String effect_id;
4850
private Audio audio;
51+
private PaidMediaInfo paid_media;
4952
private Document document;
5053
private Animation animation;
5154
private Game game;
@@ -280,6 +283,10 @@ public Audio audio() {
280283
return audio;
281284
}
282285

286+
public PaidMediaInfo paidMedia() {
287+
return paid_media;
288+
}
289+
283290
public Document document() {
284291
return document;
285292
}
@@ -540,6 +547,7 @@ public boolean equals(Object o) {
540547
Objects.equals(link_preview_options, message.link_preview_options) &&
541548
Objects.equals(effect_id, message.effect_id) &&
542549
Objects.equals(audio, message.audio) &&
550+
Objects.equals(paid_media, message.paid_media) &&
543551
Objects.equals(document, message.document) &&
544552
Objects.equals(animation, message.animation) &&
545553
Objects.equals(game, message.game) &&
@@ -630,6 +638,7 @@ public String toString() {
630638
", link_preview_options=" + link_preview_options +
631639
", effect_id=" + effect_id +
632640
", audio=" + audio +
641+
", paid_media=" + paid_media +
633642
", document=" + document +
634643
", animation=" + animation +
635644
", game=" + game +
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.pengrad.telegrambot.model.paidmedia;
2+
3+
import java.io.Serializable;
4+
import java.util.Objects;
5+
6+
public abstract class PaidMedia implements Serializable {
7+
8+
private final static long serialVersionUID = 0L;
9+
10+
private String type;
11+
12+
public PaidMedia(String type) {
13+
this.type = type;
14+
}
15+
16+
public String type() {
17+
return type;
18+
}
19+
20+
@Override
21+
public boolean equals(Object o) {
22+
if (this == o) return true;
23+
if (o == null || getClass() != o.getClass()) return false;
24+
25+
PaidMedia that = (PaidMedia) o;
26+
return Objects.equals(type, that.type);
27+
}
28+
29+
@Override
30+
public int hashCode() {
31+
return Objects.hash(type);
32+
}
33+
34+
@Override
35+
public String toString() {
36+
return "PaidMedia{" +
37+
"type='" + type + "'" +
38+
'}';
39+
}
40+
41+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.pengrad.telegrambot.model.paidmedia;
2+
3+
import java.io.Serializable;
4+
import java.util.Arrays;
5+
import java.util.Objects;
6+
7+
public class PaidMediaInfo implements Serializable {
8+
9+
private final static long serialVersionUID = 0L;
10+
11+
private Integer star_count;
12+
13+
private PaidMedia[] paid_media;
14+
15+
public Integer starCount() {
16+
return star_count;
17+
}
18+
19+
public PaidMedia[] paidMedia() {
20+
return paid_media;
21+
}
22+
23+
@Override
24+
public boolean equals(Object o) {
25+
if (this == o) return true;
26+
if (o == null || getClass() != o.getClass()) return false;
27+
28+
PaidMediaInfo that = (PaidMediaInfo) o;
29+
return Objects.equals(star_count, that.star_count) &&
30+
Arrays.equals(paid_media, that.paid_media);
31+
}
32+
33+
@Override
34+
public int hashCode() {
35+
return Objects.hash(star_count, paid_media);
36+
}
37+
38+
@Override
39+
public String toString() {
40+
return "PaidMediaInfo{" +
41+
"star_count='" + star_count + "'," +
42+
"paid_media='" + Arrays.toString(paid_media) + "'" +
43+
'}';
44+
}
45+
46+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.pengrad.telegrambot.model.paidmedia;
2+
3+
import com.pengrad.telegrambot.model.PhotoSize;
4+
5+
import java.util.Arrays;
6+
import java.util.Objects;
7+
8+
public class PaidMediaPhoto extends PaidMedia {
9+
10+
public final static String TYPE = "photo";
11+
12+
private PhotoSize[] photo;
13+
14+
public PaidMediaPhoto() {
15+
super(TYPE);
16+
}
17+
18+
public PhotoSize[] getPhoto() {
19+
return photo;
20+
}
21+
22+
@Override
23+
public boolean equals(Object o) {
24+
if (this == o) return true;
25+
if (o == null || getClass() != o.getClass()) return false;
26+
PaidMediaPhoto that = (PaidMediaPhoto) o;
27+
return Objects.equals(type(), that.type()) &&
28+
Arrays.equals(photo, that.photo);
29+
}
30+
31+
@Override
32+
public int hashCode() {
33+
return Objects.hash(type(), photo);
34+
}
35+
36+
@Override
37+
public String toString() {
38+
return "PaidMediaPhoto{" +
39+
"type='" + type() + "\'," +
40+
", photo=" + Arrays.toString(photo) + "\'" +
41+
'}';
42+
}
43+
44+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.pengrad.telegrambot.model.paidmedia;
2+
3+
import java.util.Objects;
4+
5+
public class PaidMediaPreview extends PaidMedia {
6+
7+
public final static String TYPE = "preview";
8+
9+
private Integer width;
10+
11+
private Integer height;
12+
13+
private Integer duration;
14+
15+
public PaidMediaPreview() {
16+
super(TYPE);
17+
}
18+
19+
public Integer getWidth() {
20+
return width;
21+
}
22+
23+
public Integer getHeight() {
24+
return height;
25+
}
26+
27+
public Integer getDuration() {
28+
return duration;
29+
}
30+
31+
@Override
32+
public boolean equals(Object o) {
33+
if (this == o) return true;
34+
if (o == null || getClass() != o.getClass()) return false;
35+
PaidMediaPreview that = (PaidMediaPreview) o;
36+
return Objects.equals(type(), that.type()) &&
37+
Objects.equals(width, that.width) &&
38+
Objects.equals(height, that.height) &&
39+
Objects.equals(duration, that.duration);
40+
}
41+
42+
@Override
43+
public int hashCode() {
44+
return Objects.hash(type(), width, height, duration);
45+
}
46+
47+
@Override
48+
public String toString() {
49+
return "PaidMediaPreview{" +
50+
"type='" + type() + "\'," +
51+
", width=" + width + "\'," +
52+
", height=" + height + "\'," +
53+
", duration=" + duration + "\'" +
54+
'}';
55+
}
56+
57+
}

0 commit comments

Comments
 (0)