Class GuildActionImpl
java.lang.Object
net.dv8tion.jda.internal.requests.RestActionImpl<Void>
net.dv8tion.jda.internal.requests.restaction.GuildActionImpl
- All Implemented Interfaces:
RestAction<Void>
,GuildAction
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.requests.restaction.GuildAction
GuildAction.ChannelData, GuildAction.RoleData
-
Field Summary
Fields inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
LOG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddChannel
(GuildAction.ChannelData channel) Adds aGuildChannel
to the resulting Guild.deadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.getChannel
(int index) Gets theChannelData
of the specified index.Retrieves theRoleData
for the public role (Guild.getPublicRole()
) for the resulting Guild.getRole
(int index) Retrieves theRoleData
for the provided index.newChannel
(ChannelType type, String name) Creates a newChannelData
instance and adds it to this GuildAction.newRole()
Creates and add a newRoleData
object representing a Role for the resulting Guild.removeChannel
(int index) Removes theChannelData
at the specified index and returns the removed object.Removes the providedChannelData
from this GuildAction if present.setCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.Sets theExplicitContentLevel
for the resultingGuild
Sets the name for the resultingGuild
Sets theNotificationLevel
for the resultingGuild
Sets theVerificationLevel
for the resultingGuild
Timeout for this RestAction instance.Methods inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
complete, getCheck, getDefaultFailure, getDefaultSuccess, getDefaultTimeout, getJDA, handleResponse, isPassContext, priority, queue, setDefaultFailure, setDefaultSuccess, setDefaultTimeout, setErrorMapper, setPassContext, submit
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Constructor Details
-
GuildActionImpl
-
-
Method Details
-
setCheck
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 interfaceGuildAction
- Specified by:
setCheck
in interfaceRestAction<Void>
- Overrides:
setCheck
in classRestActionImpl<Void>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- See Also:
-
timeout
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 asdeadline(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 interfaceGuildAction
- Specified by:
timeout
in interfaceRestAction<Void>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
deadline
Description copied from interface:RestAction
Similar toRestAction.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 aTimeoutException
.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 interfaceGuildAction
- Specified by:
deadline
in interfaceRestAction<Void>
- Overrides:
deadline
in classRestActionImpl<Void>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
setIcon
Description copied from interface:GuildAction
- Specified by:
setIcon
in interfaceGuildAction
- Parameters:
icon
- TheIcon
to use- Returns:
- The current GuildAction for chaining convenience
-
setName
Description copied from interface:GuildAction
Sets the name for the resultingGuild
- Specified by:
setName
in interfaceGuildAction
- Parameters:
name
- The name to use- Returns:
- The current GuildAction for chaining convenience
-
setVerificationLevel
@Nonnull @CheckReturnValue public GuildActionImpl setVerificationLevel(Guild.VerificationLevel level) Description copied from interface:GuildAction
Sets theVerificationLevel
for the resultingGuild
- Specified by:
setVerificationLevel
in interfaceGuildAction
- Parameters:
level
- TheVerificationLevel
to use- Returns:
- The current GuildAction for chaining convenience
-
setNotificationLevel
@Nonnull @CheckReturnValue public GuildActionImpl setNotificationLevel(Guild.NotificationLevel level) Description copied from interface:GuildAction
Sets theNotificationLevel
for the resultingGuild
- Specified by:
setNotificationLevel
in interfaceGuildAction
- Parameters:
level
- TheNotificationLevel
to use- Returns:
- The current GuildAction for chaining convenience
-
setExplicitContentLevel
@Nonnull @CheckReturnValue public GuildActionImpl setExplicitContentLevel(Guild.ExplicitContentLevel level) Description copied from interface:GuildAction
Sets theExplicitContentLevel
for the resultingGuild
- Specified by:
setExplicitContentLevel
in interfaceGuildAction
- Parameters:
level
- TheExplicitContentLevel
to use- Returns:
- The current GuildAction for chaining convenience
-
addChannel
@Nonnull @CheckReturnValue public GuildActionImpl addChannel(@Nonnull GuildAction.ChannelData channel) Description copied from interface:GuildAction
Adds aGuildChannel
to the resulting Guild. This cannot be of typeCATEGORY
!- Specified by:
addChannel
in interfaceGuildAction
- Parameters:
channel
- TheChannelData
to use for the construction of the GuildChannel- Returns:
- The current GuildAction for chaining convenience
-
getChannel
Description copied from interface:GuildAction
Gets theChannelData
of the specified index. The index is 0 based on insertion order ofGuildAction.addChannel(ChannelData)
!- Specified by:
getChannel
in interfaceGuildAction
- Parameters:
index
- The 0 based index of the channel- Returns:
- The current GuildAction for chaining convenience
-
removeChannel
Description copied from interface:GuildAction
Removes theChannelData
at the specified index and returns the removed object.- Specified by:
removeChannel
in interfaceGuildAction
- Parameters:
index
- The index of the channel- Returns:
- The removed object
-
removeChannel
@Nonnull @CheckReturnValue public GuildActionImpl removeChannel(@Nonnull GuildAction.ChannelData data) Description copied from interface:GuildAction
Removes the providedChannelData
from this GuildAction if present.- Specified by:
removeChannel
in interfaceGuildAction
- Parameters:
data
- The ChannelData to remove- Returns:
- The current GuildAction for chaining convenience
-
newChannel
@Nonnull @CheckReturnValue public GuildAction.ChannelData newChannel(@Nonnull ChannelType type, @Nonnull String name) Description copied from interface:GuildAction
Creates a newChannelData
instance and adds it to this GuildAction.- Specified by:
newChannel
in interfaceGuildAction
- Parameters:
type
- TheChannelType
of the resulting GuildChannel
This may be of typeTEXT
orVOICE
!name
- The name of the channel.- Returns:
- The new ChannelData instance
-
getPublicRole
Description copied from interface:GuildAction
Retrieves theRoleData
for the public role (Guild.getPublicRole()
) for the resulting Guild.
The public role is also known in the official client as the@everyone
role.You can only change the permissions of the public role!
- Specified by:
getPublicRole
in interfaceGuildAction
- Returns:
- RoleData of the public role
-
getRole
Description copied from interface:GuildAction
Retrieves theRoleData
for the provided index.
The public role is at the index 0 and all others are ordered by insertion order!- Specified by:
getRole
in interfaceGuildAction
- Parameters:
index
- The index of the role- Returns:
- RoleData of the provided index
-
newRole
Description copied from interface:GuildAction
Creates and add a newRoleData
object representing a Role for the resulting Guild.This can be used in
ChannelData.addPermissionOverride(...)
.
You may change any properties of thisRoleData
instance!- Specified by:
newRole
in interfaceGuildAction
- Returns:
- RoleData for the new Role
-