|
|
|
@ -85,6 +85,18 @@ public class Message implements BotApiObject { |
|
|
|
public static final String VOICE_FIELD = "voice"; |
|
|
|
@JsonProperty(VOICE_FIELD) |
|
|
|
private Voice voice; ///< Optional. Message is a voice message, information about the file
|
|
|
|
public static final String SUPERGROUPCREATED_FIELD = "supergroup_chat_created"; |
|
|
|
@JsonProperty(SUPERGROUPCREATED_FIELD) |
|
|
|
private Boolean superGroupCreated; ///< Optional. Informs that the supergroup has been created
|
|
|
|
public static final String CHANNELCHATCREATED_FIELD = "channel_chat_created"; |
|
|
|
@JsonProperty(CHANNELCHATCREATED_FIELD) |
|
|
|
private Boolean channelChatCreated; ///< Optional. Informs that the channel has been created
|
|
|
|
public static final String MIGRATETOCHAT_FIELD = "migrate_to_chat_id"; |
|
|
|
@JsonProperty(MIGRATETOCHAT_FIELD) |
|
|
|
private Long migrateToChatId; ///< Optional. The chat has been migrated to a chat with specified identifier, not exceeding 1e13 by absolute value
|
|
|
|
public static final String MIGRATEFROMCHAT_FIELD = "migrate_from_chat_id"; |
|
|
|
@JsonProperty(MIGRATEFROMCHAT_FIELD) |
|
|
|
private Long migrateFromChatId; ///< Optional. The chat has been migrated from a chat with specified identifier, not exceeding 1e13 by absolute value
|
|
|
|
|
|
|
|
public Message() { |
|
|
|
super(); |
|
|
|
@ -155,10 +167,22 @@ public class Message implements BotApiObject { |
|
|
|
} |
|
|
|
} |
|
|
|
if (jsonObject.has(DELETECHATPHOTO_FIELD)) { |
|
|
|
this.deleteChatPhoto = jsonObject.getBoolean(DELETECHATPHOTO_FIELD); |
|
|
|
this.deleteChatPhoto = true; |
|
|
|
} |
|
|
|
if (jsonObject.has(GROUPCHATCREATED_FIELD)) { |
|
|
|
this.groupchatCreated = jsonObject.getBoolean(GROUPCHATCREATED_FIELD); |
|
|
|
this.groupchatCreated = true; |
|
|
|
} |
|
|
|
if (jsonObject.has(SUPERGROUPCREATED_FIELD)) { |
|
|
|
this.superGroupCreated = true; |
|
|
|
} |
|
|
|
if (jsonObject.has(CHANNELCHATCREATED_FIELD)) { |
|
|
|
this.channelChatCreated = true; |
|
|
|
} |
|
|
|
if (jsonObject.has(MIGRATETOCHAT_FIELD)) { |
|
|
|
this.migrateToChatId = jsonObject.getLong(MIGRATETOCHAT_FIELD); |
|
|
|
} |
|
|
|
if (jsonObject.has(MIGRATEFROMCHAT_FIELD)) { |
|
|
|
this.migrateFromChatId = jsonObject.getLong(MIGRATEFROMCHAT_FIELD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -198,6 +222,10 @@ public class Message implements BotApiObject { |
|
|
|
return chat.isChannelChat(); |
|
|
|
} |
|
|
|
|
|
|
|
public boolean isSuperGroupMessage() { |
|
|
|
return chat.isSuperGroupChat(); |
|
|
|
} |
|
|
|
|
|
|
|
public Long getChatId() { |
|
|
|
return chat.getId(); |
|
|
|
} |
|
|
|
@ -374,6 +402,38 @@ public class Message implements BotApiObject { |
|
|
|
this.voice = voice; |
|
|
|
} |
|
|
|
|
|
|
|
public Boolean getSuperGroupCreated() { |
|
|
|
return superGroupCreated; |
|
|
|
} |
|
|
|
|
|
|
|
public void setSuperGroupCreated(Boolean superGroupCreated) { |
|
|
|
this.superGroupCreated = superGroupCreated; |
|
|
|
} |
|
|
|
|
|
|
|
public Boolean getChannelChatCreated() { |
|
|
|
return channelChatCreated; |
|
|
|
} |
|
|
|
|
|
|
|
public void setChannelChatCreated(Boolean channelChatCreated) { |
|
|
|
this.channelChatCreated = channelChatCreated; |
|
|
|
} |
|
|
|
|
|
|
|
public Long getMigrateToChatId() { |
|
|
|
return migrateToChatId; |
|
|
|
} |
|
|
|
|
|
|
|
public void setMigrateToChatId(Long migrateToChatId) { |
|
|
|
this.migrateToChatId = migrateToChatId; |
|
|
|
} |
|
|
|
|
|
|
|
public Long getMigrateFromChatId() { |
|
|
|
return migrateFromChatId; |
|
|
|
} |
|
|
|
|
|
|
|
public void setMigrateFromChatId(Long migrateFromChatId) { |
|
|
|
this.migrateFromChatId = migrateFromChatId; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException { |
|
|
|
gen.writeStartObject(); |
|
|
|
@ -445,76 +505,24 @@ public class Message implements BotApiObject { |
|
|
|
if (groupchatCreated != null) { |
|
|
|
gen.writeBooleanField(GROUPCHATCREATED_FIELD, groupchatCreated); |
|
|
|
} |
|
|
|
gen.writeEndObject(); |
|
|
|
gen.flush(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { |
|
|
|
if (forwardFrom != null) { |
|
|
|
gen.writeObjectField(FORWARDFROM_FIELD, forwardFrom); |
|
|
|
} |
|
|
|
if (forwardDate != null) { |
|
|
|
gen.writeNumberField(FORWARDDATE_FIELD, forwardDate); |
|
|
|
} |
|
|
|
if (text != null) { |
|
|
|
gen.writeStringField(TEXT_FIELD, text); |
|
|
|
if (superGroupCreated != null) { |
|
|
|
gen.writeBooleanField(SUPERGROUPCREATED_FIELD, superGroupCreated); |
|
|
|
} |
|
|
|
if (audio != null) { |
|
|
|
gen.writeObjectField(AUDIO_FIELD, audio); |
|
|
|
if (channelChatCreated != null) { |
|
|
|
gen.writeBooleanField(CHANNELCHATCREATED_FIELD, channelChatCreated); |
|
|
|
} |
|
|
|
if (document != null) { |
|
|
|
gen.writeObjectField(DOCUMENT_FIELD, document); |
|
|
|
if (migrateToChatId != null) { |
|
|
|
gen.writeNumberField(MIGRATETOCHAT_FIELD, migrateToChatId); |
|
|
|
} |
|
|
|
if (photo != null && photo.size() > 0) { |
|
|
|
gen.writeArrayFieldStart(PHOTO_FIELD); |
|
|
|
for (PhotoSize photoSize : photo) { |
|
|
|
gen.writeObject(photoSize); |
|
|
|
} |
|
|
|
gen.writeEndArray(); |
|
|
|
} |
|
|
|
if (sticker != null) { |
|
|
|
gen.writeObjectField(STICKER_FIELD, sticker); |
|
|
|
} |
|
|
|
if (video != null) { |
|
|
|
gen.writeObjectField(VIDEO_FIELD, video); |
|
|
|
} |
|
|
|
if (contact != null) { |
|
|
|
gen.writeObjectField(CONTACT_FIELD, contact); |
|
|
|
} |
|
|
|
if (location != null) { |
|
|
|
gen.writeObjectField(LOCATION_FIELD, location); |
|
|
|
} |
|
|
|
if (voice != null) { |
|
|
|
gen.writeObjectField(VOICE_FIELD, voice); |
|
|
|
} |
|
|
|
if (newChatParticipant != null) { |
|
|
|
gen.writeObjectField(NEWCHATPARTICIPANT_FIELD, newChatParticipant); |
|
|
|
} |
|
|
|
if (leftChatParticipant != null) { |
|
|
|
gen.writeObjectField(LEFTCHATPARTICIPANT_FIELD, leftChatParticipant); |
|
|
|
} |
|
|
|
if (replyToMessage != null) { |
|
|
|
gen.writeObjectField(REPLYTOMESSAGE_FIELD, replyToMessage); |
|
|
|
} |
|
|
|
if (newChatTitle != null) { |
|
|
|
gen.writeStringField(NEWCHATTITLE_FIELD, newChatTitle); |
|
|
|
} |
|
|
|
if (newChatPhoto != null && newChatPhoto.size() > 0) { |
|
|
|
gen.writeArrayFieldStart(NEWCHATPHOTO_FIELD); |
|
|
|
for (PhotoSize photoSize: newChatPhoto) { |
|
|
|
gen.writeObject(photoSize); |
|
|
|
} |
|
|
|
gen.writeEndArray(); |
|
|
|
} |
|
|
|
if (deleteChatPhoto != null) { |
|
|
|
gen.writeBooleanField(DELETECHATPHOTO_FIELD, deleteChatPhoto); |
|
|
|
} |
|
|
|
if (groupchatCreated != null) { |
|
|
|
gen.writeBooleanField(GROUPCHATCREATED_FIELD, groupchatCreated); |
|
|
|
if (migrateFromChatId != null) { |
|
|
|
gen.writeNumberField(MIGRATEFROMCHAT_FIELD, migrateFromChatId); |
|
|
|
} |
|
|
|
gen.writeEndObject(); |
|
|
|
gen.flush(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { |
|
|
|
serialize(gen, serializers); |
|
|
|
} |
|
|
|
} |
|
|
|
|