Interface GuildAction
- 
- All Superinterfaces:
- RestAction<java.lang.Void>
 
 public interface GuildAction extends RestAction<java.lang.Void> RestActionextension specifically designed to allow for the creation ofGuilds.
 This is available to all account types but may undergo certain restrictions by Discord.- Since:
- 3.4.0
- See Also:
- JDA.createGuild(String)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classGuildAction.ChannelDatastatic classGuildAction.RoleData
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description GuildActionaddChannel(GuildAction.ChannelData channel)Adds aGuildChannelto the resulting Guild.GuildActiondeadline(long timestamp)Similar toRestAction.timeout(long, TimeUnit)but schedules a deadline at which the request has to be completed.GuildAction.ChannelDatagetChannel(int index)Gets theChannelDataof the specified index.GuildAction.RoleDatagetPublicRole()Retrieves theRoleDatafor the public role (Guild.getPublicRole()) for the resulting Guild.GuildAction.RoleDatagetRole(int index)Retrieves theRoleDatafor the provided index.GuildAction.ChannelDatanewChannel(ChannelType type, java.lang.String name)Creates a newChannelDatainstance and adds it to this GuildAction.GuildAction.RoleDatanewRole()Creates and add a newRoleDataobject representing a Role for the resulting Guild.GuildAction.ChannelDataremoveChannel(int index)Removes theChannelDataat the specified index and returns the removed object.GuildActionremoveChannel(GuildAction.ChannelData data)Removes the providedChannelDatafrom this GuildAction if present.GuildActionsetCheck(java.util.function.BooleanSupplier checks)Sets the last-second checks before finally executing the http request in the queue.GuildActionsetExplicitContentLevel(Guild.ExplicitContentLevel level)Sets theExplicitContentLevelfor the resultingGuildGuildActionsetIcon(Icon icon)GuildActionsetName(java.lang.String name)Sets the name for the resultingGuildGuildActionsetNotificationLevel(Guild.NotificationLevel level)Sets theNotificationLevelfor the resultingGuildGuildActionsetRegion(Region region)Deprecated.Guilds no longer have theRegionoption.GuildActionsetVerificationLevel(Guild.VerificationLevel level)Sets theVerificationLevelfor the resultingGuildGuildActiontimeout(long timeout, java.util.concurrent.TimeUnit unit)Timeout for this RestAction instance.- 
Methods inherited from interface net.dv8tion.jda.api.requests.RestActionaddCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
 
- 
 
- 
- 
- 
Method Detail- 
setCheck@Nonnull GuildAction setCheck(@Nullable java.util.function.BooleanSupplier checks) Description copied from interface:RestActionSets the last-second checks before finally executing the http request in the queue.
 If the provided supplier evaluates tofalseor 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:
- setCheckin interface- RestAction<java.lang.Void>
- Parameters:
- checks- The checks to run before executing the request, or- nullto run no checks
- Returns:
- The current RestAction for chaining convenience
- See Also:
- RestAction.getCheck(),- RestAction.addCheck(BooleanSupplier)
 
 - 
timeout@Nonnull GuildAction timeout(long timeout, @Nonnull java.util.concurrent.TimeUnit unit) Description copied from interface:RestActionTimeout 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)).Exampleaction.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:
- timeoutin interface- RestAction<java.lang.Void>
- Parameters:
- timeout- The timeout to use
- unit-- Unitfor the timeout value
- Returns:
- The same RestAction instance with the applied timeout
- See Also:
- RestAction.setDefaultTimeout(long, TimeUnit)
 
 - 
deadline@Nonnull GuildAction deadline(long timestamp) Description copied from interface:RestActionSimilar 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. Exampleaction.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:
- deadlinein 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)
 
 - 
setRegion@Nonnull @CheckReturnValue @Deprecated @ForRemoval(deadline="5.0.0") @ReplaceWith("ChannelManager.setRegion()") @DeprecatedSince("4.3.0") GuildAction setRegion(@Nullable Region region) Deprecated.Guilds no longer have theRegionoption. UseChannelManager.setRegion(Region)instead.- Parameters:
- region- The- Regionto use
- Returns:
- The current GuildAction for chaining convenience
- Throws:
- java.lang.IllegalArgumentException- If the provided region is a VIP region as per- Region.isVip()
 
 - 
setIcon@Nonnull @CheckReturnValue GuildAction setIcon(@Nullable Icon icon) - Parameters:
- icon- The- Iconto use
- Returns:
- The current GuildAction for chaining convenience
 
 - 
setName@Nonnull @CheckReturnValue GuildAction setName(@Nonnull java.lang.String name) Sets the name for the resultingGuild- Parameters:
- name- The name to use
- Returns:
- The current GuildAction for chaining convenience
- Throws:
- java.lang.IllegalArgumentException- If the provided name is- null, blank or not between 2-100 characters long
 
 - 
setVerificationLevel@Nonnull @CheckReturnValue GuildAction setVerificationLevel(@Nullable Guild.VerificationLevel level) Sets theVerificationLevelfor the resultingGuild- Parameters:
- level- The- VerificationLevelto use
- Returns:
- The current GuildAction for chaining convenience
 
 - 
setNotificationLevel@Nonnull @CheckReturnValue GuildAction setNotificationLevel(@Nullable Guild.NotificationLevel level) Sets theNotificationLevelfor the resultingGuild- Parameters:
- level- The- NotificationLevelto use
- Returns:
- The current GuildAction for chaining convenience
 
 - 
setExplicitContentLevel@Nonnull @CheckReturnValue GuildAction setExplicitContentLevel(@Nullable Guild.ExplicitContentLevel level) Sets theExplicitContentLevelfor the resultingGuild- Parameters:
- level- The- ExplicitContentLevelto use
- Returns:
- The current GuildAction for chaining convenience
 
 - 
addChannel@Nonnull @CheckReturnValue GuildAction addChannel(@Nonnull GuildAction.ChannelData channel) Adds aGuildChannelto the resulting Guild. This cannot be of typeCATEGORY!- Parameters:
- channel- The- ChannelDatato use for the construction of the GuildChannel
- Returns:
- The current GuildAction for chaining convenience
- Throws:
- java.lang.IllegalArgumentException- If the provided channel is- null!
 
 - 
getChannel@Nonnull @CheckReturnValue GuildAction.ChannelData getChannel(int index) Gets theChannelDataof the specified index. The index is 0 based on insertion order ofaddChannel(ChannelData)!- Parameters:
- index- The 0 based index of the channel
- Returns:
- The current GuildAction for chaining convenience
- Throws:
- java.lang.IndexOutOfBoundsException- If the provided index is not in bounds
 
 - 
removeChannel@Nonnull @CheckReturnValue GuildAction.ChannelData removeChannel(int index) Removes theChannelDataat the specified index and returns the removed object.- Parameters:
- index- The index of the channel
- Returns:
- The removed object
- Throws:
- java.lang.IndexOutOfBoundsException- If the index is out of bounds
 
 - 
removeChannel@Nonnull @CheckReturnValue GuildAction removeChannel(@Nonnull GuildAction.ChannelData data) Removes the providedChannelDatafrom this GuildAction if present.- Parameters:
- data- The ChannelData to remove
- Returns:
- The current GuildAction for chaining convenience
 
 - 
newChannel@Nonnull @CheckReturnValue GuildAction.ChannelData newChannel(@Nonnull ChannelType type, @Nonnull java.lang.String name) Creates a newChannelDatainstance and adds it to this GuildAction.- Parameters:
- type- The- ChannelTypeof the resulting GuildChannel
 This may be of type- TEXTor- VOICE!
- name- The name of the channel. This must be alphanumeric with underscores for type TEXT
- Returns:
- The new ChannelData instance
- Throws:
- java.lang.IllegalArgumentException-- If provided with an invalid ChannelType
- If the provided name is nullor blank
- If the provided name is not between 2-100 characters long
- If the type is TEXT and the provided name is not alphanumeric with underscores
 
 
 - 
getPublicRole@Nonnull @CheckReturnValue GuildAction.RoleData getPublicRole() Retrieves theRoleDatafor the public role (Guild.getPublicRole()) for the resulting Guild.
 The public role is also known in the official client as the@everyonerole.You can only change the permissions of the public role! - Returns:
- RoleData of the public role
 
 - 
getRole@Nonnull @CheckReturnValue GuildAction.RoleData getRole(int index) Retrieves theRoleDatafor the provided index.
 The public role is at the index 0 and all others are ordered by insertion order!- Parameters:
- index- The index of the role
- Returns:
- RoleData of the provided index
- Throws:
- java.lang.IndexOutOfBoundsException- If the provided index is out of bounds
 
 - 
newRole@Nonnull @CheckReturnValue GuildAction.RoleData newRole() Creates and add a newRoleDataobject representing a Role for the resulting Guild.This can be used in ChannelData.addPermissionOverride(...).
 You may change any properties of thisRoleDatainstance!- Returns:
- RoleData for the new Role
 
 
- 
 
-