Interface MemberAction

    • Method Detail

      • setCheck

        @Nonnull
        MemberAction setCheck​(@Nullable
                              java.util.function.BooleanSupplier checks)
        Description copied from interface: RestAction
        Sets the last-second checks before finally executing the http request in the queue.
        If the provided supplier evaluates to false or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.
        Specified by:
        setCheck in interface RestAction<java.lang.Void>
        Parameters:
        checks - The checks to run before executing the request, or null to run no checks
        Returns:
        The current RestAction for chaining convenience
        See Also:
        RestAction.getCheck(), RestAction.addCheck(BooleanSupplier)
      • timeout

        @Nonnull
        MemberAction timeout​(long timeout,
                             @Nonnull
                             java.util.concurrent.TimeUnit unit)
        Description copied from interface: RestAction
        Timeout for this RestAction instance.
        If the request doesn't get executed within the timeout it will fail.

        When a RestAction times out, it will fail with a TimeoutException. This is the same as deadline(System.currentTimeMillis() + unit.toMillis(timeout)).

        Example

        
         action.timeout(10, TimeUnit.SECONDS) // 10 seconds from now
               .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
         
        Specified by:
        timeout in interface RestAction<java.lang.Void>
        Parameters:
        timeout - The timeout to use
        unit - Unit for the timeout value
        Returns:
        The same RestAction instance with the applied timeout
        See Also:
        RestAction.setDefaultTimeout(long, TimeUnit)
      • deadline

        @Nonnull
        MemberAction deadline​(long timestamp)
        Description copied from interface: RestAction
        Similar to RestAction.timeout(long, TimeUnit) but schedules a deadline at which the request has to be completed.
        If the deadline is reached, the request will fail with a TimeoutException.

        This does not mean that the request will immediately timeout when the deadline is reached. JDA will check the deadline right before executing the request or within intervals in a worker thread. This only means the request will timeout if the deadline has passed.

        Example

        
         action.deadline(System.currentTimeMillis() + 10000) // 10 seconds from now
               .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
         
        Specified by:
        deadline in interface RestAction<java.lang.Void>
        Parameters:
        timestamp - Millisecond timestamp at which the request will timeout
        Returns:
        The same RestAction with the applied deadline
        See Also:
        RestAction.timeout(long, TimeUnit), RestAction.setDefaultTimeout(long, TimeUnit)
      • getAccessToken

        @Nonnull
        java.lang.String getAccessToken()
        The access token
        Returns:
        The access token
      • getUserId

        @Nonnull
        java.lang.String getUserId()
        The id of the user who will be added by this task
        Returns:
        The id of the user
      • getUser

        @Nullable
        User getUser()
        The user associated with the id
        Returns:
        Possibly-null user associated with the id
      • getGuild

        @Nonnull
        Guild getGuild()
        The Guild to which the user will be added.
        Returns:
        The Guild
      • setNickname

        @Nonnull
        @CheckReturnValue
        MemberAction setNickname​(@Nullable
                                 java.lang.String nick)
        Sets the nickname of the user for the guild.
        This will then be visible with Member.getNickname().
        Parameters:
        nick - The nickname, or null
        Returns:
        The current MemberAction for chaining
        Throws:
        java.lang.IllegalArgumentException - If the provided nickname is longer than 32 characters
      • setRoles

        @Nonnull
        @CheckReturnValue
        MemberAction setRoles​(@Nullable
                              java.util.Collection<Role> roles)
        Sets the roles of the user for the guild.
        This will then be visible with Member.getRoles().
        Parameters:
        roles - The roles, or null
        Returns:
        The current MemberAction for chaining
        Throws:
        java.lang.IllegalArgumentException - If one of the provided roles is null or not from the same guild
      • setRoles

        @Nonnull
        @CheckReturnValue
        MemberAction setRoles​(@Nullable
                              Role... roles)
        Sets the roles of the user for the guild.
        This will then be visible with Member.getRoles().
        Parameters:
        roles - The roles, or null
        Returns:
        The current MemberAction for chaining
        Throws:
        java.lang.IllegalArgumentException - If one of the provided roles is null or not from the same guild
      • setMute

        @Nonnull
        @CheckReturnValue
        MemberAction setMute​(boolean mute)
        Whether the user should be voice muted in the guild.
        Default: false
        Parameters:
        mute - Whether the user should be voice muted in the guild.
        Returns:
        The current MemberAction for chaining
      • setDeafen

        @Nonnull
        @CheckReturnValue
        MemberAction setDeafen​(boolean deaf)
        Whether the user should be voice deafened in the guild.
        Default: false
        Parameters:
        deaf - Whether the user should be voice deafened in the guild.
        Returns:
        The current MemberAction for chaining