Struct twilight_http::request::guild::create_guild::CreateGuild
source · [−]pub struct CreateGuild<'a> { /* private fields */ }
Expand description
Create a new request to create a guild.
The minimum length of the name is 2 UTF-16 characters and the maximum is 100 UTF-16 characters. This endpoint can only be used by bots in less than 10 guilds.
Implementations
Add a role to the list of roles.
Set the ID of the AFK voice channel.
This must be an ID specified in channels
.
Set the AFK timeout, in seconds.
Set the channels to create with the guild.
The maximum number of channels that can be provided is 500.
Examples
use twilight_http::{
Client,
request::guild::create_guild::{
GuildChannelFieldsBuilder, CategoryFieldsBuilder, TextFieldsBuilder,
VoiceFieldsBuilder,
},
};
let text = TextFieldsBuilder::new("text channel".to_owned())?.build();
let voice = VoiceFieldsBuilder::new("voice channel".to_owned())?.build();
let text2 = TextFieldsBuilder::new("other text channel".to_owned())?
.topic("posting".to_owned())?
.build();
let category = CategoryFieldsBuilder::new("category channel".to_owned())?
.add_text(text2)
.add_voice(voice);
let channels = GuildChannelFieldsBuilder::new()
.add_text(text)
.add_category_builder(category)
.build();
let guild = client.create_guild("guild name".to_owned())?
.channels(channels)?
.exec()
.await?;
Errors
Returns a CreateGuildErrorType::TooManyChannels
error type if the
number of channels is over 500.
pub const fn default_message_notifications(
self,
default_message_notifications: DefaultMessageNotificationLevel
) -> Self
pub const fn default_message_notifications(
self,
default_message_notifications: DefaultMessageNotificationLevel
) -> Self
Set the default message notification level. Refer to the discord docs for more information.
pub const fn explicit_content_filter(
self,
explicit_content_filter: ExplicitContentFilter
) -> Self
pub const fn explicit_content_filter(
self,
explicit_content_filter: ExplicitContentFilter
) -> Self
Set the explicit content filter level.
Set the icon.
This must be a Data URI, in the form of data:image/{type};base64,{data}
where {type}
is
the image MIME type and {data}
is the base64-encoded image. Refer to the discord docs
for more information.
Override the everyone role of the guild.
If there are not yet roles set with roles
, this will create a role override in the
first position. Discord understands the first role in the list to override @everyone.
If there are roles, this replaces the first role in the position.
Set the channel where system messages will be posted.
This must be an ID specified in channels
.
Set the guild’s SystemChannelFlags
.
Set the roles to create with the guild.
The maximum number of roles that can be provided is 250.
Examples
use twilight_http::{Client, request::guild::create_guild::RoleFieldsBuilder};
let roles = vec![RoleFieldsBuilder::new("role 1".to_owned()).color(0x543923)?.build()];
client.create_guild("guild name".to_owned())?.roles(roles)?.exec().await?;
Errors
Returns a CreateGuildErrorType::TooManyRoles
error type if the
number of roles is over 250.
pub fn exec(self) -> ResponseFuture<PartialGuild>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
pub fn exec(self) -> ResponseFuture<PartialGuild>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
Execute the request, returning a future resolving to a Response
.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for CreateGuild<'a>
impl<'a> Send for CreateGuild<'a>
impl<'a> Sync for CreateGuild<'a>
impl<'a> Unpin for CreateGuild<'a>
impl<'a> !UnwindSafe for CreateGuild<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more