Struct serenity::builder::CreateAllowedMentions
source · [−]builder
only.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::ParseValue;
// Mention only the user 110372470472613888
m.allowed_mentions(|am| am.empty_parse().users(vec![110372470472613888]));
// Mention all users and the role 182894738100322304
m.allowed_mentions(|am| am.parse(ParseValue::Users).roles(vec![182894738100322304]));
// Mention all roles and nothing else
m.allowed_mentions(|am| am.parse(ParseValue::Roles));
// Mention all roles and users, but not everyone
m.allowed_mentions(|am| am.parse(ParseValue::Users).parse(ParseValue::Roles));
// Mention everyone and the users 182891574139682816, 110372470472613888
m.allowed_mentions(|am| {
am.parse(ParseValue::Everyone).users(vec![182891574139682816, 110372470472613888])
});
// Mention everyone and the message author.
m.allowed_mentions(|am| am.parse(ParseValue::Everyone).users(vec![msg.author.id]));
Tuple Fields
0: HashMap<&'static str, Value>
Implementations
sourceimpl CreateAllowedMentions
impl CreateAllowedMentions
sourcepub fn parse(&mut self, value: ParseValue) -> &mut Self
pub fn parse(&mut self, value: ParseValue) -> &mut Self
Add a value that’s allowed to be mentioned.
If users or roles is specified, Self::users
and Self::roles
will not work.
If you use either, do not specify it’s same type here.
sourcepub fn empty_parse(&mut self) -> &mut Self
pub fn empty_parse(&mut self) -> &mut Self
Clear all the values that would be mentioned.
If parse is empty, the message will not mention anyone, unless they are specified on
Self::users
or Self::roles
.
sourcepub fn users<U: Into<UserId>>(
&mut self,
users: impl IntoIterator<Item = U>
) -> &mut Self
pub fn users<U: Into<UserId>>(
&mut self,
users: impl IntoIterator<Item = U>
) -> &mut Self
Sets the users that will be allowed to be mentioned.
sourcepub fn empty_users(&mut self) -> &mut Self
pub fn empty_users(&mut self) -> &mut Self
Makes users unable to be mentioned.
sourcepub fn roles<R: Into<RoleId>>(
&mut self,
users: impl IntoIterator<Item = R>
) -> &mut Self
pub fn roles<R: Into<RoleId>>(
&mut self,
users: impl IntoIterator<Item = R>
) -> &mut Self
Sets the roles that will be allowed to be mentioned.
sourcepub fn empty_roles(&mut self) -> &mut Self
pub fn empty_roles(&mut self) -> &mut Self
Makes roles unable to be mentioned.
sourcepub fn replied_user(&mut self, mention_user: bool) -> &mut Self
pub fn replied_user(&mut self, mention_user: bool) -> &mut Self
Makes the reply mention/ping the user.
Trait Implementations
sourceimpl Clone for CreateAllowedMentions
impl Clone for CreateAllowedMentions
sourcefn clone(&self) -> CreateAllowedMentions
fn clone(&self) -> CreateAllowedMentions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CreateAllowedMentions
impl Debug for CreateAllowedMentions
sourceimpl Default for CreateAllowedMentions
impl Default for CreateAllowedMentions
sourcefn default() -> CreateAllowedMentions
fn default() -> CreateAllowedMentions
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for CreateAllowedMentions
impl Send for CreateAllowedMentions
impl Sync for CreateAllowedMentions
impl Unpin for CreateAllowedMentions
impl UnwindSafe for CreateAllowedMentions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more