[][src]Struct twilight_http::request::guild::create_guild::CreateGuild

pub struct CreateGuild<'a> { /* fields omitted */ }

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.

Errors

Returns CreateGuildError::NameInvalid if the name length is too short or too long.

Implementations

impl<'a> CreateGuild<'a>[src]

pub fn add_role(mut self: Self, role: impl Into<RoleFields>) -> Self[src]

Add a role to the list of roles.

pub fn channels(
    mut self: Self,
    channels: Vec<GuildChannelFields>
) -> Result<Self, CreateGuildError>
[src]

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")?;
let voice = VoiceFieldsBuilder::new("voice channel")?;
let text2 = TextFieldsBuilder::new("other text channel")?
    .topic("posting")?;

let category = CategoryFieldsBuilder::new("category channel")?
    .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")?.channels(channels)?.await?;

Errors

Returns CreateGuildError::TooManyChannels if the number of channels is over 500.

pub fn default_message_notifications(
    mut self: Self,
    default_message_notifications: DefaultMessageNotificationLevel
) -> Self
[src]

Set the default message notification level. Refer to the discord docs for more information.

pub fn explicit_content_filter(
    mut self: Self,
    explicit_content_filter: ExplicitContentFilter
) -> Self
[src]

Set the explicit content filter level.

pub fn icon(mut self: Self, icon: impl Into<String>) -> Self[src]

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.

pub fn override_everyone(
    mut self: Self,
    everyone: impl Into<RoleFields>
) -> Self
[src]

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.

pub fn region(mut self: Self, region: impl Into<String>) -> Self[src]

Specify the voice server region for the guild. Refer to the discord docs for more information.

pub fn roles(
    mut self: Self,
    mut roles: Vec<RoleFields>
) -> Result<Self, CreateGuildError>
[src]

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").color(0x543923)?.build()];
client.create_guild("guild name")?.roles(roles)?.await?;

Errors

Returns CreateGuildError::TooManyRoles if the number of roles is over 250.

Trait Implementations

impl Future for CreateGuild<'_>[src]

type Output = Result<PartialGuild>

The type of value produced on completion.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for CreateGuild<'a>[src]

impl<'a> Send for CreateGuild<'a>[src]

impl<'a> !Sync for CreateGuild<'a>[src]

impl<'a> Unpin for CreateGuild<'a>[src]

impl<'a> !UnwindSafe for CreateGuild<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,