2018-07-08 01:41:21 +02:00
package org.telegram.telegrambots.meta.api.objects ;
2016-01-14 01:14:53 +01:00
2020-10-31 18:43:32 +01:00
import com.fasterxml.jackson.annotation.JsonIgnore ;
2016-01-14 01:14:53 +01:00
import com.fasterxml.jackson.annotation.JsonProperty ;
2020-10-31 18:43:32 +01:00
import lombok.AllArgsConstructor ;
2020-11-01 23:46:36 +01:00
import lombok.EqualsAndHashCode ;
import lombok.Getter ;
2020-10-31 18:43:32 +01:00
import lombok.NoArgsConstructor ;
import lombok.NonNull ;
import lombok.RequiredArgsConstructor ;
2020-11-01 23:46:36 +01:00
import lombok.Setter ;
import lombok.ToString ;
2018-07-08 01:41:21 +02:00
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject ;
2016-01-14 01:14:53 +01:00
/ * *
* @author Ruben Bermudez
2022-06-18 00:40:30 +02:00
* @version 6 . 1
2017-06-30 14:15:48 +02:00
* This object represents a Telegram chat with an user or a group
2016-01-14 01:14:53 +01:00
* /
2018-08-21 22:19:31 +02:00
@SuppressWarnings ( " WeakerAccess " )
2020-11-01 23:46:36 +01:00
@EqualsAndHashCode ( callSuper = false )
@Getter
@Setter
@ToString
2020-10-31 18:43:32 +01:00
@RequiredArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
2016-11-17 02:41:12 +01:00
public class Chat implements BotApiObject {
2016-04-11 02:53:53 +02:00
private static final String ID_FIELD = " id " ;
private static final String TYPE_FIELD = " type " ;
private static final String TITLE_FIELD = " title " ;
2017-06-30 14:15:48 +02:00
private static final String USERNAME_FIELD = " username " ;
2016-04-11 02:53:53 +02:00
private static final String FIRSTNAME_FIELD = " first_name " ;
private static final String LASTNAME_FIELD = " last_name " ;
2020-11-01 23:46:36 +01:00
private static final String BIO_FIELD = " bio " ;
2017-06-30 14:15:48 +02:00
private static final String PHOTO_FIELD = " photo " ;
private static final String DESCRIPTION_FIELD = " description " ;
private static final String INVITELINK_FIELD = " invite_link " ;
2017-08-23 09:06:32 +02:00
private static final String PINNEDMESSAGE_FIELD = " pinned_message " ;
2017-10-11 19:27:12 +02:00
private static final String STICKERSETNAME_FIELD = " sticker_set_name " ;
private static final String CANSETSTICKERSET_FIELD = " can_set_sticker_set " ;
2019-07-29 01:24:30 +02:00
private static final String PERMISSIONS_FIELD = " permissions " ;
2019-12-31 03:36:57 +01:00
private static final String SLOWMODEDELAY_FIELD = " slow_mode_delay " ;
2020-11-01 23:46:36 +01:00
private static final String LINKEDCHATID_FIELD = " linked_chat_id " ;
private static final String LOCATION_FIELD = " location " ;
2021-03-09 11:59:28 +01:00
private static final String MESSAGEAUTODELETETIME_FIELD = " message_auto_delete_time " ;
2021-12-07 22:03:25 +01:00
private static final String HASPRIVATEFORWARDS_FIELD = " has_private_forwards " ;
2022-02-26 21:03:10 +01:00
private static final String HASPROTECTEDCONTENT_FIELD = " has_protected_content " ;
2022-06-18 00:40:30 +02:00
private static final String JOINTOSENDMESSAGES_FIELD = " join_to_send_messages " ;
private static final String JOINBYREQUEST_FIELD = " join_by_request " ;
2017-06-30 14:15:48 +02:00
2016-01-14 01:14:53 +01:00
private static final String USERCHATTYPE = " private " ;
private static final String GROUPCHATTYPE = " group " ;
private static final String CHANNELCHATTYPE = " channel " ;
private static final String SUPERGROUPCHATTYPE = " supergroup " ;
2016-11-17 02:41:12 +01:00
2021-12-19 00:17:31 +01:00
private static final String IS_VERIFIED_FIELD = " is_verified " ;
2022-02-24 02:04:29 +01:00
private static final String IS_SUPPORT_FIELD = " is_support " ;
2021-12-19 00:17:31 +01:00
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 " ;
2016-05-31 19:08:56 +02:00
/ * *
* Unique identifier for this chat .
* This number may be greater than 32 bits and some programming languages may
* have difficulty / silent defects in interpreting it . But it smaller than 52 bits ,
* so a signed 64 bit integer or double - precision float type are safe for storing this identifier .
* /
2016-11-17 02:41:12 +01:00
@JsonProperty ( ID_FIELD )
2020-10-31 18:43:32 +01:00
@NonNull
2018-11-06 15:35:55 +01:00
private Long id ; ///< Unique identifier for this chat, not exceeding 1e13 by absolute value
2016-01-14 01:14:53 +01:00
@JsonProperty ( TYPE_FIELD )
2020-10-31 18:43:32 +01:00
@NonNull
2020-11-01 23:46:36 +01:00
private String type ; ///< Type of the chat, one of “private”, “group” or “channel” or "supergroup"
2016-01-14 01:14:53 +01:00
@JsonProperty ( TITLE_FIELD )
private String title ; ///< Optional. Title of the chat, only for channels and group chat
@JsonProperty ( FIRSTNAME_FIELD )
private String firstName ; ///< Optional. Username of the chat, only for private chats and channels if available
@JsonProperty ( LASTNAME_FIELD )
private String lastName ; ///< Optional. Interlocutor's first name for private chats
@JsonProperty ( USERNAME_FIELD )
private String userName ; ///< Optional. Interlocutor's last name for private chats
2017-06-30 14:15:48 +02:00
@JsonProperty ( PHOTO_FIELD )
private ChatPhoto photo ; ///< Optional. Chat photo. Returned only in getChat.
@JsonProperty ( DESCRIPTION_FIELD )
2019-07-28 22:13:58 +02:00
private String description ; ///< Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
2017-06-30 14:15:48 +02:00
@JsonProperty ( INVITELINK_FIELD )
2021-03-09 11:59:28 +01:00
private String inviteLink ; ///< Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
2017-08-23 09:06:32 +02:00
@JsonProperty ( PINNEDMESSAGE_FIELD )
2020-11-01 23:46:36 +01:00
private Message pinnedMessage ; ///< Optional. The most recent pinned message (by sending date). Returned only in getChat.
2017-10-11 19:27:12 +02:00
@JsonProperty ( STICKERSETNAME_FIELD )
private String stickerSetName ; ///< Optional. For supergroups, name of Group sticker set. Returned only in getChat.
@JsonProperty ( CANSETSTICKERSET_FIELD )
2018-08-21 22:19:31 +02:00
private Boolean canSetStickerSet ; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
2019-07-28 22:13:58 +02:00
@JsonProperty ( PERMISSIONS_FIELD )
private ChatPermissions permissions ; ///< Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
2019-12-31 03:36:57 +01:00
/ * *
* Optional .
* For supergroups , the minimum allowed delay between consecutive messages sent by each unpriviledged user .
* Returned only in getChat .
* /
@JsonProperty ( SLOWMODEDELAY_FIELD )
private Integer slowModeDelay ;
2020-11-01 23:46:36 +01:00
@JsonProperty ( BIO_FIELD )
private String bio ; ///< Optional. Bio of the other party in a private chat. Returned only in getChat.
/ * *
* Optional .
* Unique identifier for the linked chat ,
* i . e . the discussion group identifier for a channel and vice versa ; for supergroups and channel chats .
* This identifier may be greater than 32 bits and some programming
* languages may have difficulty / silent defects in interpreting it .
* But it is smaller than 52 bits , so a signed 64 bit integer or
* double - precision float type are safe for storing this identifier .
* Returned only in getChat .
* /
@JsonProperty ( LINKEDCHATID_FIELD )
private Long linkedChatId ;
@JsonProperty ( LOCATION_FIELD )
private ChatLocation location ; ///< Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
2021-03-09 11:59:28 +01:00
@JsonProperty ( MESSAGEAUTODELETETIME_FIELD )
private Integer messageAutoDeleteTime ; ///< Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
2021-12-07 22:03:25 +01:00
/ * *
* Optional .
2022-02-26 21:03:10 +01:00
* True , if privacy settings of the other party in the private chat allows to use tg : //user?id=<user_id> links only in chats with the user.
2021-12-07 22:03:25 +01:00
* Returned only in getChat .
* /
2022-02-26 21:03:10 +01:00
@JsonProperty ( HASPRIVATEFORWARDS_FIELD )
private Boolean hasPrivateForwards ;
2021-12-07 22:03:25 +01:00
/ * *
* Optional .
2022-02-26 21:03:10 +01:00
* True , if messages from the chat can ' t be forwarded to other chats .
2021-12-07 22:03:25 +01:00
* Returned only in getChat .
* /
2022-02-26 21:03:10 +01:00
@JsonProperty ( HASPROTECTEDCONTENT_FIELD )
private Boolean HasProtectedContent ;
2022-06-18 00:40:30 +02:00
/ * *
* Optional .
* True , if users need to join the supergroup before they can send messages .
* Returned only in getChat .
* /
@JsonProperty ( JOINTOSENDMESSAGES_FIELD )
private Boolean joinToSendMessages ;
/ * *
* Optional .
* True , if all users directly joining the supergroup need to be approved by supergroup administrators .
* Returned only in getChat .
* /
@JsonProperty ( JOINBYREQUEST_FIELD )
private Boolean joinByRequest ;
2016-01-14 01:14:53 +01:00
2021-12-19 00:17:31 +01:00
@JsonProperty ( IS_VERIFIED_FIELD )
private Boolean isVerified ; ///< Optional. Extra.
2022-02-24 02:04:29 +01:00
@JsonProperty ( IS_SUPPORT_FIELD )
private Boolean isSupport ; ///< Optional. Extra.
2021-12-19 00:17:31 +01:00
@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.
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-01-14 01:14:53 +01:00
public Boolean isGroupChat ( ) {
return GROUPCHATTYPE . equals ( type ) ;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-01-14 01:14:53 +01:00
public Boolean isChannelChat ( ) {
return CHANNELCHATTYPE . equals ( type ) ;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-01-14 01:14:53 +01:00
public Boolean isUserChat ( ) {
return USERCHATTYPE . equals ( type ) ;
}
2020-10-31 18:43:32 +01:00
@JsonIgnore
2016-01-14 01:14:53 +01:00
public Boolean isSuperGroupChat ( ) {
return SUPERGROUPCHATTYPE . equals ( type ) ;
}
}