Class Viewer

java.lang.Object
com.gmt2001.twitch.cache.Viewer

public final class Viewer extends Object
Contains information about a specific viewer in a ViewerCache
Author:
gmt2001
  • Method Summary

    Modifier and Type
    Method
    Description
    Updates the last time this user was active in chat
    boolean
    Indicates if this user is a Twitch admin
    admin(boolean admin)
    Updates the Twitch admin status of the viewer
    Marks that the attributes have been set on this viewer
    boolean
    bot()
    Indicates if this user is the bot
    bot(boolean bot)
    Updates if this viewer is the bot
    boolean
    Indicates if this user is the broadcaster
    broadcaster(boolean broadcaster)
    Updates the broadcaster status of the viewer
    boolean
     
    boolean
    Indicates if this user has had their attributes set from an IRC event, such as moderator status
    int
     
    id()
    The Twitch user id
    boolean
    Indicates if this user is in chat
    inChat(boolean inChat)
    Updates if this viewer is in chat
    The last time this user was active in chat
    The last time this user was seen
    The Twitch user login name
    login(String login)
    Updates the Twitch user login name
    boolean
    Indicates if this user is a moderator
    moderator(boolean moderator)
    Updates the moderator status of the viewer
    The Twitch user display name
    name(String name)
    Updates the Twitch user display name
    Updates the last time this user was seen
    boolean
    Indicates if this user is a Twitch staff member
    staff(boolean staff)
    Updates the Twitch staff status of the viewer
    boolean
    Indicates if this user is a subscriber of the channel
    subscriber(boolean subscriber)
    Updates the Twitch subscriber status of the viewer
    boolean
    Indicates if this user is a Twitch turbo member
    turbo(boolean turbo)
    Updates the Twitch turbo status of the viewer
    boolean
    vip()
    Indicates if this user is a VIP
    vip(boolean vip)
    Updates the Twitch VIP status of the viewer

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • id

      public String id()
      The Twitch user id
      Returns:
      The Twitch user id
    • login

      public Viewer login(String login)
      Updates the Twitch user login name
      Parameters:
      login - The Twitch user login name
      Returns:
      this
    • login

      public String login()
      The Twitch user login name
      Returns:
      The Twitch user login name; Empty string "" if the login name has not been looked up yet
    • name

      public Viewer name(String name)
      Updates the Twitch user display name
      Parameters:
      name - The Twitch user display name
      Returns:
      this
    • name

      public String name()
      The Twitch user display name
      Returns:
      The Twitch user display name; Empty string "" if the display name has not been looked up yet
    • active

      public Viewer active()
      Updates the last time this user was active in chat
      Returns:
      this
    • lastActive

      public Instant lastActive()
      The last time this user was active in chat
      Returns:
      The last time this user was active in chat; Instant.MIN if the user was never active
    • seen

      public Viewer seen()
      Updates the last time this user was seen

      This is used for garbage collection

      Returns:
      this
    • lastSeen

      public Instant lastSeen()
      The last time this user was seen

      This is used for garbage collection

      Returns:
      The last time this user was seen
    • attributes

      public Viewer attributes()
      Marks that the attributes have been set on this viewer
    • hasAttributes

      public boolean hasAttributes()
      Indicates if this user has had their attributes set from an IRC event, such as moderator status

      It is possible for this to return false but for some attributes to be set if an API lookup was performed

      Returns:
      true if the user has had their attributes set
    • admin

      public Viewer admin(boolean admin)
      Updates the Twitch admin status of the viewer
      Parameters:
      admin - true if the user is a Twitch admin
      Returns:
      this
    • admin

      public boolean admin()
      Indicates if this user is a Twitch admin
      Returns:
      true if the user is a Twitch admin
    • bot

      public Viewer bot(boolean bot)
      Updates if this viewer is the bot
      Parameters:
      bot - true if the user is the bot
      Returns:
      this
    • bot

      public boolean bot()
      Indicates if this user is the bot
      Returns:
      true if the user is the bot
    • broadcaster

      public Viewer broadcaster(boolean broadcaster)
      Updates the broadcaster status of the viewer
      Parameters:
      broadcaster - true if the user is the broadcaster
      Returns:
      this
    • broadcaster

      public boolean broadcaster()
      Indicates if this user is the broadcaster
      Returns:
      true if the user is the broadcaster
    • inChat

      public Viewer inChat(boolean inChat)
      Updates if this viewer is in chat
      Parameters:
      inChat - true if the user is in chat
      Returns:
      this
    • inChat

      public boolean inChat()
      Indicates if this user is in chat
      Returns:
      true if the user is in chat
    • moderator

      public Viewer moderator(boolean moderator)
      Updates the moderator status of the viewer
      Parameters:
      moderator - true if the user is a moderator
      Returns:
      this
    • moderator

      public boolean moderator()
      Indicates if this user is a moderator
      Returns:
      true if the user is a moderator
    • staff

      public Viewer staff(boolean staff)
      Updates the Twitch staff status of the viewer
      Parameters:
      staff - true if the user is a Twitch staff member
      Returns:
      this
    • staff

      public boolean staff()
      Indicates if this user is a Twitch staff member
      Returns:
      true if the user is a Twitch staff member
    • subscriber

      public Viewer subscriber(boolean subscriber)
      Updates the Twitch subscriber status of the viewer
      Parameters:
      subscriber - true if the user is a subscriber of the channel
      Returns:
      this
    • subscriber

      public boolean subscriber()
      Indicates if this user is a subscriber of the channel
      Returns:
      true if the user is a subscriber of the channel
    • turbo

      public Viewer turbo(boolean turbo)
      Updates the Twitch turbo status of the viewer
      Parameters:
      turbo - true if the user is a Twitch turbo member
      Returns:
      this
    • turbo

      public boolean turbo()
      Indicates if this user is a Twitch turbo member
      Returns:
      true if the user is a Twitch turbo member
    • vip

      public Viewer vip(boolean vip)
      Updates the Twitch VIP status of the viewer
      Parameters:
      vip - true if the user is a VIP
      Returns:
      this
    • vip

      public boolean vip()
      Indicates if this user is a VIP
      Returns:
      true if the user is a VIP
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object