Skip to content

Commit

Permalink
Merge pull request #394 from mircoianese/api_v7.9
Browse files Browse the repository at this point in the history
BOT API v7.9
  • Loading branch information
pengrad authored Aug 20, 2024
2 parents ba791f7 + 742a401 commit cdfd85c
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.8.0</version>
<version>7.9.0</version>
</dependency>
```
[JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases)
Expand Down
6 changes: 3 additions & 3 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.8.0</version>
<version>7.9.0</version>
</dependency>
```
Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases).
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Objects;

public class BackgroundFillGradient extends BackgroundType {
public class BackgroundFillGradient extends BackgroundFill {

public static final String TYPE = "gradient";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Objects;

public class BackgroundFillSolid extends BackgroundType {
public class BackgroundFillSolid extends BackgroundFill {

public static final String TYPE = "solid";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public int hashCode() {
public String toString() {
return "ReactionTypeEmoji{" +
"type='" + type() + '\'' +
"emoji='" + emoji + '\'' +
",emoji='" + emoji + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -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() + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,6 +13,7 @@ public class TransactionPartnerUser extends TransactionPartner {

private User user;
private String invoice_payload;
private PaidMedia[] paid_media;

public TransactionPartnerUser() {
super(TYPE);
Expand All @@ -25,27 +27,31 @@ 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
public String toString() {
return "TransactionPartnerUser{" +
"type='" + type() + "\'," +
", user=" + user + "\'," +
", invoice_payload=" + invoice_payload + "\'" +
", invoice_payload=" + invoice_payload + "\'," +
", paid_media=" + paid_media + "\'" +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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<CreateChatSubscriptionInviteLink, ChatInviteLinkResponse> {

/**
* 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);
}


}
Original file line number Diff line number Diff line change
@@ -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<EditChatSubscriptionInviteLink, ChatInviteLinkResponse> {

/**
* 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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.8.0</version>
<version>7.9.0</version>
<name>JavaTelegramBotApi</name>
<description>Java API for Telegram Bot API</description>
<url>https://github.com/pengrad/java-telegram-bot-api/</url>
Expand Down

0 comments on commit cdfd85c

Please sign in to comment.