Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOT API v7.7 #390

Merged
merged 16 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.0'
implementation 'com.github.pengrad:java-telegram-bot-api:7.7.0'
```
Maven:
```xml
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.4.0</version>
<version>7.7.0</version>
</dependency>
```
[JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases)
Expand Down
4 changes: 2 additions & 2 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B

Gradle:
```groovy
implementation 'com.github.pengrad:java-telegram-bot-api:7.4.0'
implementation 'com.github.pengrad:java-telegram-bot-api:7.7.0'
```
Maven:
```xml
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.4.0</version>
<version>7.7.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.4.0
VERSION_NAME=7.7.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 @@ -59,6 +59,7 @@ public enum Type {
private String invite_link;
private Message pinned_message;
private ChatPermissions permissions;
private Boolean can_send_paid_media;
private Integer slow_mode_delay;
private Integer unrestrict_boost_count;
private Integer message_auto_delete_time;
Expand Down Expand Up @@ -217,6 +218,9 @@ public Message pinnedMessage() {
public ChatPermissions permissions() {
return permissions;
}
public Boolean canSendPaidMedia() {
return can_send_paid_media;
}

public Integer slowModeDelay() {
return slow_mode_delay;
Expand Down Expand Up @@ -296,6 +300,7 @@ public boolean equals(Object o) {
Objects.equals(invite_link, chat.invite_link) &&
Objects.equals(pinned_message, chat.pinned_message) &&
Objects.equals(permissions, chat.permissions) &&
Objects.equals(can_send_paid_media, chat.can_send_paid_media) &&
Objects.equals(slow_mode_delay, chat.slow_mode_delay) &&
Objects.equals(unrestrict_boost_count, chat.unrestrict_boost_count) &&
Objects.equals(message_auto_delete_time, chat.message_auto_delete_time) &&
Expand Down Expand Up @@ -349,6 +354,7 @@ public String toString() {
", invite_link='" + invite_link + '\'' +
", pinned_message=" + pinned_message +
", permissions=" + permissions +
", can_send_paid_media=" + can_send_paid_media +
", slow_mode_delay=" + slow_mode_delay +
", unrestrict_boost_count=" + unrestrict_boost_count +
", message_auto_delete_time=" + message_auto_delete_time +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public Boolean canDeleteMessages() {
/**
* @deprecated Use canManageVideoChats() instead
*/
@Deprecated
public Boolean canManageVoiceChats() {
return canManageVideoChats();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.pengrad.telegrambot.model.giveaway.Giveaway;
import com.pengrad.telegrambot.model.giveaway.GiveawayWinners;
import com.pengrad.telegrambot.model.message.origin.MessageOrigin;
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;

import java.io.Serializable;
import java.util.Arrays;
Expand All @@ -18,6 +19,7 @@ public class ExternalReplyInfo implements Serializable {
private LinkPreviewOptions link_preview_options;
private Animation animation;
private Audio audio;
private PaidMediaInfo paid_media;
private Document document;
private PhotoSize[] photo;
private Sticker sticker;
Expand Down Expand Up @@ -60,6 +62,9 @@ public Audio audio() {
return audio;
}

public PaidMediaInfo paidMedia() {
return paid_media;
}
public Document document() {
return document;
}
Expand Down Expand Up @@ -133,12 +138,12 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExternalReplyInfo that = (ExternalReplyInfo) o;
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);
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);
}

@Override
public int hashCode() {
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);
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);
result = 31 * result + Arrays.hashCode(photo);
return result;
}
Expand All @@ -152,6 +157,7 @@ public String toString() {
", link_preview_options=" + link_preview_options +
", animation=" + animation +
", audio=" + audio +
", paid_media=" + paid_media +
", document=" + document +
", photo=" + Arrays.toString(photo) +
", sticker=" + sticker +
Expand Down
16 changes: 16 additions & 0 deletions library/src/main/java/com/pengrad/telegrambot/model/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
import com.pengrad.telegrambot.model.message.origin.*;
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
import com.pengrad.telegrambot.passport.PassportData;

Expand Down Expand Up @@ -46,6 +48,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
private LinkPreviewOptions link_preview_options;
private String effect_id;
private Audio audio;
private PaidMediaInfo paid_media;
private Document document;
private Animation animation;
private Game game;
Expand Down Expand Up @@ -74,6 +77,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
private MaybeInaccessibleMessage pinned_message;
private Invoice invoice;
private SuccessfulPayment successful_payment;
private RefundedPayment refunded_payment;
private Story story;
private UserShared user_shared; //@deprectated
private UsersShared users_shared;
Expand Down Expand Up @@ -280,6 +284,10 @@ public Audio audio() {
return audio;
}

public PaidMediaInfo paidMedia() {
return paid_media;
}

public Document document() {
return document;
}
Expand Down Expand Up @@ -392,6 +400,10 @@ public SuccessfulPayment successfulPayment() {
return successful_payment;
}

public RefundedPayment refundedPayment() {
return refunded_payment;
}

public Story story() {
return story;
}
Expand Down Expand Up @@ -540,6 +552,7 @@ public boolean equals(Object o) {
Objects.equals(link_preview_options, message.link_preview_options) &&
Objects.equals(effect_id, message.effect_id) &&
Objects.equals(audio, message.audio) &&
Objects.equals(paid_media, message.paid_media) &&
Objects.equals(document, message.document) &&
Objects.equals(animation, message.animation) &&
Objects.equals(game, message.game) &&
Expand Down Expand Up @@ -568,6 +581,7 @@ public boolean equals(Object o) {
Objects.equals(pinned_message, message.pinned_message) &&
Objects.equals(invoice, message.invoice) &&
Objects.equals(successful_payment, message.successful_payment) &&
Objects.equals(refunded_payment, message.refunded_payment) &&
Objects.equals(story, message.story) &&
Objects.equals(user_shared, message.user_shared) &&
Objects.equals(users_shared, message.users_shared) &&
Expand Down Expand Up @@ -630,6 +644,7 @@ public String toString() {
", link_preview_options=" + link_preview_options +
", effect_id=" + effect_id +
", audio=" + audio +
", paid_media=" + paid_media +
", document=" + document +
", animation=" + animation +
", game=" + game +
Expand Down Expand Up @@ -658,6 +673,7 @@ public String toString() {
", pinned_message=" + pinned_message +
", invoice=" + invoice +
", successful_payment=" + successful_payment +
", refunded_payment=" + refunded_payment +
", story=" + story +
", user_shared=" + user_shared +
", users_shared=" + users_shared +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.pengrad.telegrambot.model;

import com.pengrad.telegrambot.model.stars.StarTransaction;

import java.io.Serializable;
import java.util.Objects;

public class RefundedPayment implements Serializable {

private final static long serialVersionUID = 0L;

private String currency;

private Integer total_amount;

private String invoice_payload;

private String telegram_payment_charge_id;

private String provider_payment_charge_id;

public String currency() {
return currency;
}

public Integer totalAmount() {
return total_amount;
}

public String invoicePayload() {
return invoice_payload;
}

public String telegramPaymentChargeId() {
return telegram_payment_charge_id;
}

public String providerPaymentChargeId() {
return provider_payment_charge_id;
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

RefundedPayment that = (RefundedPayment) o;
return Objects.equals(currency, that.currency) &&
Objects.equals(total_amount, that.total_amount) &&
Objects.equals(invoice_payload, that.invoice_payload) &&
Objects.equals(telegram_payment_charge_id, that.telegram_payment_charge_id) &&
Objects.equals(provider_payment_charge_id, that.provider_payment_charge_id);
}

@Override
public int hashCode() {
return Objects.hash(currency, total_amount, invoice_payload, telegram_payment_charge_id, provider_payment_charge_id);
}

@Override
public String toString() {
return "RefundedPayment{" +
"currency='" + currency + "'," +
"total_amount='" + total_amount + "'," +
"invoice_payload='" + invoice_payload + "'," +
"telegram_payment_charge_id='" + telegram_payment_charge_id + "'," +
"provider_payment_charge_id='" + provider_payment_charge_id + "'" +
'}';
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class BusinessConnection {

private String id;
private User user;
private Integer user_chat_id;
private Long user_chat_id;
private Integer date;
private Boolean can_reply;
private Boolean is_enabled;
Expand All @@ -21,7 +21,7 @@ public User user() {
return user;
}

public Integer userChatId() {
public Long userChatId() {
return user_chat_id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class MessageOrigin implements Serializable {
protected String type;
protected Integer date;

public MessageOrigin(String type) {
this.type = type;
}

public String type() {
return type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class MessageOriginChannel extends MessageOrigin {

private String author_signature;

public MessageOriginChannel() {
super(MESSAGE_ORIGIN_TYPE);
}

public Chat chat() {
return chat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class MessageOriginChat extends MessageOrigin {
private Chat sender_chat;
private String author_signature;

public MessageOriginChat() {
super(MESSAGE_ORIGIN_TYPE);
}
public Chat senderChat() {
return sender_chat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public class MessageOriginHiddenUser extends MessageOrigin {

private String sender_user_name;

public MessageOriginHiddenUser() {
super(MESSAGE_ORIGIN_TYPE);
}

public String senderUserName() {
return sender_user_name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class MessageOriginUser extends MessageOrigin {

private User sender_user;

public MessageOriginUser() {
super(MESSAGE_ORIGIN_TYPE);
}
public User senderUser() {
return sender_user;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.pengrad.telegrambot.model.paidmedia;

import java.io.Serializable;
import java.util.Objects;

public abstract class PaidMedia implements Serializable {

private final static long serialVersionUID = 0L;

private String type;

public PaidMedia(String type) {
this.type = type;
}

public String type() {
return type;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

PaidMedia that = (PaidMedia) o;
return Objects.equals(type, that.type);
}

@Override
public int hashCode() {
return Objects.hash(type);
}

@Override
public String toString() {
return "PaidMedia{" +
"type='" + type + "'" +
'}';
}

}
Loading