Struct serenity::builder::CreateChannel
source · [−]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
sourceimpl CreateChannel
impl CreateChannel
sourcepub fn name<D: ToString>(&mut self, name: D) -> &mut Self
pub fn name<D: ToString>(&mut self, name: D) -> &mut Self
Specify how to call this new channel.
Note: Must be between 2 and 100 characters long.
sourcepub fn kind(&mut self, kind: ChannelType) -> &mut Self
pub fn kind(&mut self, kind: ChannelType) -> &mut Self
Specify what type the channel is, whether it’s a text, voice, category or news channel.
sourcepub fn category<I: Into<ChannelId>>(&mut self, id: I) -> &mut Self
pub fn category<I: Into<ChannelId>>(&mut self, id: I) -> &mut Self
Specify the category, the “parent” of this channel.
sourcepub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self
pub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self
Set an interesting topic.
Note: Must be between 0 and 1000 characters long.
sourcepub fn nsfw(&mut self, b: bool) -> &mut Self
pub fn nsfw(&mut self, b: bool) -> &mut Self
Specify if this channel will be inappropriate to browse while at work.
sourcepub fn bitrate(&mut self, rate: u32) -> &mut Self
pub fn bitrate(&mut self, rate: u32) -> &mut Self
[Voice-only] Specify the bitrate at which sound plays in the voice channel.
sourcepub fn user_limit(&mut self, limit: u32) -> &mut Self
pub fn user_limit(&mut self, limit: u32) -> &mut Self
[Voice-only] Set how many users may occupy this voice channel.
sourcepub fn rate_limit_per_user(&mut self, seconds: u64) -> &mut Self
pub fn rate_limit_per_user(&mut self, seconds: u64) -> &mut Self
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).
sourcepub fn permissions<I>(&mut self, perms: I) -> &mut Self where
I: IntoIterator<Item = PermissionOverwrite>,
pub fn permissions<I>(&mut self, perms: I) -> &mut Self where
I: IntoIterator<Item = PermissionOverwrite>,
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
sourceimpl Clone for CreateChannel
impl Clone for CreateChannel
sourcefn clone(&self) -> CreateChannel
fn clone(&self) -> CreateChannel
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CreateChannel
impl Debug for CreateChannel
sourceimpl Default for CreateChannel
impl Default for CreateChannel
sourcefn default() -> Self
fn default() -> Self
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
impl RefUnwindSafe for CreateChannel
impl Send for CreateChannel
impl Sync for CreateChannel
impl Unpin for CreateChannel
impl UnwindSafe for CreateChannel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more