Struct serenity::model::channel::ChannelCategory [−][src]
#[non_exhaustive]pub struct ChannelCategory {
pub id: ChannelId,
pub guild_id: GuildId,
pub category_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.
category_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
pub async fn create_permission(
&self,
http: impl AsRef<Http>,
target: &PermissionOverwrite
) -> Result<()>
pub async fn create_permission(
&self,
http: impl AsRef<Http>,
target: &PermissionOverwrite
) -> Result<()>
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.
pub async fn delete_permission(
&self,
http: impl AsRef<Http>,
permission_type: PermissionOverwriteType
) -> Result<()>
pub async fn delete_permission(
&self,
http: impl AsRef<Http>,
permission_type: PermissionOverwriteType
) -> Result<()>
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.
Deletes this category.
Note: Requires the Manage Channels permission.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn edit<F>(&mut self, cache_http: impl CacheHttp, f: F) -> Result<()> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
pub async fn edit<F>(&mut self, cache_http: impl CacheHttp, f: F) -> Result<()> where
F: FnOnce(&mut EditChannel) -> &mut EditChannel,
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.
Trait Implementations
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
The associated error which can be returned from parsing.
Parses a string s
as a command parameter of this type.
fn 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
Performs the conversion.
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
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
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