Skip to content

Commit 249c6f4

Browse files
authored
Merge pull request #424 from mircoianese/api_9.0
BOT API v9.0
2 parents eed98af + 7b9cfd1 commit 249c6f4

File tree

62 files changed

+1095
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1095
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
55

66
Java library for interacting with [Telegram Bot API](https://core.telegram.org/bots/api)
7-
- Full support of all Bot API 8.3 methods
7+
- Full support of all Bot API 9.0 methods
88
- Telegram [Passport](https://core.telegram.org/passport) and Decryption API
99
- Bot [Payments](https://core.telegram.org/bots/payments)
1010
- [Gaming Platform](https://telegram.org/blog/games)
@@ -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:8.3.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:9.0.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>8.3.0</version>
23+
<version>9.0.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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
55

66
Java библиотека, созданная для работы с [Telegram Bot API](https://core.telegram.org/bots/api)
7-
- Полная поддержка всех методов BOT API 8.3
7+
- Полная поддержка всех методов BOT API 9.0
88
- Поддержка Telegram [паспорта](https://core.telegram.org/passport) и дешифровки (Decryption API);
99
- Поддержка [платежей](https://core.telegram.org/bots/payments);
1010
- [Игровая платформа](https://telegram.org/blog/games).
@@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B
1313

1414
Gradle:
1515
```groovy
16-
implementation 'com.github.pengrad:java-telegram-bot-api:8.3.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:9.0.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>8.3.0</version>
23+
<version>9.0.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=8.3.0
2+
VERSION_NAME=9.0.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: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.pengrad.telegrambot.model.business.BusinessIntro;
55
import com.pengrad.telegrambot.model.business.BusinessLocation;
66
import com.pengrad.telegrambot.model.business.BusinessOpeningHours;
7+
import com.pengrad.telegrambot.model.gift.AcceptedGiftTypes;
78
import com.pengrad.telegrambot.model.reaction.ReactionType;
89

910

@@ -71,6 +72,7 @@ public enum Type {
7172
private Long linked_chat_id;
7273
private ChatLocation location;
7374
private Boolean can_send_gift;
75+
private AcceptedGiftTypes accepted_gift_types;
7476

7577
public Long id() {
7678
return id;
@@ -247,10 +249,19 @@ public ChatLocation location() {
247249
return location;
248250
}
249251

252+
/**
253+
*
254+
* @deprecated Use 'acceptedGiftTypes' instead
255+
*/
256+
@Deprecated
250257
public Boolean canSendGift() {
251258
return can_send_gift;
252259
}
253260

261+
public AcceptedGiftTypes acceptedGiftTypes() {
262+
return accepted_gift_types;
263+
}
264+
254265
@Override
255266
public boolean equals(Object o) {
256267
if (this == o) return true;
@@ -300,7 +311,7 @@ public boolean equals(Object o) {
300311
Objects.equals(custom_emoji_sticker_set_name, chat.custom_emoji_sticker_set_name) &&
301312
Objects.equals(linked_chat_id, chat.linked_chat_id) &&
302313
Objects.equals(location, chat.location) &&
303-
Objects.equals(can_send_gift, chat.can_send_gift);
314+
Objects.equals(accepted_gift_types, chat.accepted_gift_types);
304315
}
305316

306317
@Override
@@ -355,7 +366,7 @@ public String toString() {
355366
", custom_emoji_sticker_set_name=" + custom_emoji_sticker_set_name +
356367
", linked_chat_id=" + linked_chat_id +
357368
", location=" + location +
358-
", can_send_gift=" + can_send_gift +
369+
", accepted_gift_types=" + accepted_gift_types +
359370
'}';
360371
}
361372
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.pengrad.telegrambot.model
2+
3+
@Suppress("unused")
4+
class LocationAddress private constructor(
5+
@get:JvmName("countryCode") val countryCode: String,
6+
@get:JvmName("state") var state: String?,
7+
@get:JvmName("city") var city: String?,
8+
@get:JvmName("street") var street: String?
9+
) {
10+
11+
constructor(countryCode: String) : this(
12+
countryCode = countryCode,
13+
state = null,
14+
city = null,
15+
street = null
16+
)
17+
18+
fun state(state: String) = apply {
19+
this.state = state
20+
}
21+
22+
fun city(city: String) = apply {
23+
this.city = city
24+
}
25+
26+
fun street(street: String) = apply {
27+
this.street = street
28+
}
29+
30+
}

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.pengrad.telegrambot.model.chatbackground.ChatBackground;
44
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
5+
import com.pengrad.telegrambot.model.gift.GiftInfo;
6+
import com.pengrad.telegrambot.model.gift.unique.UniqueGiftInfo;
57
import com.pengrad.telegrambot.model.giveaway.Giveaway;
68
import com.pengrad.telegrambot.model.giveaway.GiveawayCompleted;
79
import com.pengrad.telegrambot.model.giveaway.GiveawayCreated;
@@ -105,6 +107,10 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
105107
private VideoChatScheduled video_chat_scheduled;
106108
private InlineKeyboardMarkup reply_markup;
107109
private WebAppData web_app_data;
110+
private GiftInfo gift;
111+
private UniqueGiftInfo unique_gift;
112+
private PaidMessagePriceChanged paid_message_price_changed;
113+
private Integer paid_star_count;
108114

109115
public Integer messageThreadId() {
110116
return message_thread_id;
@@ -435,6 +441,22 @@ public WebAppData webAppData() {
435441
return web_app_data;
436442
}
437443

444+
public GiftInfo gift() {
445+
return gift;
446+
}
447+
448+
public UniqueGiftInfo uniqueGift() {
449+
return unique_gift;
450+
}
451+
452+
public PaidMessagePriceChanged paidMessagePriceChanged() {
453+
return paid_message_price_changed;
454+
}
455+
456+
public Integer paidStarCount() {
457+
return paid_star_count;
458+
}
459+
438460
/**
439461
* Only for backwards-compatibility with MaybeInaccessibleMessage
440462
*/
@@ -545,7 +567,11 @@ public boolean equals(Object o) {
545567
Objects.equals(video_chat_participants_invited, message.video_chat_participants_invited) &&
546568
Objects.equals(video_chat_scheduled, message.video_chat_scheduled) &&
547569
Objects.equals(reply_markup, message.reply_markup) &&
548-
Objects.equals(web_app_data, message.web_app_data);
570+
Objects.equals(web_app_data, message.web_app_data) &&
571+
Objects.equals(gift, message.gift) &&
572+
Objects.equals(unique_gift, message.unique_gift) &&
573+
Objects.equals(paid_message_price_changed, message.paid_message_price_changed) &&
574+
Objects.equals(paid_star_count, message.paid_star_count);
549575
}
550576

551577
@Override
@@ -641,6 +667,10 @@ public String toString() {
641667
", video_chat_scheduled=" + video_chat_scheduled +
642668
", reply_markup=" + reply_markup +
643669
", web_app_data=" + web_app_data +
670+
", gift=" + gift +
671+
", unique_gift=" + unique_gift +
672+
", paid_message_price_changed=" + paid_message_price_changed +
673+
", paid_star_count=" + paid_star_count +
644674
'}';
645675
}
646676
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.pengrad.telegrambot.model
2+
3+
data class PaidMessagePriceChanged(
4+
@get:JvmName("prizeStarCount") val prizeStarCount: Int
5+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.pengrad.telegrambot.model.business
2+
3+
data class BusinessBotRights(
4+
@get:JvmName("canReply") val canReply: Boolean,
5+
@get:JvmName("canReadMessages") val canReadMessages: Boolean,
6+
@get:JvmName("canDeleteSentMessages") val canDeleteSentMessages: Boolean,
7+
@get:JvmName("canDeleteAllMessages") val canDeleteAllMessages: Boolean,
8+
@get:JvmName("canEditName") val canEditName: Boolean,
9+
@get:JvmName("canEditBio") val canEditBio: Boolean,
10+
@get:JvmName("canEditProfilePhoto") val canEditProfilePhoto: Boolean,
11+
@get:JvmName("canEditUsername") val canEditUsername: Boolean,
12+
@get:JvmName("canChangeGiftSettings") val canChangeGiftSettings: Boolean,
13+
@get:JvmName("canViewGiftsAndStars") val canViewGiftsAndStars: Boolean,
14+
@get:JvmName("canConvertGiftsToStars") val canConvertGiftsToStars: Boolean,
15+
@get:JvmName("canTransferAndUpgradeGifts") val canTransferAndUpgradeGifts: Boolean,
16+
@get:JvmName("canTransferStars") val canTransferStars: Boolean,
17+
@get:JvmName("canManageStories") val canManageStories: Boolean,
18+
) {
19+
20+
}

library/src/main/java/com/pengrad/telegrambot/model/business/BusinessConnection.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class BusinessConnection {
1010
private User user;
1111
private Long user_chat_id;
1212
private Integer date;
13+
private BusinessBotRights rights;
1314
private Boolean can_reply;
1415
private Boolean is_enabled;
1516

@@ -29,10 +30,18 @@ public Integer date() {
2930
return date;
3031
}
3132

33+
/**
34+
* @deprecated Use the 'rights' field instead.
35+
*/
36+
@Deprecated
3237
public Boolean canReply() {
3338
return can_reply;
3439
}
3540

41+
public BusinessBotRights rights() {
42+
return rights;
43+
}
44+
3645
public Boolean isEnabled() {
3746
return is_enabled;
3847
}
@@ -42,12 +51,12 @@ public boolean equals(Object o) {
4251
if (this == o) return true;
4352
if (o == null || getClass() != o.getClass()) return false;
4453
BusinessConnection that = (BusinessConnection) o;
45-
return Objects.equals(id, that.id) && Objects.equals(user, that.user) && Objects.equals(user_chat_id, that.user_chat_id) && Objects.equals(date, that.date) && Objects.equals(can_reply, that.can_reply) && Objects.equals(is_enabled, that.is_enabled);
54+
return Objects.equals(id, that.id) && Objects.equals(user, that.user) && Objects.equals(user_chat_id, that.user_chat_id) && Objects.equals(date, that.date) && Objects.equals(rights, that.rights) && Objects.equals(is_enabled, that.is_enabled);
4655
}
4756

4857
@Override
4958
public int hashCode() {
50-
return Objects.hash(id, user, user_chat_id, date, can_reply, is_enabled);
59+
return Objects.hash(id, user, user_chat_id, date, rights, is_enabled);
5160
}
5261

5362
@Override
@@ -57,7 +66,7 @@ public String toString() {
5766
", user=" + user +
5867
", user_chat_id=" + user_chat_id +
5968
", date=" + date +
60-
", can_reply=" + can_reply +
69+
", rights=" + rights +
6170
", is_enabled=" + is_enabled +
6271
'}';
6372
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.pengrad.telegrambot.model.gift
2+
3+
data class AcceptedGiftTypes(
4+
@get:JvmName("unlimitedGifts") val unlimitedGifts: Boolean,
5+
@get:JvmName("limitedGifts") val limitedGifts: Boolean,
6+
@get:JvmName("uniqueGifts") val uniqueGifts: Boolean,
7+
@get:JvmName("premiumSubscription") val premiumSubscription: Boolean
8+
)

0 commit comments

Comments
 (0)