forked from pengrad/java-telegram-bot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChat.java
More file actions
101 lines (80 loc) · 2.4 KB
/
Chat.java
File metadata and controls
101 lines (80 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.pengrad.telegrambot.model;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.Objects;
/**
* stas
* 8/5/15.
*/
public class Chat implements Serializable {
private final static long serialVersionUID = 0L;
public enum Type {
@SerializedName("private") Private, group, supergroup, channel
}
private Long id;
private Type type;
//Channel and Group
private String title;
//Private and Channel
private String username;
//Private
private String first_name;
private String last_name;
private Boolean is_forum;
private Boolean is_direct_messages;
public Long id() {
return id;
}
public Type type() {
return type;
}
public String firstName() {
return first_name;
}
public String lastName() {
return last_name;
}
public String username() {
return username;
}
public Boolean isForum() {
return is_forum != null && is_forum;
}
public Boolean isDirectMessages() {
return is_direct_messages != null && is_direct_messages;
}
public String title() {
return title;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Chat chat = (Chat) o;
return Objects.equals(id, chat.id) &&
type == chat.type &&
Objects.equals(first_name, chat.first_name) &&
Objects.equals(last_name, chat.last_name) &&
Objects.equals(is_forum, chat.is_forum) &&
Objects.equals(is_direct_messages, chat.is_direct_messages) &&
Objects.equals(username, chat.username) &&
Objects.equals(title, chat.title);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
@Override
public String toString() {
return "Chat{" +
"id=" + id +
", type=" + type +
", first_name='" + first_name + '\'' +
", last_name='" + last_name + '\'' +
", is_forum=" + is_forum +
", is_direct_messages=" + is_direct_messages +
", username='" + username + '\'' +
", title='" + title + '\'' +
'}';
}
}