Struct serenity::model::Group
[−]
[src]
pub struct Group { pub channel_id: ChannelId, pub icon: Option<String>, pub last_message_id: Option<MessageId>, pub last_pin_timestamp: Option<DateTime<FixedOffset>>, pub name: Option<String>, pub owner_id: UserId, pub recipients: HashMap<UserId, Arc<RwLock<User>>>, }
Fields
channel_id: ChannelId
The Id of the group channel.
icon: Option<String>
The optional icon of the group channel.
last_message_id: Option<MessageId>
The Id of the last message sent.
last_pin_timestamp: Option<DateTime<FixedOffset>>
Timestamp of the latest pinned message.
name: Option<String>
The name of the group channel.
owner_id: UserId
The Id of the group owner.
recipients: HashMap<UserId, Arc<RwLock<User>>>
A map of the group's recipients.
Methods
impl Group
[src]
fn add_recipient<U: Into<UserId>>(&self, user: U) -> Result<()>
[src]
Adds the given user to the group. If the user is already in the group, then nothing is done.
Refer to http::add_group_recipient
for more information.
Note: Groups have a limit of 10 recipients, including the current user.
fn broadcast_typing(&self) -> Result<()>
[src]
Broadcasts that the current user is typing in the group.
fn create_reaction<M, R>(&self, message_id: M, reaction_type: R) -> Result<()> where
M: Into<MessageId>,
R: Into<ReactionType>,
[src]
M: Into<MessageId>,
R: Into<ReactionType>,
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.
fn delete_messages<T: AsRef<MessageId>, It: IntoIterator<Item = T>>(
&self,
message_ids: It
) -> Result<()>
[src]
&self,
message_ids: It
) -> Result<()>
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: 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.
fn delete_permission(
&self,
permission_type: PermissionOverwriteType
) -> Result<()>
[src]
&self,
permission_type: PermissionOverwriteType
) -> Result<()>
Deletes all permission overrides in the channel from a member or role.
Note: Requires the Manage Channel permission.
fn delete_reaction<M, R>(
&self,
message_id: M,
user_id: Option<UserId>,
reaction_type: R
) -> Result<()> where
M: Into<MessageId>,
R: Into<ReactionType>,
[src]
&self,
message_id: M,
user_id: Option<UserId>,
reaction_type: R
) -> Result<()> where
M: Into<MessageId>,
R: Into<ReactionType>,
Deletes the given Reaction
from the channel.
Note: Requires the Manage Messages permission, if the current user did not perform the reaction.
fn edit_message<F, M>(&self, message_id: M, f: F) -> Result<Message> where
F: FnOnce(CreateMessage) -> CreateMessage,
M: Into<MessageId>,
[src]
F: FnOnce(CreateMessage) -> CreateMessage,
M: Into<MessageId>,
Edits a Message
in the channel given its Id.
Message editing preserves all unchanged message data.
Refer to the documentation for CreateMessage
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.
fn icon_url(&self) -> Option<String>
[src]
Returns the formatted URI of the group's icon if one exists.
fn is_nsfw(&self) -> bool
[src]
Determines if the channel is NSFW.
Refer to utils::is_nsfw
for more details.
Note: This method is for consistency. This will always return
false
, due to groups not being considered NSFW.
fn leave(&self) -> Result<Group>
[src]
Leaves the group.
fn message<M: Into<MessageId>>(&self, message_id: M) -> Result<Message>
[src]
Gets a message from the channel.
Requires the Read Message History permission.
fn messages<F>(&self, f: F) -> Result<Vec<Message>> where
F: FnOnce(GetMessages) -> GetMessages,
[src]
F: FnOnce(GetMessages) -> GetMessages,
Gets messages from the channel.
Requires the Read Message History permission.
fn name(&self) -> Cow<str>
[src]
Generates a name for the group.
If there are no recipients in the group, the name will be "Empty Group". Otherwise, the name is generated in a Comma Separated Value list, such as "person 1, person 2, person 3".
fn pins(&self) -> Result<Vec<Message>>
[src]
Retrieves the list of messages that have been pinned in the group.
fn reaction_users<M, R, U>(
&self,
message_id: M,
reaction_type: R,
limit: Option<u8>,
after: Option<U>
) -> Result<Vec<User>> where
M: Into<MessageId>,
R: Into<ReactionType>,
U: Into<UserId>,
[src]
&self,
message_id: M,
reaction_type: R,
limit: Option<u8>,
after: Option<U>
) -> Result<Vec<User>> where
M: Into<MessageId>,
R: Into<ReactionType>,
U: Into<UserId>,
Gets the list of User
s 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.
fn remove_recipient<U: Into<UserId>>(&self, user: U) -> Result<()>
[src]
Removes a recipient from the group. If the recipient is already not in the group, then nothing is done.
Note: This is only available to the group owner.
fn say(&self, content: &str) -> 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.
fn send_files<'a, F, T, It: IntoIterator<Item = T>>(
&self,
files: It,
f: F
) -> Result<Message> where
F: FnOnce(CreateMessage) -> CreateMessage,
T: Into<AttachmentType<'a>>,
[src]
&self,
files: It,
f: F
) -> Result<Message> where
F: FnOnce(CreateMessage) -> CreateMessage,
T: Into<AttachmentType<'a>>,
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.
fn send_message<F: FnOnce(CreateMessage) -> CreateMessage>(
&self,
f: F
) -> Result<Message>
[src]
&self,
f: F
) -> Result<Message>
Sends a message to the group with the given content.
Refer to the documentation for CreateMessage
for more information
regarding message restrictions and requirements.
Note: Requires the Send Messages permission.
fn unpin<M: Into<MessageId>>(&self, 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 Group
[src]
fn clone(&self) -> Group
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more