2016-01-14 23:09:19 +01:00
|
|
|
|
package org.telegram.telegrambots.api.objects;
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
2016-04-02 18:20:49 +02:00
|
|
|
|
|
2016-11-17 02:41:12 +01:00
|
|
|
|
import org.telegram.telegrambots.api.interfaces.BotApiObject;
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Ruben Bermudez
|
|
|
|
|
* @version 1.0
|
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
|
|
|
|
*/
|
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";
|
2016-09-24 22:37:25 +02:00
|
|
|
|
private static final String ALL_MEMBERS_ARE_ADMINISTRATORS_FIELD = "all_members_are_administrators";
|
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";
|
|
|
|
|
|
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
|
|
|
|
|
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)
|
2016-01-14 01:14:53 +01:00
|
|
|
|
private Long id; ///< Unique identifier for this chat, not exciding 1e13 by absolute value
|
|
|
|
|
@JsonProperty(TYPE_FIELD)
|
|
|
|
|
private String type; ///< Type of the chat, one of “private”, “group” or “channel”
|
|
|
|
|
@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
|
2016-09-30 23:32:05 +02:00
|
|
|
|
/**
|
2017-06-30 14:15:48 +02:00
|
|
|
|
* Optional. True if a group has ‘All Members Are Admins’ enabled.
|
2016-09-30 23:32:05 +02:00
|
|
|
|
*/
|
2016-11-17 02:41:12 +01:00
|
|
|
|
@JsonProperty(ALL_MEMBERS_ARE_ADMINISTRATORS_FIELD)
|
2016-09-30 23:32:05 +02:00
|
|
|
|
private Boolean allMembersAreAdministrators;
|
2017-06-30 14:15:48 +02:00
|
|
|
|
@JsonProperty(PHOTO_FIELD)
|
|
|
|
|
private ChatPhoto photo; ///< Optional. Chat photo. Returned only in getChat.
|
|
|
|
|
@JsonProperty(DESCRIPTION_FIELD)
|
|
|
|
|
private String description; ///< Optional. Description, for supergroups and channel chats. Returned only in getChat.
|
|
|
|
|
@JsonProperty(INVITELINK_FIELD)
|
|
|
|
|
private String inviteLink; ///< Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
|
|
public Chat() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Long getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean isGroupChat() {
|
|
|
|
|
return GROUPCHATTYPE.equals(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean isChannelChat() {
|
|
|
|
|
return CHANNELCHATTYPE.equals(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean isUserChat() {
|
|
|
|
|
return USERCHATTYPE.equals(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean isSuperGroupChat() {
|
|
|
|
|
return SUPERGROUPCHATTYPE.equals(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getTitle() {
|
|
|
|
|
return title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getFirstName() {
|
|
|
|
|
return firstName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getLastName() {
|
|
|
|
|
return lastName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUserName() {
|
|
|
|
|
return userName;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 22:37:25 +02:00
|
|
|
|
public Boolean getAllMembersAreAdministrators() {
|
|
|
|
|
return allMembersAreAdministrators;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-30 14:15:48 +02:00
|
|
|
|
public ChatPhoto getPhoto() {
|
|
|
|
|
return photo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
return description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getInviteLink() {
|
|
|
|
|
return inviteLink;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-08 20:17:07 +01:00
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "Chat{" +
|
|
|
|
|
"id=" + id +
|
|
|
|
|
", type='" + type + '\'' +
|
|
|
|
|
", title='" + title + '\'' +
|
|
|
|
|
", firstName='" + firstName + '\'' +
|
|
|
|
|
", lastName='" + lastName + '\'' +
|
|
|
|
|
", userName='" + userName + '\'' +
|
2016-09-24 22:37:25 +02:00
|
|
|
|
", allMembersAreAdministrators=" + allMembersAreAdministrators +
|
2017-06-30 14:15:48 +02:00
|
|
|
|
", photo=" + photo +
|
|
|
|
|
", description='" + description + '\'' +
|
|
|
|
|
", inviteLink='" + inviteLink + '\'' +
|
2016-03-08 20:17:07 +01:00
|
|
|
|
'}';
|
|
|
|
|
}
|
2016-01-14 01:14:53 +01:00
|
|
|
|
}
|