Skip to content

Commit 731ba71

Browse files
authored
Merge pull request #364 from anfanik/master
Bot API 7.1
2 parents 293d770 + fb24dde commit 731ba71

File tree

5 files changed

+135
-10
lines changed

5 files changed

+135
-10
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ public enum Type {
5454
private Message pinned_message;
5555
private ChatPermissions permissions;
5656
private Integer slow_mode_delay;
57+
private Integer unrestrict_boost_count;
5758
private Integer message_auto_delete_time;
5859
private Boolean has_protected_content;
5960
private Boolean has_visible_history;
6061
private String sticker_set_name;
6162
private Boolean can_set_sticker_set;
63+
private String custom_emoji_sticker_set_name;
6264
private Long linked_chat_id;
6365
private ChatLocation location;
6466

@@ -190,6 +192,10 @@ public Integer slowModeDelay() {
190192
return slow_mode_delay;
191193
}
192194

195+
public Integer unrestrictBoostCount() {
196+
return unrestrict_boost_count;
197+
}
198+
193199
public Integer messageAutoDeleteTime() {
194200
return message_auto_delete_time;
195201
}
@@ -210,6 +216,10 @@ public Boolean canSetStickerSet() {
210216
return can_set_sticker_set != null && can_set_sticker_set;
211217
}
212218

219+
public String customEmojiStickerSetName() {
220+
return custom_emoji_sticker_set_name;
221+
}
222+
213223
public Long linkedChatId() {
214224
return linked_chat_id;
215225
}
@@ -251,11 +261,13 @@ public boolean equals(Object o) {
251261
Objects.equals(pinned_message, chat.pinned_message) &&
252262
Objects.equals(permissions, chat.permissions) &&
253263
Objects.equals(slow_mode_delay, chat.slow_mode_delay) &&
264+
Objects.equals(unrestrict_boost_count, chat.unrestrict_boost_count) &&
254265
Objects.equals(message_auto_delete_time, chat.message_auto_delete_time) &&
255266
Objects.equals(has_protected_content, chat.has_protected_content) &&
256267
Objects.equals(has_visible_history, chat.has_visible_history) &&
257268
Objects.equals(sticker_set_name, chat.sticker_set_name) &&
258269
Objects.equals(can_set_sticker_set, chat.can_set_sticker_set) &&
270+
Objects.equals(custom_emoji_sticker_set_name, chat.custom_emoji_sticker_set_name) &&
259271
Objects.equals(linked_chat_id, chat.linked_chat_id) &&
260272
Objects.equals(location, chat.location);
261273
}
@@ -296,11 +308,13 @@ public String toString() {
296308
", pinned_message=" + pinned_message +
297309
", permissions=" + permissions +
298310
", slow_mode_delay=" + slow_mode_delay +
311+
", unrestrict_boost_count=" + unrestrict_boost_count +
299312
", message_auto_delete_time=" + message_auto_delete_time +
300313
", has_protected_content=" + has_protected_content +
301314
", has_visible_history=" + has_visible_history +
302315
", sticker_set_name='" + sticker_set_name + '\'' +
303316
", can_set_sticker_set=" + can_set_sticker_set +
317+
", custom_emoji_sticker_set_name=" + custom_emoji_sticker_set_name +
304318
", linked_chat_id=" + linked_chat_id +
305319
", location=" + location +
306320
'}';

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

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public class ChatPermissions implements Serializable {
2727
private Boolean can_pin_messages;
2828
private Boolean can_manage_topics;
2929

30+
private Boolean can_post_stories;
31+
private Boolean can_edit_stories;
32+
private Boolean can_delete_stories;
33+
3034
public Boolean canSendMessages() {
3135
return can_send_messages != null && can_send_messages;
3236
}
@@ -83,6 +87,18 @@ public Boolean canManageTopics() {
8387
return can_manage_topics != null && can_manage_topics;
8488
}
8589

90+
public Boolean canPostStories() {
91+
return can_post_stories != null && can_post_stories;
92+
}
93+
94+
public Boolean canEditStories() {
95+
return can_edit_stories != null && can_edit_stories;
96+
}
97+
98+
public Boolean canDeleteStories() {
99+
return can_delete_stories != null && can_delete_stories;
100+
}
101+
86102
public ChatPermissions canSendMessages(boolean canSendMessages) {
87103
can_send_messages = canSendMessages;
88104
return this;
@@ -153,6 +169,21 @@ public ChatPermissions canManageTopics(boolean canManageTopics) {
153169
return this;
154170
}
155171

172+
public ChatPermissions canPostStories(Boolean canPostStories) {
173+
this.can_post_stories = canPostStories;
174+
return this;
175+
}
176+
177+
public ChatPermissions canEditStories(Boolean canEditStories) {
178+
this.can_edit_stories = canEditStories;
179+
return this;
180+
}
181+
182+
public ChatPermissions canDeleteStories(Boolean canDeleteStories) {
183+
this.can_delete_stories = canDeleteStories;
184+
return this;
185+
}
186+
156187
@Override
157188
public boolean equals(Object o) {
158189
if (this == o) return true;
@@ -173,7 +204,10 @@ public boolean equals(Object o) {
173204
Objects.equals(can_change_info, that.can_change_info) &&
174205
Objects.equals(can_invite_users, that.can_invite_users) &&
175206
Objects.equals(can_pin_messages, that.can_pin_messages) &&
176-
Objects.equals(can_manage_topics, that.can_manage_topics);
207+
Objects.equals(can_manage_topics, that.can_manage_topics) &&
208+
Objects.equals(can_post_stories, that.can_post_stories) &&
209+
Objects.equals(can_edit_stories, that.can_edit_stories) &&
210+
Objects.equals(can_delete_stories, that.can_delete_stories);
177211
}
178212

179213
@Override
@@ -191,7 +225,10 @@ public int hashCode() {
191225
can_change_info,
192226
can_invite_users,
193227
can_pin_messages,
194-
can_manage_topics);
228+
can_manage_topics,
229+
can_post_stories,
230+
can_edit_stories,
231+
can_delete_stories);
195232
}
196233

197234
@Override
@@ -211,6 +248,9 @@ public String toString() {
211248
", can_invite_users=" + can_invite_users +
212249
", can_pin_messages=" + can_pin_messages +
213250
", can_manage_topics=" + can_manage_topics +
251+
", can_post_stories=" + can_post_stories +
252+
", can_edit_stories=" + can_edit_stories +
253+
", can_delete_stories=" + can_delete_stories +
214254
'}';
215255
}
216256
}

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pengrad.telegrambot.model;
22

3+
import com.pengrad.telegrambot.model.chatboost.ChatBoostAdded;
34
import com.pengrad.telegrambot.model.message.MaybeInaccessibleMessage;
45
import com.pengrad.telegrambot.model.message.origin.*;
56
import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
@@ -19,12 +20,14 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
1920
private Integer message_thread_id;
2021
private User from;
2122
private Chat sender_chat;
23+
private Integer sender_boost_count;
2224
private MessageOrigin forward_origin;
2325
private Boolean is_topic_message;
2426
private Boolean is_automatic_forward;
2527
private Message reply_to_message;
2628
private ExternalReplyInfo external_reply;
2729
private TextQuote quote;
30+
private Story reply_to_story;
2831
private User via_bot;
2932
private Integer edit_date;
3033
private Boolean has_protected_content;
@@ -71,6 +74,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable {
7174
private String connected_website;
7275
private PassportData passport_data;
7376
private ProximityAlertTriggered proximity_alert_triggered;
77+
private ChatBoostAdded boost_added;
7478
private ForumTopicCreated forum_topic_created;
7579
private ForumTopicEdited forum_topic_edited;
7680
private ForumTopicClosed forum_topic_closed;
@@ -98,6 +102,10 @@ public Chat senderChat() {
98102
return sender_chat;
99103
}
100104

105+
public Integer senderBoostCount() {
106+
return sender_boost_count;
107+
}
108+
101109
public MessageOrigin forwardOrigin() {
102110
return forward_origin;
103111
}
@@ -195,6 +203,10 @@ public TextQuote quote() {
195203
return quote;
196204
}
197205

206+
public Story replyToStory() {
207+
return reply_to_story;
208+
}
209+
198210
public User viaBot() {
199211
return via_bot;
200212
}
@@ -383,6 +395,10 @@ public ProximityAlertTriggered proximityAlertTriggered() {
383395
return proximity_alert_triggered;
384396
}
385397

398+
public ChatBoostAdded boostAdded() {
399+
return boost_added;
400+
}
401+
386402
public ForumTopicCreated forumTopicCreated() {
387403
return forum_topic_created;
388404
}
@@ -465,6 +481,7 @@ public boolean equals(Object o) {
465481
Objects.equals(message_thread_id , message.message_thread_id ) &&
466482
Objects.equals(from, message.from) &&
467483
Objects.equals(sender_chat, message.sender_chat) &&
484+
Objects.equals(sender_boost_count, message.sender_boost_count) &&
468485
Objects.equals(date, message.date) &&
469486
Objects.equals(chat, message.chat) &&
470487
Objects.equals(forward_origin, message.forward_origin) &&
@@ -473,6 +490,7 @@ public boolean equals(Object o) {
473490
Objects.equals(reply_to_message, message.reply_to_message) &&
474491
Objects.equals(external_reply, message.external_reply) &&
475492
Objects.equals(quote, message.quote) &&
493+
Objects.equals(reply_to_story, message.reply_to_story) &&
476494
Objects.equals(via_bot, message.via_bot) &&
477495
Objects.equals(edit_date, message.edit_date) &&
478496
Objects.equals(has_protected_content, message.has_protected_content) &&
@@ -519,6 +537,7 @@ public boolean equals(Object o) {
519537
Objects.equals(connected_website, message.connected_website) &&
520538
Objects.equals(passport_data, message.passport_data) &&
521539
Objects.equals(proximity_alert_triggered, message.proximity_alert_triggered) &&
540+
Objects.equals(boost_added, message.boost_added) &&
522541
Objects.equals(forum_topic_created, message.forum_topic_created) &&
523542
Objects.equals(forum_topic_edited, message.forum_topic_edited) &&
524543
Objects.equals(forum_topic_closed, message.forum_topic_closed) &&
@@ -546,6 +565,7 @@ public String toString() {
546565
", message_thread_id=" + message_thread_id +
547566
", from=" + from +
548567
", sender_chat=" + sender_chat +
568+
", sender_boost_count=" + sender_boost_count +
549569
", date=" + date +
550570
", chat=" + chat +
551571
", forward_origin=" + forward_origin +
@@ -554,6 +574,7 @@ public String toString() {
554574
", reply_to_message=" + reply_to_message +
555575
", external_reply=" + external_reply +
556576
", quote=" + quote +
577+
", reply_to_story=" + reply_to_story +
557578
", via_bot=" + via_bot +
558579
", edit_date=" + edit_date +
559580
", has_protected_content=" + has_protected_content+
@@ -600,6 +621,7 @@ public String toString() {
600621
", connected_website='" + connected_website + '\'' +
601622
", passport_data=" + passport_data +
602623
", proximity_alert_triggered=" + proximity_alert_triggered +
624+
", boost_added=" + boost_added +
603625
", forum_topic_created=" + forum_topic_created +
604626
", forum_topic_edited=" + forum_topic_edited +
605627
", forum_topic_closed=" + forum_topic_closed +
Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,47 @@
11
package com.pengrad.telegrambot.model;
22

33
import java.io.Serializable;
4+
import java.util.Objects;
45

56
/**
67
*
78
* 18/08/2023.
89
*/
910

10-
public class Story implements Serializable {
11+
public class Story implements Serializable {
12+
1113
private final static long serialVersionUID = 0L;
1214

15+
private Chat chat;
16+
private Integer id;
17+
18+
public Chat chat() {
19+
return chat;
20+
}
21+
22+
public Integer id() {
23+
return id;
24+
}
1325

1426
@Override
1527
public boolean equals(Object o) {
1628
if (this == o) return true;
1729
if (o == null || getClass() != o.getClass()) return false;
1830
Story story = (Story) o;
19-
// todo: fix when fields are added
20-
return true;
31+
return Objects.equals(chat, story.chat)
32+
&& Objects.equals(id, story.id);
2133
}
2234

2335
@Override
2436
public int hashCode() {
25-
// todo: fix when fields are added
26-
return 0;
37+
return Objects.hash(chat, id);
2738
}
2839

2940
@Override
3041
public String toString() {
31-
// todo: fix when fields are added
32-
return "Story{" + '}';
42+
return "Story{" +
43+
"chat=" + chat +
44+
", id=" + id +
45+
'}';
3346
}
34-
3547
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.pengrad.telegrambot.model.chatboost;
2+
3+
import java.util.Objects;
4+
5+
public class ChatBoostAdded {
6+
7+
private Integer boost_count;
8+
9+
public Integer boostCount() {
10+
return boost_count;
11+
}
12+
13+
public ChatBoostAdded boostCount(Integer boostCount) {
14+
this.boost_count = boostCount;
15+
return this;
16+
}
17+
18+
@Override
19+
public boolean equals(Object o) {
20+
if (this == o) return true;
21+
if (o == null || getClass() != o.getClass()) return false;
22+
ChatBoostAdded that = (ChatBoostAdded) o;
23+
return Objects.equals(boost_count, that.boost_count);
24+
}
25+
26+
@Override
27+
public int hashCode() {
28+
return Objects.hash(boost_count);
29+
}
30+
31+
@Override
32+
public String toString() {
33+
return "ChatBoostAdded{" +
34+
"boost_count=" + boost_count +
35+
'}';
36+
}
37+
}

0 commit comments

Comments
 (0)