Skip to content

Commit 5654454

Browse files
committed
Added the field paid_media to the classes Message and ExternalReplyInfo
1 parent 3db9f42 commit 5654454

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

library/src/main/java/com/pengrad/telegrambot/model/ExternalReplyInfo.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.pengrad.telegrambot.model.giveaway.Giveaway;
44
import com.pengrad.telegrambot.model.giveaway.GiveawayWinners;
55
import com.pengrad.telegrambot.model.message.origin.MessageOrigin;
6+
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
67

78
import java.io.Serializable;
89
import java.util.Arrays;
@@ -18,6 +19,7 @@ public class ExternalReplyInfo implements Serializable {
1819
private LinkPreviewOptions link_preview_options;
1920
private Animation animation;
2021
private Audio audio;
22+
private PaidMediaInfo paid_media;
2123
private Document document;
2224
private PhotoSize[] photo;
2325
private Sticker sticker;
@@ -60,6 +62,9 @@ public Audio audio() {
6062
return audio;
6163
}
6264

65+
public PaidMediaInfo paidMedia() {
66+
return paid_media;
67+
}
6368
public Document document() {
6469
return document;
6570
}
@@ -133,12 +138,12 @@ public boolean equals(Object o) {
133138
if (this == o) return true;
134139
if (o == null || getClass() != o.getClass()) return false;
135140
ExternalReplyInfo that = (ExternalReplyInfo) o;
136-
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);
141+
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);
137142
}
138143

139144
@Override
140145
public int hashCode() {
141-
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);
146+
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);
142147
result = 31 * result + Arrays.hashCode(photo);
143148
return result;
144149
}
@@ -152,6 +157,7 @@ public String toString() {
152157
", link_preview_options=" + link_preview_options +
153158
", animation=" + animation +
154159
", audio=" + audio +
160+
", paid_media=" + paid_media +
155161
", document=" + document +
156162
", photo=" + Arrays.toString(photo) +
157163
", sticker=" + sticker +

library/src/main/java/com/pengrad/telegrambot/model/Message.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
66
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
77
import com.pengrad.telegrambot.model.message.origin.*;
8+
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;
9+
import com.pengrad.telegrambot.model.paidmedia.PaidMediaInfo;
810
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
911
import com.pengrad.telegrambot.passport.PassportData;
1012

@@ -46,6 +48,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
4648
private LinkPreviewOptions link_preview_options;
4749
private String effect_id;
4850
private Audio audio;
51+
private PaidMediaInfo paid_media;
4952
private Document document;
5053
private Animation animation;
5154
private Game game;
@@ -280,6 +283,10 @@ public Audio audio() {
280283
return audio;
281284
}
282285

286+
public PaidMediaInfo paidMedia() {
287+
return paid_media;
288+
}
289+
283290
public Document document() {
284291
return document;
285292
}
@@ -540,6 +547,7 @@ public boolean equals(Object o) {
540547
Objects.equals(link_preview_options, message.link_preview_options) &&
541548
Objects.equals(effect_id, message.effect_id) &&
542549
Objects.equals(audio, message.audio) &&
550+
Objects.equals(paid_media, message.paid_media) &&
543551
Objects.equals(document, message.document) &&
544552
Objects.equals(animation, message.animation) &&
545553
Objects.equals(game, message.game) &&
@@ -630,6 +638,7 @@ public String toString() {
630638
", link_preview_options=" + link_preview_options +
631639
", effect_id=" + effect_id +
632640
", audio=" + audio +
641+
", paid_media=" + paid_media +
633642
", document=" + document +
634643
", animation=" + animation +
635644
", game=" + game +
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.pengrad.telegrambot.model.paidmedia;
2+
3+
import java.io.Serializable;
4+
import java.util.Arrays;
5+
import java.util.Objects;
6+
7+
public class PaidMediaInfo implements Serializable {
8+
9+
private final static long serialVersionUID = 0L;
10+
11+
private Integer star_count;
12+
13+
private PaidMedia[] paid_media;
14+
15+
public Integer starCount() {
16+
return star_count;
17+
}
18+
19+
public PaidMedia[] paidMedia() {
20+
return paid_media;
21+
}
22+
23+
@Override
24+
public boolean equals(Object o) {
25+
if (this == o) return true;
26+
if (o == null || getClass() != o.getClass()) return false;
27+
28+
PaidMediaInfo that = (PaidMediaInfo) o;
29+
return Objects.equals(star_count, that.star_count) &&
30+
Arrays.equals(paid_media, that.paid_media);
31+
}
32+
33+
@Override
34+
public int hashCode() {
35+
return Objects.hash(star_count, paid_media);
36+
}
37+
38+
@Override
39+
public String toString() {
40+
return "PaidMediaInfo{" +
41+
"star_count='" + star_count + "'," +
42+
"paid_media='" + Arrays.toString(paid_media) + "'" +
43+
'}';
44+
}
45+
46+
}

0 commit comments

Comments
 (0)