Interface PlatformUser


  • public interface PlatformUser
    Describes a user on a Platform. These are not Bot users, instead, they are platform-specific and subject to sudden disconnect as they become unreachable for a variety of platform-specific reasons.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  PlatformUser.Status  
    • Method Summary

      Modifier and Type Method Description
      default UserAssociation createAssociation​(User user)
      Creates a user association on this user to this platform user.
      default ChatSender createSender​(Chat chat)
      Creates a sender for the user, using the specified chat as a target.
      default User getAssociatedUser()
      Gets the user associated with this platform user.
      default UserAssociation getAssociation()
      Gets the user association for this platform user.
      java.util.Collection<Chat> getChats()
      Gets the chats that the user is a part of.
      default PlatformConnection getConnection()
      Gets the platform connection associated with this user.
      java.lang.String getId()
      Gets the Id of this user on this platform.
      default java.lang.String getNickname()
      Gets the nickname of this user on this platform.
      Platform getPlatform()
      Gets the platform associated with this user.
      default Chat getPrivateChat()
      Gets a direct private chat to the user.
      default PlatformUser.Status getStatus()
      Finds the status of the platform user.
      default java.util.TimeZone getTimeZone()
      Gets the time zone the user is assigned to, according to the platform.
      default boolean isConnected()
      Finds if this user is visibly connected to the platform.
      default boolean isIgnored()
      Finds if the user is ignored on the platform.
      boolean isSelf()
      Finds if this user is the bot's own user on this platform, as it appears to other users on the platform.
      default void setIgnored​(boolean ignored)
      Ignores or un-ignores a user.
      default void setNickname​(java.lang.String nickname)
      Sets the nickname of this user on this platform.
    • Method Detail

      • getPlatform

        Platform getPlatform()
        Gets the platform associated with this user.
        Returns:
        Platform instance.
      • createAssociation

        default UserAssociation createAssociation​(User user)
        Creates a user association on this user to this platform user.
        Parameters:
        user - user to associate with.
        Returns:
        UserAssociation instance.
      • getConnection

        default PlatformConnection getConnection()
        Gets the platform connection associated with this user.
        Returns:
        Platform connection instance.
      • getId

        java.lang.String getId()
        Gets the Id of this user on this platform.
        Returns:
        Platform Id.
      • getNickname

        default java.lang.String getNickname()
        Gets the nickname of this user on this platform.
        Returns:
        user nickname.
      • setNickname

        default void setNickname​(java.lang.String nickname)
                          throws java.lang.UnsupportedOperationException
        Sets the nickname of this user on this platform.
        Parameters:
        nickname - user nickname.
        Throws:
        java.lang.UnsupportedOperationException
      • isSelf

        boolean isSelf()
        Finds if this user is the bot's own user on this platform, as it appears to other users on the platform.
        Returns:
        true if the user is the bot itself, false otherwise.
      • isIgnored

        default boolean isIgnored()
        Finds if the user is ignored on the platform.
        Returns:
        true if the user is being ignored, false otherwise.
      • setIgnored

        default void setIgnored​(boolean ignored)
                         throws java.lang.UnsupportedOperationException
        Ignores or un-ignores a user.
        Parameters:
        ignored - true if the user should be ignored, false otherwise.
        Throws:
        java.lang.UnsupportedOperationException
      • isConnected

        default boolean isConnected()
        Finds if this user is visibly connected to the platform.
        Returns:
        true if the user is connected to the platform, false otherwise or if the platform is offline.
      • getAssociation

        default UserAssociation getAssociation()
        Gets the user association for this platform user.
        Returns:
        UserAssociation instance.
      • getAssociatedUser

        default User getAssociatedUser()
        Gets the user associated with this platform user.
        Returns:
        User instance.
      • getTimeZone

        default java.util.TimeZone getTimeZone()
        Gets the time zone the user is assigned to, according to the platform.
        Returns:
      • getChats

        java.util.Collection<Chat> getChats()
        Gets the chats that the user is a part of.
        Returns:
        immutable collection of chats.
      • getPrivateChat

        default Chat getPrivateChat()
        Gets a direct private chat to the user.
        Returns:
        private chat, null if none is found.
      • getStatus

        default PlatformUser.Status getStatus()
        Finds the status of the platform user.
        Returns:
        current status.
      • createSender

        default ChatSender createSender​(Chat chat)
        Creates a sender for the user, using the specified chat as a target.
        Parameters:
        chat - Chat to use for responding to messages.
        Returns:
        ChatSender instance.