pub struct CreateChannel(pub HashMap<&'static str, Value>);
Available on crate feature builder only.
Expand description

A builder for creating a new GuildChannel in a Guild.

Except Self::name, all fields are optional.

Tuple Fields

0: HashMap<&'static str, Value>

Implementations

Specify how to call this new channel.

Note: Must be between 2 and 100 characters long.

Specify what type the channel is, whether it’s a text, voice, category or news channel.

Specify the category, the “parent” of this channel.

Set an interesting topic.

Note: Must be between 0 and 1000 characters long.

Specify if this channel will be inappropriate to browse while at work.

[Voice-only] Specify the bitrate at which sound plays in the voice channel.

[Voice-only] Set how many users may occupy this voice channel.

How many seconds must a user wait before sending another message.

Bots, or users with the MANAGE_MESSAGES and/or MANAGE_CHANNELS permissions are exempt from this restriction.

Note: Must be between 0 and 21600 seconds (360 minutes or 6 hours).

Specify where the channel should be located.

A set of overwrites defining what a user or a user carrying a certain role can and cannot do.

Example

Inheriting permissions from an existing channel:

use serenity::model::channel::{PermissionOverwrite, PermissionOverwriteType};
use serenity::model::id::UserId;
use serenity::model::permissions::Permissions;

// Assuming a guild has already been bound.
let permissions = vec![PermissionOverwrite {
    allow: Permissions::VIEW_CHANNEL,
    deny: Permissions::SEND_TTS_MESSAGES,
    kind: PermissionOverwriteType::Member(UserId(1234)),
}];

guild.create_channel(http, |c| c.name("my_new_cool_channel").permissions(permissions)).await?;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a builder with default values, setting Self::kind to ChannelType::Text.

Examples

Create a default CreateChannel builder:

use serenity::builder::CreateChannel;

let channel_builder = CreateChannel::default();

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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