Add extra info

This commit is contained in:
Andrea Cavalli 2021-12-19 00:17:31 +01:00
parent 2663d01761
commit 5adc17f6cc
7 changed files with 199 additions and 0 deletions

View File

@ -54,6 +54,13 @@ public class Chat implements BotApiObject {
private static final String CHANNELCHATTYPE = "channel";
private static final String SUPERGROUPCHATTYPE = "supergroup";
private static final String IS_VERIFIED_FIELD = "is_verified";
private static final String IS_RESTRICTED_FIELD = "is_restricted";
private static final String IS_CREATOR_FIELD = "is_creator";
private static final String IS_SCAM_FIELD = "is_scam";
private static final String IS_FAKE_FIELD = "is_fake";
private static final String DC_ID_FIELD = "dc_id";
/**
* Unique identifier for this chat.
* This number may be greater than 32 bits and some programming languages may
@ -134,6 +141,17 @@ public class Chat implements BotApiObject {
@JsonProperty(HASPRIVATEFORWARDS_FIELD)
private Boolean hasPrivateForwards;
@JsonProperty(IS_VERIFIED_FIELD)
private Boolean isVerified; ///< Optional. Extra.
@JsonProperty(IS_CREATOR_FIELD)
private Boolean isCreator; ///< Optional. Extra.
@JsonProperty(IS_SCAM_FIELD)
private Boolean isScam; ///< Optional. Extra.
@JsonProperty(IS_FAKE_FIELD)
private Boolean isFake; ///< Optional. Extra.
@JsonProperty(DC_ID_FIELD)
private Integer dcId; ///< Optional. Extra.
@JsonIgnore
public Boolean isGroupChat() {
return GROUPCHATTYPE.equals(type);

View File

@ -96,6 +96,9 @@ public class Message implements BotApiObject {
private static final String ISAUTOMATICFORWARD_FIELD = "is_automatic_forward";
private static final String CANBEFORWARDED_FIELD = "can_be_forwarded";
private static final String VIEWS_FIELD = "views";
private static final String OUTGOING_FIELD = "outgoing";
@JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Integer Unique message identifier
@JsonProperty(FROM_FIELD)
@ -281,6 +284,11 @@ public class Message implements BotApiObject {
@JsonProperty(CANBEFORWARDED_FIELD)
private Boolean canBeForwarded; ///< Optional. True, if the message can be forwarded
@JsonProperty(OUTGOING_FIELD)
private Boolean outgoing; ///< Optional. Extra.
@JsonProperty(VIEWS_FIELD)
private Integer views; ///< Optional. Extra.
public List<MessageEntity> getEntities() {
if (entities != null) {

View File

@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import org.telegram.telegrambots.meta.api.objects.extra.ExtraChatInfo;
import org.telegram.telegrambots.meta.api.objects.inlinequery.ChosenInlineQuery;
import org.telegram.telegrambots.meta.api.objects.inlinequery.InlineQuery;
import org.telegram.telegrambots.meta.api.objects.payments.PreCheckoutQuery;
@ -45,6 +46,7 @@ public class Update implements BotApiObject {
private static final String MYCHATMEMBER_FIELD = "my_chat_member";
private static final String CHATMEMBER_FIELD = "chat_member";
private static final String CHATJOINREQUEST_FIELD = "chat_join_request";
private static final String EXTRA_CHAT_INFO_FIELD = "extra_chat_info";
@JsonProperty(UPDATEID_FIELD)
private Integer updateId;
@ -68,6 +70,8 @@ public class Update implements BotApiObject {
private PreCheckoutQuery preCheckoutQuery; ///< Optional. New incoming pre-checkout query. Contains full information about checkout
@JsonProperty(POLL_FIELD)
private Poll poll; ///< Optional. New poll state. Bots receive only updates about polls, which are sent by the bot.
@JsonProperty(EXTRA_CHAT_INFO_FIELD)
private ExtraChatInfo extra_chat_info; ///< Optional. Extra.
/**
* Optional.
* A user changed their answer in a non-anonymous poll.
@ -150,4 +154,9 @@ public class Update implements BotApiObject {
public boolean hasChatJoinRequest() {
return chatJoinRequest != null;
}
public boolean hasExtraChatInfo() {
return extra_chat_info != null;
}
}

View File

@ -0,0 +1,30 @@
package org.telegram.telegrambots.meta.api.objects.extra;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* @author Andrea Cavalli
* @version 0.1
*
* This object contains information about a bot info.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ExtraBotInfo implements BotApiObject {
@JsonProperty("user_id")
private String userId;
@JsonProperty("description")
private String description;
}

View File

@ -0,0 +1,30 @@
package org.telegram.telegrambots.meta.api.objects.extra;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* @author Andrea Cavalli
* @version 0.1
*
* This object contains information about a channel location.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ExtraChannelLocation implements BotApiObject {
@JsonProperty("geo_point")
private ExtraGeoPoint geoPoint;
@JsonProperty("address")
private String address;
}

View File

@ -0,0 +1,70 @@
package org.telegram.telegrambots.meta.api.objects.extra;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* @author Andrea Cavalli
* @version 0.1
*
* This object contains information about a chat.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ExtraChatInfo implements BotApiObject {
@JsonProperty("id")
private String id;
@JsonProperty("about")
private String about;
@JsonProperty("read_inbox_max_id")
private Integer readInboxMaxId;
@JsonProperty("read_outbox_max_id")
private Integer readOutboxMaxId;
@JsonProperty("unread_count")
private Integer unreadCount;
@JsonProperty("bot_info")
private ExtraBotInfo botInfo;
@JsonProperty("blocked")
private Boolean blocked;
@JsonProperty("participants_count")
private Integer memberCount;
@JsonProperty("admins_count")
private Integer adminCount;
@JsonProperty("kicked_count")
private Integer kickedCount;
@JsonProperty("banned_count")
private Integer bannedCount;
@JsonProperty("online_count")
private Integer onlineCount;
@JsonProperty("migrated_from_chat_id")
private Integer migratedFromChatId;
@JsonProperty("migrated_from_max_id")
private Integer migratedFromMaxId;
@JsonProperty("pinned_msg_id")
private Integer pinnedMessageId;
@JsonProperty("linked_chat_id")
private Integer linkedChatId;
@JsonProperty("location")
private ExtraChannelLocation location;
@JsonProperty("slowmode_seconds")
private Integer slowmodeSeconds;
@JsonProperty("slowmode_next_send_date")
private Integer slowmodeNextSendDate;
@JsonProperty("stats_dc")
private Integer statsDc;
@JsonProperty("ttl_period")
private Integer ttlPeriod;
@JsonProperty("pending_suggestions")
private String pendingSuggestions;
}

View File

@ -0,0 +1,34 @@
package org.telegram.telegrambots.meta.api.objects.extra;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
/**
* @author Andrea Cavalli
* @version 0.1
*
* This object contains information about a geographic point.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ExtraGeoPoint implements BotApiObject {
@JsonProperty("long")
private Double longitude;
@JsonProperty("lat")
private Double latitude;
@JsonProperty("access_hash")
private Long accessHash;
@JsonProperty("accuracy_radius")
private Integer accuracyRadius;
}