pub struct CreateAllowedMentions { /* private fields */ }
Expand description
A builder to manage the allowed mentions on a message, used by the ChannelId::send_message
and ChannelId::edit_message
methods.
§Examples
use serenity::builder::CreateAllowedMentions as Am;
// Mention only the user 110372470472613888
m.allowed_mentions(Am::new().users(vec![110372470472613888]));
// Mention all users and the role 182894738100322304
m.allowed_mentions(Am::new().all_users(true).roles(vec![182894738100322304]));
// Mention all roles and nothing else
m.allowed_mentions(Am::new().all_roles(true));
// Mention all roles and users, but not everyone
m.allowed_mentions(Am::new().all_users(true).all_roles(true));
// Mention everyone and the users 182891574139682816, 110372470472613888
m.allowed_mentions(
Am::new().everyone(true).users(vec![182891574139682816, 110372470472613888]),
);
// Mention everyone and the message author.
m.allowed_mentions(Am::new().everyone(true).users(vec![msg.author.id]));
Implementations§
Source§impl CreateAllowedMentions
impl CreateAllowedMentions
Sourcepub fn new() -> Self
pub fn new() -> Self
Equivalent to Self::default
.
Sourcepub fn all_users(self, allow: bool) -> Self
pub fn all_users(self, allow: bool) -> Self
Toggles mentions for all users. Overrides Self::users
if it was previously set.
Sourcepub fn all_roles(self, allow: bool) -> Self
pub fn all_roles(self, allow: bool) -> Self
Toggles mentions for all roles. Overrides Self::roles
if it was previously set.
Sourcepub fn users(self, users: impl IntoIterator<Item = impl Into<UserId>>) -> Self
pub fn users(self, users: impl IntoIterator<Item = impl Into<UserId>>) -> Self
Sets the specific users that will be allowed mentionable.
Sourcepub fn empty_users(self) -> Self
pub fn empty_users(self) -> Self
Clear the list of mentionable users.
Sourcepub fn roles(self, roles: impl IntoIterator<Item = impl Into<RoleId>>) -> Self
pub fn roles(self, roles: impl IntoIterator<Item = impl Into<RoleId>>) -> Self
Sets the specific roles that will be allowed mentionable.
Sourcepub fn empty_roles(self) -> Self
pub fn empty_roles(self) -> Self
Clear the list of mentionable roles.
Sourcepub fn replied_user(self, mention_user: bool) -> Self
pub fn replied_user(self, mention_user: bool) -> Self
Makes the reply mention/ping the user.
Trait Implementations§
Source§impl Clone for CreateAllowedMentions
impl Clone for CreateAllowedMentions
Source§fn clone(&self) -> CreateAllowedMentions
fn clone(&self) -> CreateAllowedMentions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CreateAllowedMentions
impl Debug for CreateAllowedMentions
Source§impl Default for CreateAllowedMentions
impl Default for CreateAllowedMentions
Source§fn default() -> CreateAllowedMentions
fn default() -> CreateAllowedMentions
Returns the “default value” for a type. Read more
Source§impl PartialEq for CreateAllowedMentions
impl PartialEq for CreateAllowedMentions
Source§impl Serialize for CreateAllowedMentions
impl Serialize for CreateAllowedMentions
impl StructuralPartialEq for CreateAllowedMentions
Auto Trait Implementations§
impl Freeze for CreateAllowedMentions
impl RefUnwindSafe for CreateAllowedMentions
impl Send for CreateAllowedMentions
impl Sync for CreateAllowedMentions
impl Unpin for CreateAllowedMentions
impl UnwindSafe for CreateAllowedMentions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more