Interface MemberAction
-
- All Superinterfaces:
RestAction<Void>
public interface MemberAction extends RestAction<Void>
RestAction
extension specifically designed to allow bots to addUsers
to Guilds.
This requires an OAuth2 Access Token with the scopeguilds.join
to work!
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getAccessToken()
The access tokenGuild
getGuild()
TheGuild
to which the user will be added.User
getUser()
The user associated with the idString
getUserId()
The id of the user who will be added by this taskMemberAction
setCheck(BooleanSupplier checks)
Sets the last-second checks before finally executing the http request in the queue.MemberAction
setDeafen(boolean deaf)
Whether the user should be voice deafened in the guild.MemberAction
setMute(boolean mute)
Whether the user should be voice muted in the guild.MemberAction
setNickname(String nick)
Sets the nickname of the user for the guild.MemberAction
setRoles(Collection<Role> roles)
Sets the roles of the user for the guild.MemberAction
setRoles(Role... roles)
Sets the roles of the user for the guild.-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
complete, complete, completeAfter, getJDA, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter
-
-
-
-
Method Detail
-
setCheck
@Nonnull MemberAction setCheck(@Nullable 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 tofalse
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 interfaceRestAction<Void>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
-
getUserId
@Nonnull 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
-
setNickname
@Nonnull @CheckReturnValue MemberAction setNickname(@Nullable String nick)
Sets the nickname of the user for the guild.
This will then be visible withMember.getNickname()
.- Parameters:
nick
- The nickname, ornull
- Returns:
- The current MemberAction for chaining
- Throws:
IllegalArgumentException
- If the provided nickname is longer than 32 characters
-
setRoles
@Nonnull @CheckReturnValue MemberAction setRoles(@Nullable Collection<Role> roles)
Sets the roles of the user for the guild.
This will then be visible withMember.getRoles()
.- Parameters:
roles
- The roles, ornull
- Returns:
- The current MemberAction for chaining
- Throws:
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 withMember.getRoles()
.- Parameters:
roles
- The roles, ornull
- Returns:
- The current MemberAction for chaining
- Throws:
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
-
-