public class GuildCreateSpec extends Object implements Spec<discord4j.discordjson.json.GuildCreateRequest>
Guild
. This can only be used for bots in less than 10 guilds.
This spec also has some limitations to it. The name, region, verification level, and default message notification
level are all required to be able to properly build the spec. The first role added, either from
addEveryoneRole(java.util.function.Consumer<? super discord4j.core.spec.RoleCreateSpec>)
or addRole(java.util.function.Consumer<? super discord4j.core.spec.RoleCreateSpec>)
, will automatically be set as the default @everyone role. Each
subsequent call to addEveryoneRole(java.util.function.Consumer<? super discord4j.core.spec.RoleCreateSpec>)
will not override the first role but shift all other roles down.
Constructor and Description |
---|
GuildCreateSpec() |
Modifier and Type | Method and Description |
---|---|
GuildCreateSpec |
addChannel(String name,
Channel.Type type)
Adds the channel to the list of channels for the created
Guild . |
GuildCreateSpec |
addEveryoneRole(Consumer<? super RoleCreateSpec> roleSpec)
Sets the default @everyone role for the created
Guild . |
GuildCreateSpec |
addRole(Consumer<? super RoleCreateSpec> roleSpec)
Adds the role spec to the list of roles for the created
Guild . |
discord4j.discordjson.json.GuildCreateRequest |
asRequest() |
GuildCreateSpec |
setDefaultMessageNotificationLevel(Guild.NotificationLevel notificationLevel)
Sets the default message notification level for the created
Guild . |
GuildCreateSpec |
setExplicitContentFilter(Guild.ContentFilterLevel explicitContentFilter)
Sets the explicit content filter level for the created
Guild . |
GuildCreateSpec |
setIcon(Image icon)
Sets the image icon to display for the created
Guild . |
GuildCreateSpec |
setName(String name)
Sets the name for the created
Guild . |
GuildCreateSpec |
setRegion(Region region)
Sets the voice region for the created
Guild . |
GuildCreateSpec |
setVerificationLevel(Guild.VerificationLevel verificationLevel)
Sets the verification level required before a member can send messages in the created
Guild . |
public GuildCreateSpec setName(String name)
Guild
.name
- The name of the guild.public GuildCreateSpec setRegion(Region region)
Guild
.region
- The voice region for the guild.public GuildCreateSpec setIcon(@Nullable Image icon)
Guild
.icon
- The icon for the guild.public GuildCreateSpec setVerificationLevel(Guild.VerificationLevel verificationLevel)
Guild
.verificationLevel
- The verification level for the guild.public GuildCreateSpec setDefaultMessageNotificationLevel(Guild.NotificationLevel notificationLevel)
Guild
.notificationLevel
- The default notification level for the guild.public GuildCreateSpec setExplicitContentFilter(Guild.ContentFilterLevel explicitContentFilter)
Guild
.explicitContentFilter
- The explicit content filter level for the guild.public GuildCreateSpec addRole(Consumer<? super RoleCreateSpec> roleSpec)
Guild
.roleSpec
- The role spec to add to the list of roles.public GuildCreateSpec addEveryoneRole(Consumer<? super RoleCreateSpec> roleSpec)
Guild
. 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 GuildCreateSpec
.
roleSpec
- The default @everyone role spec to add to the list of roles.public GuildCreateSpec addChannel(String name, Channel.Type type)
Guild
.name
- The name of the channel.type
- The type of the channel.