Skip to content

Commit 4386936

Browse files
authored
Merge pull request #341 from mircoianese/api_v6.8
BOT Api v6.8
2 parents bea9e3c + 1013ca1 commit 4386936

File tree

5 files changed

+92
-0
lines changed

5 files changed

+92
-0
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public enum Type {
3434
private ChatPhoto photo;
3535
private String[] active_usernames;
3636
private String emoji_status_custom_emoji_id;
37+
private Integer emoji_status_expiration_date;
3738
private String bio;
3839
private Boolean has_private_forwards;
3940
private Boolean has_restricted_voice_and_video_messages;
@@ -85,14 +86,34 @@ public ChatPhoto photo() {
8586
return photo;
8687
}
8788

89+
/**
90+
* @deprecated Use activeUsernames() instead
91+
*/
92+
@Deprecated
8893
public String[] getActiveUsernames() {
8994
return active_usernames;
9095
}
9196

97+
public String[] activeUsernames() {
98+
return active_usernames;
99+
}
100+
101+
/**
102+
* @deprecated Use emojiStatusCustomEmojiId() instead
103+
*/
104+
@Deprecated
92105
public String getEmojiStatusCustomEmojiId() {
93106
return emoji_status_custom_emoji_id;
94107
}
95108

109+
public String emojiStatusCustomEmojiId() {
110+
return emoji_status_custom_emoji_id;
111+
}
112+
113+
public Integer emojiStatusExpirationDate() {
114+
return emoji_status_expiration_date;
115+
}
116+
96117
public String bio() {
97118
return bio;
98119
}
@@ -180,6 +201,7 @@ public boolean equals(Object o) {
180201
Objects.equals(photo, chat.photo) &&
181202
Arrays.equals(active_usernames, chat.active_usernames) &&
182203
Objects.equals(emoji_status_custom_emoji_id, chat.emoji_status_custom_emoji_id) &&
204+
Objects.equals(emoji_status_expiration_date, chat.emoji_status_expiration_date) &&
183205
Objects.equals(bio, chat.bio) &&
184206
Objects.equals(has_private_forwards, chat.has_private_forwards) &&
185207
Objects.equals(has_restricted_voice_and_video_messages, chat.has_restricted_voice_and_video_messages) &&
@@ -218,6 +240,7 @@ public String toString() {
218240
", photo=" + photo +
219241
", active_usernames=" + Arrays.toString(active_usernames) +
220242
", emoji_status_custom_emoji_id='" + emoji_status_custom_emoji_id + '\'' +
243+
", emoji_status_expiration_date='" + emoji_status_expiration_date + '\'' +
221244
", bio='" + bio + '\'' +
222245
", has_private_forwards=" + has_private_forwards +
223246
", has_restricted_voice_and_video_messages=" + has_restricted_voice_and_video_messages +

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

+7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class Message implements Serializable {
6767
private Message pinned_message;
6868
private Invoice invoice;
6969
private SuccessfulPayment successful_payment;
70+
private Story story;
7071
private UserShared user_shared;
7172
private ChatShared chat_shared;
7273
private String connected_website;
@@ -300,6 +301,10 @@ public SuccessfulPayment successfulPayment() {
300301
return successful_payment;
301302
}
302303

304+
public Story story() {
305+
return story;
306+
}
307+
303308
public UserShared userShared() {
304309
return user_shared;
305310
}
@@ -430,6 +435,7 @@ public boolean equals(Object o) {
430435
Objects.equals(pinned_message, message.pinned_message) &&
431436
Objects.equals(invoice, message.invoice) &&
432437
Objects.equals(successful_payment, message.successful_payment) &&
438+
Objects.equals(story, message.story) &&
433439
Objects.equals(user_shared, message.user_shared) &&
434440
Objects.equals(chat_shared, message.chat_shared) &&
435441
Objects.equals(connected_website, message.connected_website) &&
@@ -511,6 +517,7 @@ public String toString() {
511517
", pinned_message=" + pinned_message +
512518
", invoice=" + invoice +
513519
", successful_payment=" + successful_payment +
520+
", story=" + story +
514521
", user_shared=" + user_shared +
515522
", chat_shared=" + chat_shared +
516523
", connected_website='" + connected_website + '\'' +

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

+8
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ public class PollAnswer implements Serializable {
1111
private final static long serialVersionUID = 0L;
1212

1313
private String poll_id;
14+
private Chat voter_chat;
1415
private User user;
1516
private Integer[] option_ids;
1617

1718
public String pollId() {
1819
return poll_id;
1920
}
2021

22+
public Chat voterChat() {
23+
return voter_chat;
24+
}
25+
2126
public User user() {
2227
return user;
2328
}
@@ -34,6 +39,7 @@ public boolean equals(Object o) {
3439
PollAnswer that = (PollAnswer) o;
3540

3641
if (poll_id != null ? !poll_id.equals(that.poll_id) : that.poll_id != null) return false;
42+
if (voter_chat != null ? !voter_chat.equals(that.voter_chat) : that.voter_chat != null) return false;
3743
if (user != null ? !user.equals(that.user) : that.user != null) return false;
3844
// Probably incorrect - comparing Object[] arrays with Arrays.equals
3945
return Arrays.equals(option_ids, that.option_ids);
@@ -42,6 +48,7 @@ public boolean equals(Object o) {
4248
@Override
4349
public int hashCode() {
4450
int result = poll_id != null ? poll_id.hashCode() : 0;
51+
result = 31 * result + (voter_chat != null ? voter_chat.hashCode() : 0);
4552
result = 31 * result + (user != null ? user.hashCode() : 0);
4653
result = 31 * result + Arrays.hashCode(option_ids);
4754
return result;
@@ -51,6 +58,7 @@ public int hashCode() {
5158
public String toString() {
5259
return "PollAnswer{" +
5360
"poll_id='" + poll_id + '\'' +
61+
", voter_chat=" + voter_chat +
5462
", user=" + user +
5563
", option_ids=" + Arrays.toString(option_ids) +
5664
'}';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.pengrad.telegrambot.model;
2+
3+
import java.io.Serializable;
4+
5+
/**
6+
*
7+
* 18/08/2023.
8+
*/
9+
10+
public class Story implements Serializable {
11+
private final static long serialVersionUID = 0L;
12+
13+
14+
@Override
15+
public boolean equals(Object o) {
16+
if (this == o) return true;
17+
if (o == null || getClass() != o.getClass()) return false;
18+
Story story = (Story) o;
19+
// todo: fix when fields are added
20+
return true;
21+
}
22+
23+
@Override
24+
public int hashCode() {
25+
// todo: fix when fields are added
26+
return 0;
27+
}
28+
29+
@Override
30+
public String toString() {
31+
// todo: fix when fields are added
32+
return "Story{" + '}';
33+
}
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.pengrad.telegrambot.request;
2+
3+
import com.pengrad.telegrambot.response.BaseResponse;
4+
5+
/**
6+
* 22 August 2023
7+
*/
8+
public class UnpinAllGeneralForumTopicMessages extends BaseRequest<UnpinAllGeneralForumTopicMessages, BaseResponse> {
9+
10+
public UnpinAllGeneralForumTopicMessages(Long chatId) {
11+
this(chatId.toString());
12+
}
13+
14+
public UnpinAllGeneralForumTopicMessages(String chatId) {
15+
super(BaseResponse.class);
16+
add("chat_id", chatId);
17+
}
18+
19+
}

0 commit comments

Comments
 (0)