Struct serenity::model::GuildChannel
[−]
[src]
pub struct GuildChannel { pub id: ChannelId, pub bitrate: Option<u64>, pub guild_id: GuildId, pub kind: ChannelType, pub last_message_id: Option<MessageId>, pub last_pin_timestamp: Option<String>, pub name: String, pub permission_overwrites: Vec<PermissionOverwrite>, pub position: i64, pub topic: Option<String>, pub user_limit: Option<u64>, }
Represents a guild's voice or text channel. Some methods are available only for voice channels and some are only available for text channels.
Fields
id: ChannelId
Channel's Id. Default channel shares the Id with the guild it is in.
bitrate: Option<u64>
Bitrate of channel. Only available for voice channels.
guild_id: GuildId
Id of the guild the channel is located in.
kind: ChannelType
Type of the channel.
last_message_id: Option<MessageId>
The Id of last message sent. It lets client determine if channel has unread messages.
last_pin_timestamp: Option<String>
Timestamp of the latest pinned message.
name: String
Channel name. Voice and text channels have different limitations for this.
permission_overwrites: Vec<PermissionOverwrite>
Permission overwrites for members and roles.
position: i64
Position of a channel.
topic: Option<String>
Text channel topic.
user_limit: Option<u64>
Max amount of members allowed in a voice channel.
Methods
impl GuildChannel
[src]
fn broadcast_typing(&self) -> Result<()>
Broadcasts to the channel that the current user is typing.
For bots, this is a good indicator for long-running commands.
Note: Requires the Send Messages permission.
Errors
Returns a [ClientError::InvalidPermissions] if the current user does not have the required permissions.
fn create_invite<F>(&self, f: F) -> Result<RichInvite> where F: FnOnce(CreateInvite) -> CreateInvite
Creates an invite leading to the given channel.
Examples
Create an invite that can only be used 5 times:
let invite = channel.create_invite(|i| i .max_uses(5));
fn delete(&self) -> Result<Channel>
Deletes this channel, returning the channel on a successful deletion.
fn edit<F>(&mut self, f: F) -> Result<()> where F: FnOnce(EditChannel) -> EditChannel
Modifies a channel's settings, such as its position or name.
Refer to EditChannel
s documentation for a full list of methods.
Examples
Change a voice channels name and bitrate:
channel.edit(|c| c .name("test") .bitrate(71));
fn guild(&self) -> Option<Guild>
Attempts to find this channel's guild in the Cache.
Note: Right now this performs a clone of the guild. This will be optimized in the future.
fn mention(&self) -> Mention
Return a Mention
which will link to this channel.
fn pins(&self) -> Result<Vec<Message>>
Gets all channel's pins.
fn send_message(&self, content: &str) -> Result<Message>
Sends a message to the channel with the given content.
Note: This will only work when a [Message
] is received.
Note: Requires the Send Messages permission.
Errors
Returns a ClientError::MessageTooLong
if the content of the message
is over the above limit, containing the number of unicode code points
over the limit.
Returns a ClientError::InvalidPermissions
if the current user does
not have the required permissions.
fn webhooks(&self) -> Result<Vec<Webhook>>
Retrieves the channel's webhooks.
Note: Requires the Manage Webhooks permission.
Trait Implementations
impl Display for GuildChannel
[src]
impl Clone for GuildChannel
[src]
fn clone(&self) -> GuildChannel
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more