Module whatsapp4j

Class Chat.ChatBuilder

java.lang.Object
it.auties.whatsapp4j.protobuf.chat.Chat.ChatBuilder
Enclosing class:
Chat

public static class Chat.ChatBuilder extends Object
  • Method Details

    • jid

      public Chat.ChatBuilder jid(@NonNull @NonNull String jid)
      The non null unique jid used to identify this chat
      Returns:
      this.
    • displayName

      public Chat.ChatBuilder displayName(@NonNull @NonNull String displayName)
      The non null display name of this chat
      Returns:
      this.
    • messages

      public Chat.ChatBuilder messages(@NonNull @NonNull Messages messages)
      A non null arrayList of messages in this chat sorted chronologically
      Returns:
      this.
    • presences

      public Chat.ChatBuilder presences(@NonNull @NonNull Map<Contact,​ContactStatus> 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 use WhatsappAPI.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 implementing WhatsappListener.onContactPresenceUpdate(it.auties.whatsapp4j.protobuf.chat.Chat, it.auties.whatsapp4j.protobuf.contact.Contact). The presence that this map indicates might not line up with Contact.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

      public Chat.ChatBuilder mute(@NonNull @NonNull ChatMute mute)
      The non null mute of this chat
      Returns:
      this.
    • newJid

      public Chat.ChatBuilder newJid(String 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

      public Chat.ChatBuilder timestamp(long timestamp)
      The time in seconds since Instant.EPOCH for the latest message in Chat.messages
      Returns:
      this.
    • unreadMessages

      public Chat.ChatBuilder unreadMessages(int unreadMessages)
      The number of unread messages in this chat. To set all the messages as read it's advised to use WhatsappAPI.markAsRead(Chat).
      Returns:
      this.
    • pinned

      public Chat.ChatBuilder pinned(long pinned)
      The time in seconds since Instant.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

      public Chat.ChatBuilder ephemeralMessageDuration(long 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

      public Chat.ChatBuilder ephemeralMessagesToggleTime(long ephemeralMessagesToggleTime)
      The time in seconds since Instant.EPOCH when ephemeral messages were turned on. If ephemeral messages aren't enabled, this field has a value of 0.
      Returns:
      this.
    • isArchived

      public Chat.ChatBuilder isArchived(boolean isArchived)
      This field is used to determine whether a chat is archived or not.
      Returns:
      this.
    • isReadOnly

      public Chat.ChatBuilder isReadOnly(boolean 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

      public Chat.ChatBuilder isSpam(boolean isSpam)
      This field is used to determine whether a chat was marked as being spam or not.
      Returns:
      this.
    • build

      public Chat build()
    • toString

      public String toString()
      Overrides:
      toString in class Object