[][src]Struct serenity::model::channel::PrivateChannel

pub struct PrivateChannel {
    pub id: ChannelId,
    pub last_message_id: Option<MessageId>,
    pub last_pin_timestamp: Option<DateTime<FixedOffset>>,
    pub kind: ChannelType,
    pub recipient: Arc<RwLock<User>>,
    // some fields omitted
}

A Direct Message text channel with another user.

Fields

id: ChannelId

The unique Id of the private channel.

Can be used to calculate the first message's creation date.

last_message_id: Option<MessageId>

The Id of the last message sent.

last_pin_timestamp: Option<DateTime<FixedOffset>>

Timestamp of the last time a Message was pinned.

kind: ChannelType

Indicator of the type of channel this is.

This should always be ChannelType::Private.

recipient: Arc<RwLock<User>>

The recipient to the private channel.

Implementations

impl PrivateChannel[src]

pub fn broadcast_typing(&self, http: impl AsRef<Http>) -> Result<()>[src]

Broadcasts that the current user is typing to the recipient.

pub fn create_reaction<M, R>(
    &self,
    http: impl AsRef<Http>,
    message_id: M,
    reaction_type: R
) -> Result<()> where
    M: Into<MessageId>,
    R: Into<ReactionType>, 
[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.

pub fn delete(&self, http: impl AsRef<Http>) -> Result<Channel>[src]

Deletes the channel. This does not delete the contents of the channel, and is equivalent to closing a private channel on the client, which can be re-opened.

pub fn delete_messages<T: AsRef<MessageId>, It: IntoIterator<Item = T>>(
    &self,
    http: impl AsRef<Http>,
    message_ids: It
) -> Result<()>
[src]

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

Refer to 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.

pub fn delete_permission(
    &self,
    http: impl AsRef<Http>,
    permission_type: PermissionOverwriteType
) -> Result<()>
[src]

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

Note: Requires the Manage Channel permission.

pub fn delete_reaction<M, R>(
    &self,
    http: impl AsRef<Http>,
    message_id: M,
    user_id: Option<UserId>,
    reaction_type: R
) -> Result<()> where
    M: Into<MessageId>,
    R: Into<ReactionType>, 
[src]

Deletes the given Reaction from the channel.

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

pub fn edit_message<F, M>(
    &self,
    http: impl AsRef<Http>,
    message_id: M,
    f: F
) -> Result<Message> where
    F: FnOnce(&mut EditMessage) -> &mut EditMessage,
    M: Into<MessageId>, 
[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.

pub fn is_nsfw(&self) -> bool[src]

Determines if the channel is NSFW.

Note: This method is for consistency. This will always return false, due to DMs not being considered NSFW.

pub fn message<M: Into<MessageId>>(
    &self,
    http: impl AsRef<Http>,
    message_id: M
) -> Result<Message>
[src]

Gets a message from the channel.

Requires the Read Message History permission.

pub fn messages<F>(
    &self,
    http: impl AsRef<Http>,
    builder: F
) -> Result<Vec<Message>> where
    F: FnOnce(&mut GetMessages) -> &mut GetMessages
[src]

Gets messages from the channel.

Refer to GetMessages for more information on how to use builder.

Requires the Read Message History permission.

pub fn name(&self) -> String[src]

Returns "DM with $username#discriminator".

pub fn reaction_users<M, R, U>(
    &self,
    http: impl AsRef<Http>,
    message_id: M,
    reaction_type: R,
    limit: Option<u8>,
    after: U
) -> Result<Vec<User>> where
    M: Into<MessageId>,
    R: Into<ReactionType>,
    U: Into<Option<UserId>>, 
[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.

pub fn pin<M: Into<MessageId>>(
    &self,
    http: impl AsRef<Http>,
    message_id: M
) -> Result<()>
[src]

Pins a Message to the channel.

pub fn pins(&self, http: impl AsRef<Http>) -> Result<Vec<Message>>[src]

Retrieves the list of messages that have been pinned in the private channel.

pub fn say(
    &self,
    http: impl AsRef<Http>,
    content: impl Display
) -> Result<Message>
[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.

pub fn send_files<'a, F, T, It>(
    &self,
    http: impl AsRef<Http>,
    files: It,
    f: F
) -> Result<Message> where
    F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>,
    T: Into<AttachmentType<'a>>,
    It: IntoIterator<Item = T>, 
[src]

Sends (a) file(s) along with optional message contents.

Refer to ChannelId::send_files for examples and more information.

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.

pub fn send_message<'a, F>(
    &self,
    http: impl AsRef<Http>,
    f: F
) -> Result<Message> where
    F: FnOnce(&'b mut CreateMessage<'a>) -> &'b mut CreateMessage<'a>, 
[src]

Sends a message to the channel with the given content.

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

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.

pub fn unpin<M: Into<MessageId>>(
    &self,
    http: impl AsRef<Http>,
    message_id: M
) -> Result<()>
[src]

Unpins a Message in the channel given by its Id.

Requires the Manage Messages permission.

Trait Implementations

impl Clone for PrivateChannel[src]

impl Debug for PrivateChannel[src]

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

impl Display for PrivateChannel[src]

fn fmt(&self, f: &mut Formatter) -> FmtResult[src]

Formats the private channel, displaying the recipient's username.

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

fn from(private_channel: &PrivateChannel) -> ChannelId[src]

Gets the Id of a private channel.

impl From<PrivateChannel> for ChannelId[src]

fn from(private_channel: PrivateChannel) -> ChannelId[src]

Gets the Id of a private channel.

impl Mentionable for PrivateChannel[src]

impl Serialize for PrivateChannel[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,