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

pub struct ChannelId(pub u64);

An identifier for a Channel

Methods

impl ChannelId
[src]

Marks a Channel as being read up to a certain Message.

Refer to the documentation for rest::ack_message for more information.

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

use serenity::model::ChannelId;

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

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.

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.

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

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.

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: This uses bulk delete endpoint which is not available for user accounts.

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

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

Note: Requires the Manage Channel permission.

Deletes the given Reaction from the channel.

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

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:

context.edit_channel(channel_id, |c| c
    .name("test")
    .bitrate(64000));

Errors

Returns a ClientError::NoChannelId if the current context is not related to a channel.

Edits a Message in the channel given its Id.

Pass an empty string ("") to text if you are editing a message with an embed or file but no content. Otherwise, text must be given.

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

Errors

Returns a ClientError::NoChannelId if the current context is not related to a channel.

Search the cache for the channel with the Id.

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

Gets all of the channel's invites.

Requires the Manage Channels permission.

Gets a message from the channel.

Requires the Read Message History permission.

Gets messages from the channel.

Refer to Channel::get_messages for more information.

Requires the Read Message History permission.

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

Refer to Channel::get_reaction_users for more information.

Note: Requires the Read Message History permission.

Retrieves the channel's webhooks.

Note: Requires the Manage Webhooks permission.

Pins a Message to the channel.

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

Searches the channel's messages by providing query parameters via the search builder.

Refer to the documentation for the Search builder for restrictions and defaults parameters, as well as potentially advanced usage.

Note: Bot users can not search.

Examples

Refer to the Search builder's documentation for examples, specifically the section on [searching a channel][search channel].

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.

Requires the Attach Files and Send Messages permissions are required.

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

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.

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 is required.

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

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.

Unpins a Message in the channel given by its Id.

Requires the Manage Messages permission.

impl ChannelId
[src]

Retrieves the time that the Id was created at.

Trait Implementations

impl From<Channel> for ChannelId
[src]

Gets the Id of a Channel.

impl From<PrivateChannel> for ChannelId
[src]

Gets the Id of a private channel.

impl From<GuildChannel> for ChannelId
[src]

Gets the Id of a guild channel.

impl Display for ChannelId
[src]

Formats the value using the given formatter.

impl Mentionable for ChannelId
[src]

impl FromStr for ChannelId
[src]

The associated error which can be returned from parsing.

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

impl Copy for ChannelId
[src]

impl Clone for ChannelId
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ChannelId
[src]

Formats the value using the given formatter.

impl Eq for ChannelId
[src]

impl Hash for ChannelId
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl PartialOrd for ChannelId
[src]

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

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

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

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

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]

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

impl From<u64> for ChannelId
[src]

Performs the conversion.

impl PartialEq for ChannelId
[src]

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

This method tests for !=.

impl PartialEq<u64> for ChannelId
[src]

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

This method tests for !=.