Skip to content

Commit cdfd85c

Browse files
authoredAug 20, 2024··
Merge pull request #394 from mircoianese/api_v7.9
BOT API v7.9
2 parents ba791f7 + 742a401 commit cdfd85c

15 files changed

+123
-18
lines changed
 

‎README.md

+3-3
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 7.8 methods
7+
- Full support of all Bot API 7.9 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:7.8.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:7.9.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>7.8.0</version>
23+
<version>7.9.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

+3-3
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 7.8
7+
- Полная поддержка всех методов BOT API 7.9
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:7.8.0'
16+
implementation 'com.github.pengrad:java-telegram-bot-api:7.9.0'
1717
```
1818
Maven:
1919
```xml
2020
<dependency>
2121
<groupId>com.github.pengrad</groupId>
2222
<artifactId>java-telegram-bot-api</artifactId>
23-
<version>7.8.0</version>
23+
<version>7.9.0</version>
2424
</dependency>
2525
```
2626
Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases).

‎gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.github.pengrad
2-
VERSION_NAME=7.8.0
2+
VERSION_NAME=7.9.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/chatbackground/BackgroundFillFreeformGradient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.Arrays;
44

5-
public class BackgroundFillFreeformGradient extends BackgroundType {
5+
public class BackgroundFillFreeformGradient extends BackgroundFill {
66

77
public static final String TYPE = "freeform_gradient";
88

‎library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillGradient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.Objects;
44

5-
public class BackgroundFillGradient extends BackgroundType {
5+
public class BackgroundFillGradient extends BackgroundFill {
66

77
public static final String TYPE = "gradient";
88

‎library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillSolid.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.Objects;
44

5-
public class BackgroundFillSolid extends BackgroundType {
5+
public class BackgroundFillSolid extends BackgroundFill {
66

77
public static final String TYPE = "solid";
88

‎library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeCustomEmoji.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public int hashCode() {
3838
public String toString() {
3939
return "ReactionTypeCustomEmoji{" +
4040
"type='" + type() + '\'' +
41-
"custom_emoji_id='" + custom_emoji_id + '\'' +
41+
",custom_emoji_id='" + custom_emoji_id + '\'' +
4242
'}';
4343
}
4444
}

‎library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeEmoji.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public int hashCode() {
3838
public String toString() {
3939
return "ReactionTypeEmoji{" +
4040
"type='" + type() + '\'' +
41-
"emoji='" + emoji + '\'' +
41+
",emoji='" + emoji + '\'' +
4242
'}';
4343
}
4444
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.pengrad.telegrambot.model.reaction;
2+
3+
import java.util.Objects;
4+
5+
public class ReactionTypePaid extends ReactionType {
6+
7+
public static final String PAID_TYPE = "paid";
8+
9+
public ReactionTypePaid() {
10+
super(PAID_TYPE);
11+
}
12+
13+
@Override
14+
public boolean equals(Object o) {
15+
if (this == o) return true;
16+
if (o == null || getClass() != o.getClass()) return false;
17+
18+
return true;
19+
}
20+
21+
@Override
22+
public String toString() {
23+
return "ReactionTypePaid{" +
24+
"type='" + type() + '\'' +
25+
'}';
26+
}
27+
}

‎library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.pengrad.telegrambot.model.User;
44
import com.pengrad.telegrambot.model.chatbackground.BackgroundFillFreeformGradient;
5+
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
56

67
import java.util.Arrays;
78
import java.util.Objects;
@@ -12,6 +13,7 @@ public class TransactionPartnerUser extends TransactionPartner {
1213

1314
private User user;
1415
private String invoice_payload;
16+
private PaidMedia[] paid_media;
1517

1618
public TransactionPartnerUser() {
1719
super(TYPE);
@@ -25,27 +27,31 @@ public String invoicePayload() {
2527
return invoice_payload;
2628
}
2729

30+
public PaidMedia[] paidMedia() {
31+
return paid_media;
32+
}
33+
2834
@Override
2935
public boolean equals(Object o) {
3036
if (this == o) return true;
3137
if (o == null || getClass() != o.getClass()) return false;
38+
if (!super.equals(o)) return false;
3239
TransactionPartnerUser that = (TransactionPartnerUser) o;
33-
return Objects.equals(type(), that.type()) &&
34-
Objects.equals(user, that.user) &&
35-
Objects.equals(invoice_payload, that.invoice_payload);
40+
return Objects.equals(user, that.user) && Objects.equals(invoice_payload, that.invoice_payload) && Objects.deepEquals(paid_media, that.paid_media);
3641
}
3742

3843
@Override
3944
public int hashCode() {
40-
return Objects.hash(type(), user, invoice_payload);
45+
return Objects.hash(super.hashCode(), user, invoice_payload, Arrays.hashCode(paid_media));
4146
}
4247

4348
@Override
4449
public String toString() {
4550
return "TransactionPartnerUser{" +
4651
"type='" + type() + "\'," +
4752
", user=" + user + "\'," +
48-
", invoice_payload=" + invoice_payload + "\'" +
53+
", invoice_payload=" + invoice_payload + "\'," +
54+
", paid_media=" + paid_media + "\'" +
4955
'}';
5056
}
5157

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.pengrad.telegrambot.request;
2+
3+
import com.pengrad.telegrambot.response.ChatInviteLinkResponse;
4+
5+
/**
6+
* Stas Parshin
7+
* 10 March 2021
8+
*/
9+
public class CreateChatSubscriptionInviteLink extends BaseRequest<CreateChatSubscriptionInviteLink, ChatInviteLinkResponse> {
10+
11+
/**
12+
* Create a subscription invite link for a channel chat.
13+
*
14+
* @param chatId Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
15+
* @param subscriptionPeriod The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
16+
* @param subscriptionPrice The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500
17+
*/
18+
public CreateChatSubscriptionInviteLink(Object chatId, Integer subscriptionPeriod, Integer subscriptionPrice) {
19+
super(ChatInviteLinkResponse.class);
20+
add("chat_id", chatId);
21+
add("subscription_period", subscriptionPeriod);
22+
add("subscription_price", subscriptionPrice);
23+
}
24+
25+
/**
26+
*
27+
* @param name Invite link name; 0-32 characters
28+
*/
29+
public CreateChatSubscriptionInviteLink name(String name) {
30+
return add("name", name);
31+
}
32+
33+
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.pengrad.telegrambot.request;
2+
3+
import com.pengrad.telegrambot.response.ChatInviteLinkResponse;
4+
5+
/**
6+
* Stas Parshin
7+
* 10 March 2021
8+
*/
9+
public class EditChatSubscriptionInviteLink extends BaseRequest<EditChatSubscriptionInviteLink, ChatInviteLinkResponse> {
10+
11+
/**
12+
* Edit a subscription invite link created by the bot
13+
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
14+
* @param inviteLink The invite link to edit
15+
*/
16+
public EditChatSubscriptionInviteLink(Object chatId, String inviteLink) {
17+
super(ChatInviteLinkResponse.class);
18+
add("chat_id", chatId);
19+
add("invite_link", inviteLink);
20+
}
21+
22+
/**
23+
*
24+
* @param name Invite link name; 0-32 characters
25+
* @return
26+
*/
27+
public EditChatSubscriptionInviteLink name(String name) {
28+
return add("name", name);
29+
}
30+
31+
}

‎library/src/main/java/com/pengrad/telegrambot/request/SendPaidMedia.java

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public SendPaidMedia replyParameters(ReplyParameters replyParameters) {
4444
return add("reply_parameters", replyParameters);
4545
}
4646

47+
public SendPaidMedia businessConnectionId(String businessConnectionId) {
48+
return add("business_connection_id", businessConnectionId);
49+
}
50+
4751
public SendPaidMedia replyMarkup(InlineKeyboardMarkup replyMarkup) {
4852
return add("reply_markup", replyMarkup);
4953
}

‎library/src/main/java/com/pengrad/telegrambot/utility/gson/ReactionTypeAdapter.java

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.pengrad.telegrambot.model.reaction.ReactionType;
55
import com.pengrad.telegrambot.model.reaction.ReactionTypeCustomEmoji;
66
import com.pengrad.telegrambot.model.reaction.ReactionTypeEmoji;
7+
import com.pengrad.telegrambot.model.reaction.ReactionTypePaid;
78

89
import java.lang.reflect.Type;
910

@@ -19,6 +20,8 @@ public ReactionType deserialize(JsonElement element, Type type, JsonDeserializat
1920
return context.deserialize(object, ReactionTypeEmoji.class);
2021
} else if (ReactionTypeCustomEmoji.CUSTOM_EMOJI_TYPE.equals(discriminator)) {
2122
return context.deserialize(object, ReactionTypeCustomEmoji.class);
23+
} else if (ReactionTypePaid.PAID_TYPE.equals(discriminator)) {
24+
return context.deserialize(object, ReactionTypePaid.class);
2225
}
2326

2427
return new ReactionType(discriminator);

‎pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<modelVersion>4.0.0</modelVersion>
1010
<groupId>com.github.pengrad</groupId>
1111
<artifactId>java-telegram-bot-api</artifactId>
12-
<version>7.8.0</version>
12+
<version>7.9.0</version>
1313
<name>JavaTelegramBotApi</name>
1414
<description>Java API for Telegram Bot API</description>
1515
<url>https://github.com/pengrad/java-telegram-bot-api/</url>

0 commit comments

Comments
 (0)
Please sign in to comment.