Class UserImpl

    • Constructor Detail

      • UserImpl

        public UserImpl​(DiscordApiImpl api,
                        com.fasterxml.jackson.databind.JsonNode data)
        Creates a new user.
        Parameters:
        api - The discord api instance.
        data - The json data of the user.
    • Method Detail

      • setChannel

        public void setChannel​(PrivateChannel channel)
        Sets the private channel with the user.
        Parameters:
        channel - The channel to set.
      • setActivity

        public void setActivity​(Activity activity)
        Sets the activity of the user.
        Parameters:
        activity - The activity to set.
      • setStatus

        public void setStatus​(UserStatus status)
        Sets the status of the user.
        Parameters:
        status - The status to set.
      • setClientStatus

        public void setClientStatus​(DiscordClient client,
                                    UserStatus status)
        Sets the client status of the user.
        Parameters:
        client - The client.
        status - The status to set.
      • setName

        public void setName​(String name)
        Sets the name of the user.
        Parameters:
        name - The name to set.
      • setDiscriminator

        public void setDiscriminator​(String discriminator)
        Sets the discriminator of the user.
        Parameters:
        discriminator - The discriminator to set.
      • getAvatarHash

        public String getAvatarHash​()
        Gets the avatar hash of the user. Might be null.
        Returns:
        The avatar hash of the user.
      • setAvatarHash

        public void setAvatarHash​(String avatarHash)
        Sets the avatar hash of the user.
        Parameters:
        avatarHash - The avatar hash to set.
      • getOrCreateChannel

        public PrivateChannel getOrCreateChannel​(com.fasterxml.jackson.databind.JsonNode data)
        Gets or creates a new private channel.
        Parameters:
        data - The data of the private channel.
        Returns:
        The private channel for the given data.
      • isBot

        public boolean isBot​()
        Specified by:
        isBot in interface User
      • getAvatar

        public static Icon getAvatar​(DiscordApi api,
                                     String avatarHash,
                                     String discriminator,
                                     long userId)
        Gets the avatar for the given details.
        Parameters:
        api - The discord api instance.
        avatarHash - The avatar hash or null for default avatar.
        discriminator - The discriminator if default avatar is wanted.
        userId - The user id.
        Returns:
        The avatar for the given details.
      • hasDefaultAvatar

        public boolean hasDefaultAvatar​()
        Specified by:
        hasDefaultAvatar in interface User
      • cleanup

        public void cleanup​()
        Description copied from interface: Cleanupable
        Does any cleanup that would prevent this instance from being eligible for garbage collection like cancelling scheduled repeated tasks or calling cleanup on "owned" cleanupable objects. This method has to be thread-safe and idempotent.
        Specified by:
        cleanup in interface Cleanupable
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class Object