Struct serenity::model::id::ChannelId [] [src]

pub struct ChannelId(pub u64);

An identifier for a Channel

Methods

impl ChannelId
[src]

[src]

Broadcasts that the current user is typing to a channel for the next 5 seconds.

After 5 seconds, another request must be made to continue broadcasting that the current user is typing.

This should rarely be used for bots, and should likely only be used for signifying that a long-running command is still being executed.

Note: Requires the Send Messages permission.

Examples

Be careful when using this code, it's not being tested!
use serenity::model::ChannelId;

let _successful = ChannelId(7).broadcast_typing();

[src]

Creates a permission overwrite for either a single Member or Role within the channel.

Refer to the documentation for GuildChannel::create_permission for more information.

Requires the Manage Channels permission.

[src]

React to a Message with a custom Emoji or unicode character.

Message::react may be a more suited method of reacting in most cases.

Requires the Add Reactions permission, if the current user is the first user to perform a react with a certain emoji.

[src]

Deletes this channel, returning the channel on a successful deletion.

[src]

Deletes a Message given its Id.

Refer to Message::delete for more information.

Requires the Manage Messages permission, if the current user is not the author of the message.

[src]

Deletes all messages by Ids from the given vector in the given channel.

Refer to the documentation for Channel::delete_messages for more information.

Requires the Manage Messages permission.

Note: Messages that are older than 2 weeks can't be deleted using this method.

Errors

Returns ModelError::BulkDeleteAmount if an attempt was made to delete either 0 or more than 100 messages.

[src]

Deletes all permission overrides in the channel from a member or role.

Note: Requires the Manage Channel permission.

[src]

Deletes the given Reaction from the channel.

Note: Requires the Manage Messages permission, if the current user did not perform the reaction.

[src]

Edits the settings of a Channel, optionally setting new values.

Refer to EditChannel's documentation for its methods.

Requires the Manage Channel permission.

Examples

Change a voice channel's name and bitrate:

Be careful when using this code, it's not being tested!
// assuming a `channel_id` has been bound

channel_id.edit(|c| c.name("test").bitrate(64000));

[src]

Edits a Message in the channel given its Id.

Message editing preserves all unchanged message data.

Refer to the documentation for EditMessage for more information regarding message restrictions and requirements.

Note: Requires that the current user be the author of the message.

Errors

Returns a ModelError::MessageTooLong if the content of the message is over the the limit, containing the number of unicode code points over the limit.

[src]

Search the cache for the channel with the Id.

[src]

Search the cache for the channel. If it can't be found, the channel is requested over REST.

[src]

Gets all of the channel's invites.

Requires the Manage Channels permission.

[src]

Gets a message from the channel.

Requires the Read Message History permission.

[src]

Gets messages from the channel.

Refer to Channel::messages for more information.

Requires the Read Message History permission.

[src]

Returns the name of whatever channel this id holds.

[src]

Pins a Message to the channel.

[src]

Gets the list of Messages which are pinned to the channel.

[src]

Gets the list of Users who have reacted to a Message with a certain Emoji.

Refer to Channel::reaction_users for more information.

Note: Requires the Read Message History permission.

[src]

Sends a message with just the given message content in the channel.

Errors

Returns a ModelError::MessageTooLong if the content of the message is over the above limit, containing the number of unicode code points over the limit.

[src]

Sends a file along with optional message contents. The filename must be specified.

Message contents may be passed by using the CreateMessage::content method.

An embed can not be sent when sending a file. If you set one, it will be automatically removed.

The Attach Files and Send Messages permissions are required.

Note: Message contents must be under 2000 unicode code points.

Examples

Send files with the paths /path/to/file.jpg and /path/to/file2.jpg:

use serenity::model::id::ChannelId;

let channel_id = ChannelId(7);

let paths = vec!["/path/to/file.jpg", "path/to/file2.jpg"];

let _ = channel_id.send_files(paths, |m| m.content("a file"));

Send files using File:

use serenity::model::id::ChannelId;
use std::fs::File;

let channel_id = ChannelId(7);

let f1 = File::open("my_file.jpg").unwrap();
let f2 = File::open("my_file2.jpg").unwrap();

let files = vec![(&f1, "my_file.jpg"), (&f2, "my_file2.jpg")];

let _ = channel_id.send_files(files, |m| m.content("a file"));

Errors

If the content of the message is over the above limit, then a ClientError::MessageTooLong will be returned, containing the number of unicode code points over the limit.

Returns an HttpError::InvalidRequest(PayloadTooLarge) if the file is too large to send.

[src]

Sends a message to the channel.

Refer to the documentation for CreateMessage for more information regarding message restrictions and requirements.

Requires the Send Messages permission.

Note: Message contents must be under 2000 unicode code points.

Errors

Returns a ModelError::MessageTooLong if the content of the message is over the above limit, containing the number of unicode code points over the limit.

[src]

Unpins a Message in the channel given by its Id.

Requires the Manage Messages permission.

[src]

Retrieves the channel's webhooks.

Note: Requires the Manage Webhooks permission.

impl ChannelId
[src]

[src]

Retrieves the time that the Id was created at.

Trait Implementations

impl From<Channel> for ChannelId
[src]

[src]

Gets the Id of a Channel.

impl<'a> From<&'a Channel> for ChannelId
[src]

[src]

Gets the Id of a Channel.

impl From<PrivateChannel> for ChannelId
[src]

[src]

Gets the Id of a private channel.

impl<'a> From<&'a PrivateChannel> for ChannelId
[src]

[src]

Gets the Id of a private channel.

impl From<GuildChannel> for ChannelId
[src]

[src]

Gets the Id of a guild channel.

impl<'a> From<&'a GuildChannel> for ChannelId
[src]

[src]

Gets the Id of a guild channel.

impl Copy for ChannelId
[src]

impl Clone for ChannelId
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for ChannelId
[src]

[src]

Returns the "default value" for a type. Read more

impl Debug for ChannelId
[src]

[src]

Formats the value using the given formatter.

impl Eq for ChannelId
[src]

impl Hash for ChannelId
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd for ChannelId
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for ChannelId
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl AsRef<ChannelId> for ChannelId
[src]

[src]

Performs the conversion.

impl From<u64> for ChannelId
[src]

[src]

Performs the conversion.

impl PartialEq for ChannelId
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl PartialEq<u64> for ChannelId
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Display for ChannelId
[src]

[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for ChannelId
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Mentionable for ChannelId
[src]

[src]

Creates a mentionable string, that will be able to notify and/or create a link to the item. Read more

impl FromStr for ChannelId
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more