Skip to content

Commit 61a1569

Browse files
committed
New optional fields added to the Message object: supergroup_chat_created, migrate_to_chat_id, migrate_from_chat_id and channel_chat_created.
1 parent 66ff302 commit 61a1569

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

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

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public class Message {
3131
private final PhotoSize[] new_chat_photo;
3232
private final Boolean delete_chat_photo;
3333
private final Boolean group_chat_created;
34+
private final Boolean supergroup_chat_created;
35+
private final Boolean channel_chat_created;
36+
private final Long migrate_to_chat_id;
37+
private final Long migrate_from_chat_id;
3438

35-
public Message(Integer message_id, User from, Integer date, Chat chat, User forward_from, Integer forward_date,
36-
Message reply_to_message, String text, Audio audio, Document document, PhotoSize[] photo,
37-
Sticker sticker, Video video, Voice voice, String caption, Contact contact, Location location,
38-
User new_chat_participant, User left_chat_participant, String new_chat_title,
39-
PhotoSize[] new_chat_photo, Boolean delete_chat_photo, Boolean group_chat_created) {
39+
public Message(Integer message_id, User from, Integer date, Chat chat, User forward_from, Integer forward_date, Message reply_to_message, String text, Audio audio, Document document, PhotoSize[] photo, Sticker sticker, Video video, Voice voice, String caption, Contact contact, Location location, User new_chat_participant, User left_chat_participant, String new_chat_title, PhotoSize[] new_chat_photo, Boolean delete_chat_photo, Boolean group_chat_created, Boolean supergroup_chat_created, Boolean channel_chat_created, Long migrate_to_chat_id, Long migrate_from_chat_id) {
4040
this.message_id = message_id;
4141
this.from = from;
4242
this.date = date;
@@ -60,9 +60,12 @@ public Message(Integer message_id, User from, Integer date, Chat chat, User forw
6060
this.new_chat_photo = new_chat_photo;
6161
this.delete_chat_photo = delete_chat_photo;
6262
this.group_chat_created = group_chat_created;
63+
this.supergroup_chat_created = supergroup_chat_created;
64+
this.channel_chat_created = channel_chat_created;
65+
this.migrate_to_chat_id = migrate_to_chat_id;
66+
this.migrate_from_chat_id = migrate_from_chat_id;
6367
}
6468

65-
6669
public Integer messageId() {
6770
return message_id;
6871
}
@@ -155,6 +158,22 @@ public Boolean groupChatCreated() {
155158
return group_chat_created;
156159
}
157160

161+
public Boolean supergroupChatCreated() {
162+
return supergroup_chat_created;
163+
}
164+
165+
public Boolean channelChatCreated() {
166+
return channel_chat_created;
167+
}
168+
169+
public Long migrateToChatId() {
170+
return migrate_to_chat_id;
171+
}
172+
173+
public Long migrateFromChatId() {
174+
return migrate_from_chat_id;
175+
}
176+
158177
@Override
159178
public boolean equals(Object o) {
160179
if (this == o) return true;
@@ -193,7 +212,15 @@ public boolean equals(Object o) {
193212
if (!Arrays.equals(new_chat_photo, message.new_chat_photo)) return false;
194213
if (delete_chat_photo != null ? !delete_chat_photo.equals(message.delete_chat_photo) : message.delete_chat_photo != null)
195214
return false;
196-
return !(group_chat_created != null ? !group_chat_created.equals(message.group_chat_created) : message.group_chat_created != null);
215+
if (group_chat_created != null ? !group_chat_created.equals(message.group_chat_created) : message.group_chat_created != null)
216+
return false;
217+
if (supergroup_chat_created != null ? !supergroup_chat_created.equals(message.supergroup_chat_created) : message.supergroup_chat_created != null)
218+
return false;
219+
if (channel_chat_created != null ? !channel_chat_created.equals(message.channel_chat_created) : message.channel_chat_created != null)
220+
return false;
221+
if (migrate_to_chat_id != null ? !migrate_to_chat_id.equals(message.migrate_to_chat_id) : message.migrate_to_chat_id != null)
222+
return false;
223+
return migrate_from_chat_id != null ? migrate_from_chat_id.equals(message.migrate_from_chat_id) : message.migrate_from_chat_id == null;
197224

198225
}
199226

@@ -228,6 +255,10 @@ public String toString() {
228255
", new_chat_photo=" + Arrays.toString(new_chat_photo) +
229256
", delete_chat_photo=" + delete_chat_photo +
230257
", group_chat_created=" + group_chat_created +
258+
", supergroup_chat_created=" + supergroup_chat_created +
259+
", channel_chat_created=" + channel_chat_created +
260+
", migrate_to_chat_id=" + migrate_to_chat_id +
261+
", migrate_from_chat_id=" + migrate_from_chat_id +
231262
'}';
232263
}
233264
}

0 commit comments

Comments
 (0)