java.lang.Object
it.auties.whatsapp4j.protobuf.chat.Chat.ChatBuilder
- Enclosing class:
- Chat
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
displayName(@NonNull String displayName)
The non null display name of this chatephemeralMessageDuration(long ephemeralMessageDuration)
The time in seconds before a message is automatically deleted from this chat both locally and from WhatsappWeb's servers.ephemeralMessagesToggleTime(long ephemeralMessagesToggleTime)
The time in seconds sinceInstant.EPOCH
when ephemeral messages were turned on.isArchived(boolean isArchived)
This field is used to determine whether a chat is archived or not.isReadOnly(boolean isReadOnly)
This field is used to determine whether a chat is read only or not.isSpam(boolean isSpam)
This field is used to determine whether a chat was marked as being spam or not.The non null unique jid used to identify this chatA non null arrayList of messages in this chat sorted chronologicallyThe non null mute of this chatThe nullable new unique jid for this Chat.pinned(long pinned)
The time in seconds sinceInstant.EPOCH
when this chat was pinned to the top.presences(@NonNull Map<Contact,ContactStatus> presences)
A map that holds the status of each participant, excluding yourself, for this chat.timestamp(long timestamp)
The time in seconds sinceInstant.EPOCH
for the latest message inChat.messages
toString()
unreadMessages(int unreadMessages)
The number of unread messages in this chat.
-
Method Details
-
jid
The non null unique jid used to identify this chat- Returns:
this
.
-
displayName
The non null display name of this chat- Returns:
this
.
-
messages
A non null arrayList of messages in this chat sorted chronologically- Returns:
this
.
-
presences
A map that holds the status of each participant, excluding yourself, for this chat. If the chat is not a group, this map's size will range from 0 to 1. Otherwise, it will range from 0 to the number of participants - 1. It is important to remember that is not guaranteed that every participant will be present as a key. In this case, if this chat is a group, it can be safely assumed that the user is not available. Otherwise, it's recommended to useWhatsappAPI.subscribeToContactPresence(Contact)
to force Whatsapp to send updates regarding the status of the other participant. It's also possible to listen for updates to a contact's presence in a group or in a conversation by implementingWhatsappListener.onContactPresenceUpdate(it.auties.whatsapp4j.protobuf.chat.Chat, it.auties.whatsapp4j.protobuf.contact.Contact)
. The presence that this map indicates might not line up withContact.lastKnownPresence()
if the contact is composing, recording or paused. This is because a contact can be online on Whatsapp and composing, recording or paused in a specific chat.- Returns:
this
.
-
mute
The non null mute of this chat- Returns:
this
.
-
newJid
The nullable new unique jid for this Chat. This field is not null when a contact changes phone number and connects their new phone number with Whatsapp.- Returns:
this
.
-
timestamp
The time in seconds sinceInstant.EPOCH
for the latest message inChat.messages
- Returns:
this
.
-
unreadMessages
The number of unread messages in this chat. To set all the messages as read it's advised to useWhatsappAPI.markAsRead(Chat)
.- Returns:
this
.
-
pinned
The time in seconds sinceInstant.EPOCH
when this chat was pinned to the top. If the chat isn't pinned, this field has a value of 0.- Returns:
this
.
-
ephemeralMessageDuration
The time in seconds before a message is automatically deleted from this chat both locally and from WhatsappWeb's servers. If ephemeral messages aren't enabled, this field has a value of 0- Returns:
this
.
-
ephemeralMessagesToggleTime
The time in seconds sinceInstant.EPOCH
when ephemeral messages were turned on. If ephemeral messages aren't enabled, this field has a value of 0.- Returns:
this
.
-
isArchived
This field is used to determine whether a chat is archived or not.- Returns:
this
.
-
isReadOnly
This field is used to determine whether a chat is read only or not. If true, it means that it's not possible to send messages here. This is the case, for example, for groups where only admins can send messages.- Returns:
this
.
-
isSpam
This field is used to determine whether a chat was marked as being spam or not.- Returns:
this
.
-
build
-
toString
-