Skip to content

Commit

Permalink
Merge pull request #389 from mircoianese/api_v7.6
Browse files Browse the repository at this point in the history
BOT API v7.6
  • Loading branch information
pengrad authored Jul 8, 2024
2 parents f501d8b + d908b0f commit 0e6168f
Show file tree
Hide file tree
Showing 18 changed files with 536 additions and 9 deletions.
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.6.0'
```
Maven:
```xml
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.4.0</version>
<version>7.6.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.6.0'
```
Maven:
```xml
<dependency>
<groupId>com.github.pengrad</groupId>
<artifactId>java-telegram-bot-api</artifactId>
<version>7.4.0</version>
<version>7.6.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.6.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 @@ -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
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 @@ -280,6 +283,10 @@ public Audio audio() {
return audio;
}

public PaidMediaInfo paidMedia() {
return paid_media;
}

public Document document() {
return document;
}
Expand Down Expand Up @@ -540,6 +547,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 @@ -630,6 +638,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
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 + "'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.pengrad.telegrambot.model.paidmedia;

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

public class PaidMediaInfo implements Serializable {

private final static long serialVersionUID = 0L;

private Integer star_count;

private PaidMedia[] paid_media;

public Integer starCount() {
return star_count;
}

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;

PaidMediaInfo that = (PaidMediaInfo) o;
return Objects.equals(star_count, that.star_count) &&
Arrays.equals(paid_media, that.paid_media);
}

@Override
public int hashCode() {
return Objects.hash(star_count, paid_media);
}

@Override
public String toString() {
return "PaidMediaInfo{" +
"star_count='" + star_count + "'," +
"paid_media='" + Arrays.toString(paid_media) + "'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.pengrad.telegrambot.model.paidmedia;

import com.pengrad.telegrambot.model.PhotoSize;

import java.util.Arrays;
import java.util.Objects;

public class PaidMediaPhoto extends PaidMedia {

public final static String TYPE = "photo";

private PhotoSize[] photo;

public PaidMediaPhoto() {
super(TYPE);
}

public PhotoSize[] getPhoto() {
return photo;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaidMediaPhoto that = (PaidMediaPhoto) o;
return Objects.equals(type(), that.type()) &&
Arrays.equals(photo, that.photo);
}

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

@Override
public String toString() {
return "PaidMediaPhoto{" +
"type='" + type() + "\'," +
", photo=" + Arrays.toString(photo) + "\'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.pengrad.telegrambot.model.paidmedia;

import java.util.Objects;

public class PaidMediaPreview extends PaidMedia {

public final static String TYPE = "preview";

private Integer width;

private Integer height;

private Integer duration;

public PaidMediaPreview() {
super(TYPE);
}

public Integer getWidth() {
return width;
}

public Integer getHeight() {
return height;
}

public Integer getDuration() {
return duration;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaidMediaPreview that = (PaidMediaPreview) o;
return Objects.equals(type(), that.type()) &&
Objects.equals(width, that.width) &&
Objects.equals(height, that.height) &&
Objects.equals(duration, that.duration);
}

@Override
public int hashCode() {
return Objects.hash(type(), width, height, duration);
}

@Override
public String toString() {
return "PaidMediaPreview{" +
"type='" + type() + "\'," +
", width=" + width + "\'," +
", height=" + height + "\'," +
", duration=" + duration + "\'" +
'}';
}

}
Loading

0 comments on commit 0e6168f

Please sign in to comment.