diff --git a/README.md b/README.md
index 1efbb193..240a31c4 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
Java library for interacting with [Telegram Bot API](https://core.telegram.org/bots/api)
-- Full support of all Bot API 7.8 methods
+- Full support of all Bot API 7.9 methods
- Telegram [Passport](https://core.telegram.org/passport) and Decryption API
- Bot [Payments](https://core.telegram.org/bots/payments)
- [Gaming Platform](https://telegram.org/blog/games)
@@ -13,14 +13,14 @@ Java library for interacting with [Telegram Bot API](https://core.telegram.org/b
Gradle:
```groovy
-implementation 'com.github.pengrad:java-telegram-bot-api:7.8.0'
+implementation 'com.github.pengrad:java-telegram-bot-api:7.9.0'
```
Maven:
```xml
com.github.pengrad
java-telegram-bot-api
- 7.8.0
+ 7.9.0
```
[JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases)
diff --git a/README_RU.md b/README_RU.md
index 441cb57b..b16717d4 100644
--- a/README_RU.md
+++ b/README_RU.md
@@ -4,7 +4,7 @@
[![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api)
Java библиотека, созданная для работы с [Telegram Bot API](https://core.telegram.org/bots/api)
-- Полная поддержка всех методов BOT API 7.8
+- Полная поддержка всех методов BOT API 7.9
- Поддержка Telegram [паспорта](https://core.telegram.org/passport) и дешифровки (Decryption API);
- Поддержка [платежей](https://core.telegram.org/bots/payments);
- [Игровая платформа](https://telegram.org/blog/games).
@@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B
Gradle:
```groovy
-implementation 'com.github.pengrad:java-telegram-bot-api:7.8.0'
+implementation 'com.github.pengrad:java-telegram-bot-api:7.9.0'
```
Maven:
```xml
com.github.pengrad
java-telegram-bot-api
- 7.8.0
+ 7.9.0
```
Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases).
diff --git a/gradle.properties b/gradle.properties
index a28484c3..1f3caea1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,5 @@
GROUP=com.github.pengrad
-VERSION_NAME=7.8.0
+VERSION_NAME=7.9.0
POM_DESCRIPTION=Java API for Telegram Bot API
POM_URL=https://github.com/pengrad/java-telegram-bot-api/
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillFreeformGradient.java b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillFreeformGradient.java
index d21395a1..a13ca915 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillFreeformGradient.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillFreeformGradient.java
@@ -2,7 +2,7 @@
import java.util.Arrays;
-public class BackgroundFillFreeformGradient extends BackgroundType {
+public class BackgroundFillFreeformGradient extends BackgroundFill {
public static final String TYPE = "freeform_gradient";
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillGradient.java b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillGradient.java
index 4f4ca482..6f79e8d6 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillGradient.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillGradient.java
@@ -2,7 +2,7 @@
import java.util.Objects;
-public class BackgroundFillGradient extends BackgroundType {
+public class BackgroundFillGradient extends BackgroundFill {
public static final String TYPE = "gradient";
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillSolid.java b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillSolid.java
index 5353b0b1..7d9de04d 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillSolid.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/chatbackground/BackgroundFillSolid.java
@@ -2,7 +2,7 @@
import java.util.Objects;
-public class BackgroundFillSolid extends BackgroundType {
+public class BackgroundFillSolid extends BackgroundFill {
public static final String TYPE = "solid";
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeCustomEmoji.java b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeCustomEmoji.java
index e77b1f35..9c8f5c58 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeCustomEmoji.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeCustomEmoji.java
@@ -38,7 +38,7 @@ public int hashCode() {
public String toString() {
return "ReactionTypeCustomEmoji{" +
"type='" + type() + '\'' +
- "custom_emoji_id='" + custom_emoji_id + '\'' +
+ ",custom_emoji_id='" + custom_emoji_id + '\'' +
'}';
}
}
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeEmoji.java b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeEmoji.java
index 91d6faae..663f6e25 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeEmoji.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypeEmoji.java
@@ -38,7 +38,7 @@ public int hashCode() {
public String toString() {
return "ReactionTypeEmoji{" +
"type='" + type() + '\'' +
- "emoji='" + emoji + '\'' +
+ ",emoji='" + emoji + '\'' +
'}';
}
}
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypePaid.java b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypePaid.java
new file mode 100644
index 00000000..d364ac83
--- /dev/null
+++ b/library/src/main/java/com/pengrad/telegrambot/model/reaction/ReactionTypePaid.java
@@ -0,0 +1,27 @@
+package com.pengrad.telegrambot.model.reaction;
+
+import java.util.Objects;
+
+public class ReactionTypePaid extends ReactionType {
+
+ public static final String PAID_TYPE = "paid";
+
+ public ReactionTypePaid() {
+ super(PAID_TYPE);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ReactionTypePaid{" +
+ "type='" + type() + '\'' +
+ '}';
+ }
+}
diff --git a/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.java b/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.java
index 86b931e6..391764d2 100644
--- a/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.java
+++ b/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.java
@@ -2,6 +2,7 @@
import com.pengrad.telegrambot.model.User;
import com.pengrad.telegrambot.model.chatbackground.BackgroundFillFreeformGradient;
+import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
import java.util.Arrays;
import java.util.Objects;
@@ -12,6 +13,7 @@ public class TransactionPartnerUser extends TransactionPartner {
private User user;
private String invoice_payload;
+ private PaidMedia[] paid_media;
public TransactionPartnerUser() {
super(TYPE);
@@ -25,19 +27,22 @@ public String invoicePayload() {
return invoice_payload;
}
+ public PaidMedia[] paidMedia() {
+ return paid_media;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
+ if (!super.equals(o)) return false;
TransactionPartnerUser that = (TransactionPartnerUser) o;
- return Objects.equals(type(), that.type()) &&
- Objects.equals(user, that.user) &&
- Objects.equals(invoice_payload, that.invoice_payload);
+ return Objects.equals(user, that.user) && Objects.equals(invoice_payload, that.invoice_payload) && Objects.deepEquals(paid_media, that.paid_media);
}
@Override
public int hashCode() {
- return Objects.hash(type(), user, invoice_payload);
+ return Objects.hash(super.hashCode(), user, invoice_payload, Arrays.hashCode(paid_media));
}
@Override
@@ -45,7 +50,8 @@ public String toString() {
return "TransactionPartnerUser{" +
"type='" + type() + "\'," +
", user=" + user + "\'," +
- ", invoice_payload=" + invoice_payload + "\'" +
+ ", invoice_payload=" + invoice_payload + "\'," +
+ ", paid_media=" + paid_media + "\'" +
'}';
}
diff --git a/library/src/main/java/com/pengrad/telegrambot/request/CreateChatSubscriptionInviteLink.java b/library/src/main/java/com/pengrad/telegrambot/request/CreateChatSubscriptionInviteLink.java
new file mode 100644
index 00000000..b1d14d9a
--- /dev/null
+++ b/library/src/main/java/com/pengrad/telegrambot/request/CreateChatSubscriptionInviteLink.java
@@ -0,0 +1,34 @@
+package com.pengrad.telegrambot.request;
+
+import com.pengrad.telegrambot.response.ChatInviteLinkResponse;
+
+/**
+ * Stas Parshin
+ * 10 March 2021
+ */
+public class CreateChatSubscriptionInviteLink extends BaseRequest {
+
+ /**
+ * Create a subscription invite link for a channel chat.
+ *
+ * @param chatId Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
+ * @param subscriptionPeriod The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
+ * @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
+ */
+ public CreateChatSubscriptionInviteLink(Object chatId, Integer subscriptionPeriod, Integer subscriptionPrice) {
+ super(ChatInviteLinkResponse.class);
+ add("chat_id", chatId);
+ add("subscription_period", subscriptionPeriod);
+ add("subscription_price", subscriptionPrice);
+ }
+
+ /**
+ *
+ * @param name Invite link name; 0-32 characters
+ */
+ public CreateChatSubscriptionInviteLink name(String name) {
+ return add("name", name);
+ }
+
+
+}
diff --git a/library/src/main/java/com/pengrad/telegrambot/request/EditChatSubscriptionInviteLink.java b/library/src/main/java/com/pengrad/telegrambot/request/EditChatSubscriptionInviteLink.java
new file mode 100644
index 00000000..deae7d59
--- /dev/null
+++ b/library/src/main/java/com/pengrad/telegrambot/request/EditChatSubscriptionInviteLink.java
@@ -0,0 +1,31 @@
+package com.pengrad.telegrambot.request;
+
+import com.pengrad.telegrambot.response.ChatInviteLinkResponse;
+
+/**
+ * Stas Parshin
+ * 10 March 2021
+ */
+public class EditChatSubscriptionInviteLink extends BaseRequest {
+
+ /**
+ * Edit a subscription invite link created by the bot
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param inviteLink The invite link to edit
+ */
+ public EditChatSubscriptionInviteLink(Object chatId, String inviteLink) {
+ super(ChatInviteLinkResponse.class);
+ add("chat_id", chatId);
+ add("invite_link", inviteLink);
+ }
+
+ /**
+ *
+ * @param name Invite link name; 0-32 characters
+ * @return
+ */
+ public EditChatSubscriptionInviteLink name(String name) {
+ return add("name", name);
+ }
+
+}
diff --git a/library/src/main/java/com/pengrad/telegrambot/request/SendPaidMedia.java b/library/src/main/java/com/pengrad/telegrambot/request/SendPaidMedia.java
index b5804650..d8e81dd1 100644
--- a/library/src/main/java/com/pengrad/telegrambot/request/SendPaidMedia.java
+++ b/library/src/main/java/com/pengrad/telegrambot/request/SendPaidMedia.java
@@ -44,6 +44,10 @@ public SendPaidMedia replyParameters(ReplyParameters replyParameters) {
return add("reply_parameters", replyParameters);
}
+ public SendPaidMedia businessConnectionId(String businessConnectionId) {
+ return add("business_connection_id", businessConnectionId);
+ }
+
public SendPaidMedia replyMarkup(InlineKeyboardMarkup replyMarkup) {
return add("reply_markup", replyMarkup);
}
diff --git a/library/src/main/java/com/pengrad/telegrambot/utility/gson/ReactionTypeAdapter.java b/library/src/main/java/com/pengrad/telegrambot/utility/gson/ReactionTypeAdapter.java
index a175ff89..d8759f0e 100644
--- a/library/src/main/java/com/pengrad/telegrambot/utility/gson/ReactionTypeAdapter.java
+++ b/library/src/main/java/com/pengrad/telegrambot/utility/gson/ReactionTypeAdapter.java
@@ -4,6 +4,7 @@
import com.pengrad.telegrambot.model.reaction.ReactionType;
import com.pengrad.telegrambot.model.reaction.ReactionTypeCustomEmoji;
import com.pengrad.telegrambot.model.reaction.ReactionTypeEmoji;
+import com.pengrad.telegrambot.model.reaction.ReactionTypePaid;
import java.lang.reflect.Type;
@@ -19,6 +20,8 @@ public ReactionType deserialize(JsonElement element, Type type, JsonDeserializat
return context.deserialize(object, ReactionTypeEmoji.class);
} else if (ReactionTypeCustomEmoji.CUSTOM_EMOJI_TYPE.equals(discriminator)) {
return context.deserialize(object, ReactionTypeCustomEmoji.class);
+ } else if (ReactionTypePaid.PAID_TYPE.equals(discriminator)) {
+ return context.deserialize(object, ReactionTypePaid.class);
}
return new ReactionType(discriminator);
diff --git a/pom.xml b/pom.xml
index 65a12516..4d73671b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
4.0.0
com.github.pengrad
java-telegram-bot-api
- 7.8.0
+ 7.9.0
JavaTelegramBotApi
Java API for Telegram Bot API
https://github.com/pengrad/java-telegram-bot-api/