[][src]Struct serenity::builder::CreateChannel

pub struct CreateChannel(pub HashMap<&'static str, Value>);

A builder for creating a new GuildChannel in a Guild.

Except name, all fields are optional.

Implementations

impl CreateChannel[src]

pub fn name<D: ToString>(&mut self, name: D) -> &mut Self[src]

Specify how to call this new channel.

Note: Must be between 2 and 100 characters long.

pub fn kind(&mut self, kind: ChannelType) -> &mut Self[src]

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

pub fn category<I: Into<ChannelId>>(&mut self, id: I) -> &mut Self[src]

Specifiy the category, the "parent" of this channel.

pub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self[src]

Set an interesting topic.

Note: Must be between 0 and 1000 characters long.

pub fn nsfw(&mut self, b: bool) -> &mut Self[src]

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

pub fn bitrate(&mut self, rate: u32) -> &mut Self[src]

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

pub fn user_limit(&mut self, limit: u32) -> &mut Self[src]

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

pub fn rate_limit(&mut self, limit: u64) -> &mut Self[src]

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

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

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

pub fn position(&mut self, pos: u32) -> &mut Self[src]

Specify where the channel should be located.

pub fn permissions<I>(&mut self, perms: I) -> &mut Self where
    I: IntoIterator<Item = PermissionOverwrite>, 
[src]

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

Example

Inheriting permissions from an exisiting channel:

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

// Assuming a guild have already been bound.
let permissions = Some(PermissionOverwrite {
    allow: Permissions::READ_MESSAGES,
    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

impl Clone for CreateChannel[src]

impl Debug for CreateChannel[src]

impl Default for CreateChannel[src]

fn default() -> Self[src]

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

Examples

Create a default CreateChannel builder:

use serenity::builder::CreateChannel;

let channel_builder = CreateChannel::default();

Auto Trait Implementations

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<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>,