#[non_exhaustive]pub struct ChannelCategory {
pub id: ChannelId,
pub guild_id: GuildId,
pub parent_id: Option<ChannelId>,
pub position: i64,
pub kind: ChannelType,
pub name: String,
pub nsfw: bool,
pub permission_overwrites: Vec<PermissionOverwrite>,
}
Expand description
A category of GuildChannel
s.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.id: ChannelId
Id of this category.
guild_id: GuildId
Guild Id this category belongs to.
parent_id: Option<ChannelId>
If this category belongs to another category.
position: i64
The position of this category.
kind: ChannelType
Indicator of the type of channel this is.
This should always be ChannelType::Category
.
name: String
The name of the category.
nsfw: bool
Whether this category is nsfw. (This’ll be inherited by all channels in this category)
permission_overwrites: Vec<PermissionOverwrite>
Permission overwrites for the GuildChannel
s.
Implementations
sourceimpl ChannelCategory
impl ChannelCategory
sourcepub async fn create_permission(
&self,
http: impl AsRef<Http>,
target: &PermissionOverwrite
) -> Result<()>
Available on crate feature model
only.
pub async fn create_permission(
&self,
http: impl AsRef<Http>,
target: &PermissionOverwrite
) -> Result<()>
model
only.Adds a permission overwrite to the category’s channels.
Note: Requires the Manage Channels permission.
Also requires the Manage Roles permission if not modifying the permissions for only the current user.
Errors
Returns Error::Http
if the current user lacks permission,
or if an invalid value was set.
sourcepub async fn delete_permission(
&self,
http: impl AsRef<Http>,
permission_type: PermissionOverwriteType
) -> Result<()>
Available on crate feature model
only.
pub async fn delete_permission(
&self,
http: impl AsRef<Http>,
permission_type: PermissionOverwriteType
) -> Result<()>
model
only.Deletes all permission overrides in the category from the channels.
Note: Requires the Manage Roles permission.
Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
Available on crate feature model
only.
pub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
model
only.Deletes this category.
Note: Requires the Manage Channels permission.
Errors
Returns Error::Http
if the current user lacks permission.
sourcepub async fn edit<F>(&mut self, cache_http: impl CacheHttp, f: F) -> Result<()> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
Available on crate feature model
only.
pub async fn edit<F>(&mut self, cache_http: impl CacheHttp, f: F) -> Result<()> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
model
only.Modifies the category’s settings, such as its position or name.
Refer to EditChannel
s documentation for a full list of methods.
Note: Requires the Manage Channels permission, also requires the Manage Roles permission if modifying permissions for the category.
Examples
Change a voice channels name and bitrate:
category.edit(&http, |c| c.name("test").bitrate(86400)).await;
Errors
Returns Error::Http
if an invalid value is set,
or if the current user lacks the necessary permissions.
pub fn is_nsfw(&self) -> bool
model
only.Trait Implementations
sourceimpl ArgumentConvert for ChannelCategory
impl ArgumentConvert for ChannelCategory
Look up a ChannelCategory by a string case-insensitively.
Lookup is done by the global cache, hence the cache feature needs to be enabled.
For more information, see the ArgumentConvert implementation for Channel
type Err = ChannelCategoryParseError
type Err = ChannelCategoryParseError
utils
and client
only.The associated error which can be returned from parsing.
sourcefn convert<'life0, 'life1, 'async_trait>(
ctx: &'life0 Context,
guild_id: Option<GuildId>,
channel_id: Option<ChannelId>,
s: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn convert<'life0, 'life1, 'async_trait>(
ctx: &'life0 Context,
guild_id: Option<GuildId>,
channel_id: Option<ChannelId>,
s: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
utils
and client
only.Parses a string s
as a command parameter of this type.
sourceimpl Clone for ChannelCategory
impl Clone for ChannelCategory
sourcefn clone(&self) -> ChannelCategory
fn clone(&self) -> ChannelCategory
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 ChannelCategory
impl Debug for ChannelCategory
sourceimpl<'de> Deserialize<'de> for ChannelCategory
impl<'de> Deserialize<'de> for ChannelCategory
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Mentionable for ChannelCategory
impl Mentionable for ChannelCategory
sourceimpl Serialize for ChannelCategory
impl Serialize for ChannelCategory
Auto Trait Implementations
impl RefUnwindSafe for ChannelCategory
impl Send for ChannelCategory
impl Sync for ChannelCategory
impl Unpin for ChannelCategory
impl UnwindSafe for ChannelCategory
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