Class LegacyGuildCreateSpec
- java.lang.Object
-
- discord4j.core.spec.legacy.LegacyGuildCreateSpec
-
- All Implemented Interfaces:
LegacySpec<discord4j.discordjson.json.GuildCreateRequest>
public class LegacyGuildCreateSpec extends Object implements LegacySpec<discord4j.discordjson.json.GuildCreateRequest>
A spec used to configure and create aGuild. This can only be used for bots in less than 10 guilds.This spec also has some limitations to it. - The first role added, either from
addEveryoneRole(java.util.function.Consumer<? super discord4j.core.spec.legacy.LegacyRoleCreateSpec>)oraddRole(java.util.function.Consumer<? super discord4j.core.spec.legacy.LegacyRoleCreateSpec>), will automatically be set as the default @everyone role. Each subsequent call toaddEveryoneRole(java.util.function.Consumer<? super discord4j.core.spec.legacy.LegacyRoleCreateSpec>)will not override the first role but shift all other roles down. - When using the channels parameter, the position field is ignored, and none of the default channels are created.- See Also:
- Create Guild
-
-
Constructor Summary
Constructors Constructor Description LegacyGuildCreateSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LegacyGuildCreateSpecaddChannel(String name, Channel.Type type)Adds the channel to the list of channels for the createdGuild.LegacyGuildCreateSpecaddEveryoneRole(Consumer<? super LegacyRoleCreateSpec> legacyroleSpec)Sets the default @everyone role for the createdGuild.LegacyGuildCreateSpecaddRole(Consumer<? super LegacyRoleCreateSpec> legacyroleSpec)Adds the role spec to the list of roles for the createdGuild.discord4j.discordjson.json.GuildCreateRequestasRequest()LegacyGuildCreateSpecsetAfkChannelId(Snowflake id)Sets the ID of the AFK channel for the createdGuild.LegacyGuildCreateSpecsetAfkTimeout(Integer afkTimeout)Sets the AFK timeout, in seconds, for the createdGuild.LegacyGuildCreateSpecsetDefaultMessageNotificationLevel(Guild.NotificationLevel notificationLevel)Sets the default message notification level for the createdGuild.LegacyGuildCreateSpecsetExplicitContentFilter(Guild.ContentFilterLevel explicitContentFilter)Sets the explicit content filter level for the createdGuild.LegacyGuildCreateSpecsetIcon(Image icon)Sets the image icon to display for the createdGuild.LegacyGuildCreateSpecsetName(String name)Sets the name for the createdGuild.LegacyGuildCreateSpecsetRegion(Region.Id regionId)Sets the voice region id for the createdGuild.LegacyGuildCreateSpecsetRegion(String regionId)Sets the voice region id for the createdGuild, automatic if null.LegacyGuildCreateSpecsetSystemChannelFlags(Guild.SystemChannelFlag... flags)Sets the system channel flags for the createdGuild.LegacyGuildCreateSpecsetSystemChannelId(Snowflake id)Sets the id of the channel where guild notices such as welcome messages and boost events are posted for the createdGuild.LegacyGuildCreateSpecsetVerificationLevel(Guild.VerificationLevel verificationLevel)Sets the verification level required before a member can send messages in the createdGuild.
-
-
-
Method Detail
-
setName
public LegacyGuildCreateSpec setName(String name)
Sets the name for the createdGuild.- Parameters:
name- The name of the guild.- Returns:
- This spec.
-
setRegion
public LegacyGuildCreateSpec setRegion(Region.Id regionId)
Sets the voice region id for the createdGuild.- Parameters:
regionId- The voice region id for the guild.- Returns:
- This spec.
-
setRegion
public LegacyGuildCreateSpec setRegion(@Nullable String regionId)
Sets the voice region id for the createdGuild, automatic if null.- Parameters:
regionId- The voice region id for the guild, automatic if null.- Returns:
- This spec.
-
setIcon
public LegacyGuildCreateSpec setIcon(@Nullable Image icon)
Sets the image icon to display for the createdGuild.- Parameters:
icon- The icon for the guild.- Returns:
- This spec.
-
setVerificationLevel
public LegacyGuildCreateSpec setVerificationLevel(@Nullable Guild.VerificationLevel verificationLevel)
Sets the verification level required before a member can send messages in the createdGuild.- Parameters:
verificationLevel- The verification level for the guild.- Returns:
- This spec.
-
setDefaultMessageNotificationLevel
public LegacyGuildCreateSpec setDefaultMessageNotificationLevel(@Nullable Guild.NotificationLevel notificationLevel)
Sets the default message notification level for the createdGuild.- Parameters:
notificationLevel- The default notification level for the guild.- Returns:
- This spec.
-
setExplicitContentFilter
public LegacyGuildCreateSpec setExplicitContentFilter(@Nullable Guild.ContentFilterLevel explicitContentFilter)
Sets the explicit content filter level for the createdGuild.- Parameters:
explicitContentFilter- The explicit content filter level for the guild.- Returns:
- This spec.
-
addRole
public LegacyGuildCreateSpec addRole(Consumer<? super LegacyRoleCreateSpec> legacyroleSpec)
Adds the role spec to the list of roles for the createdGuild.- Parameters:
legacyroleSpec- The role spec to add to the list of roles.- Returns:
- This spec.
-
addEveryoneRole
public LegacyGuildCreateSpec addEveryoneRole(Consumer<? super LegacyRoleCreateSpec> legacyroleSpec)
Sets the default @everyone role for the createdGuild. This shifts all other roles in the list, if present, down by one. It does not replace other @everyone roles already set.When creating a guild, Discord automatically takes the first role in the role array as the default @everyone role. See this limitation and others at
LegacyGuildCreateSpec.- Parameters:
legacyroleSpec- The default @everyone role spec to add to the list of roles.- Returns:
- This spec.
-
addChannel
public LegacyGuildCreateSpec addChannel(String name, Channel.Type type)
Adds the channel to the list of channels for the createdGuild.- Parameters:
name- The name of the channel.type- The type of the channel.- Returns:
- This spec.
-
setAfkChannelId
public LegacyGuildCreateSpec setAfkChannelId(@Nullable Snowflake id)
Sets the ID of the AFK channel for the createdGuild.- Parameters:
id- id for afk channel- Returns:
- This spec.
-
setAfkTimeout
public LegacyGuildCreateSpec setAfkTimeout(@Nullable Integer afkTimeout)
Sets the AFK timeout, in seconds, for the createdGuild.- Parameters:
afkTimeout- The AFK timeout, in seconds.- Returns:
- This spec.
-
setSystemChannelId
public LegacyGuildCreateSpec setSystemChannelId(@Nullable Snowflake id)
Sets the id of the channel where guild notices such as welcome messages and boost events are posted for the createdGuild.- Parameters:
id- The id of the channel where guild notices such as welcome messages and boost events are posted.- Returns:
- This spec.
-
setSystemChannelFlags
public LegacyGuildCreateSpec setSystemChannelFlags(@Nullable Guild.SystemChannelFlag... flags)
Sets the system channel flags for the createdGuild.- Parameters:
flags- The system channel flags.- Returns:
- This spec.
-
asRequest
public discord4j.discordjson.json.GuildCreateRequest asRequest()
- Specified by:
asRequestin interfaceLegacySpec<discord4j.discordjson.json.GuildCreateRequest>
-
-