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

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

A builder for creating a new GuildChannel in a Guild.

Except Self::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/or MANAGE_CHANNELS 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 has already been bound.
let permissions = vec![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]

fn clone(&self) -> CreateChannel[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for CreateChannel[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for CreateChannel[src]

fn default() -> Self[src]

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

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V